Adding disconnect cause in kamailio SM, modified tests

This commit is contained in:
DanB
2015-05-26 19:09:20 +02:00
parent f4f56937b7
commit a2e36b6ae6
6 changed files with 41 additions and 24 deletions

View File

@@ -29,6 +29,12 @@ event_route[dialog:end] {
route(CGR_CALL_END);
}
# Called by Kamailio on local disconnect
event_route[tm:local-request] {
route(CGR_CALL_END);
}
# Send AUTH_REQUEST to CGRateS
route[CGRATES_AUTH_REQUEST] {
# Auth INVITEs with CGRateS
@@ -106,6 +112,7 @@ route[CGR_CALL_END] {
\"cgr_destination\":\"$dlg_var(cgrDestination)\",
\"cgr_answertime\":\"$dlg(start_ts)\",
\"cgr_duration\":\"$var(callDur)\",
\"cgr_supplier\":\"$dlg_var(cgrSupplier)\"}");
\"cgr_supplier\":\"$dlg_var(cgrSupplier)\",
\"cgr_disconnectcause\":\"$T_reply_code\"}");
}

View File

@@ -187,18 +187,15 @@ request_route {
# Here will land requests after processing them with CGRateS. Call RELAY or other routes following this route
route[CGRATES_AUTH_REPLY] {
xlog("CGRATES_AUTH_REPLY reply, got CgrError: $var(CgrError)");
if $var(CgrError) != "" {
xlog("CGR_AUTH_ERROR: $var(CgrError)");
sl_send_reply("503","CGR_ERROR");
exit;
}
xlog("CGRATES_AUTH_REPLY, CgrMaxSessionTime: $var(CgrMaxSessionTime)");
if $var(CgrMaxSessionTime) != -1 && !dlg_set_timeout("$var(CgrMaxSessionTime)") {
sl_send_reply("503","CGR_MAX_SESSION_TIME_ERROR");
exit;
}
xlog("CGRATES_AUTH_REPLY, CgrSuppliers: $var(CgrSuppliers)");
if $var(CgrSuppliers) != "" { # Enforce the supplier variable to the first one received from CGRateS, more for testing purposes
$dlg_var(cgrSupplier) = $(var(CgrSuppliers){s.select,0,,});
}