Better LCR error handling, SM-Kamailio fixes for LCR handling

This commit is contained in:
DanB
2015-05-24 17:43:37 +02:00
parent dbd0f369b1
commit 73be367dd7
7 changed files with 60 additions and 34 deletions

View File

@@ -52,11 +52,13 @@ route[CGR_AUTH_REPLY] {
json_get_field("$evapi(msg)", "TransactionIndex", "$var(TransactionIndex)");
json_get_field("$evapi(msg)", "TransactionLabel", "$var(TransactionLabel)");
json_get_field("$evapi(msg)", "MaxSessionTime", "$var(MaxSessionTime)");
json_get_field("$evapi(msg)", "Suppliers", "$avp(CgrSuppliers)");
json_get_field("$evapi(msg)", "Error", "$avp(CgrError)");
json_get_field("$evapi(msg)", "Suppliers", "$var(Suppliers)");
json_get_field("$evapi(msg)", "Error", "$var(Error)");
$var(id_index) = $(var(TransactionIndex){s.int});
$var(id_label) = $(var(TransactionLabel){s.int});
$avp(CgrMaxSessionTime) = $(var(MaxSessionTime){s.int});
$var(CgrMaxSessionTime) = $(var(MaxSessionTime){s.int});
$var(CgrSuppliers) = $(var(Suppliers){s.rm,"});
$var(CgrError) = $(var(Error){s.rm,"});
t_continue("$var(id_index)", "$var(id_label)", "CGRATES_AUTH_REPLY"); # Unpark the transaction
}
@@ -84,7 +86,8 @@ route[CGR_CALL_START] {
\"cgr_tenant\":\"$dlg_var(cgrTenant)\",
\"cgr_account\":\"$dlg_var(cgrAccount)\",
\"cgr_destination\":\"$dlg_var(cgrDestination)\",
\"cgr_answertime\":\"$TS\"}");
\"cgr_answertime\":\"$TS\",
\"cgr_supplier\":\"$dlg_var(cgrSupplier)\"}");
}
# Inform CGRateS about CALL_END (stop debit loops, perform accounting if desired in this way)
@@ -102,6 +105,7 @@ route[CGR_CALL_END] {
\"cgr_account\":\"$dlg_var(cgrAccount)\",
\"cgr_destination\":\"$dlg_var(cgrDestination)\",
\"cgr_answertime\":\"$dlg(start_ts)\",
\"cgr_duration\":\"$var(callDur)\"}");
\"cgr_duration\":\"$var(callDur)\",
\"cgr_supplier\":\"$dlg_var(cgrSupplier)\"}");
}

View File

@@ -41,7 +41,6 @@ loadmodule "sanity.so"
loadmodule "ctl.so"
loadmodule "mi_rpc.so"
loadmodule "nathelper.so"
loadmodule "rtpproxy.so"
loadmodule "htable.so"
loadmodule "auth.so"
loadmodule "evapi.so"
@@ -75,9 +74,6 @@ modparam("dialog", "dlg_flag", FLT_DIALOG)
modparam("dialog", "send_bye", 1)
modparam("dialog", "timeout_noreset", 1)
# ----- rtpproxy params -----
modparam("rtpproxy", "rtpproxy_sock", "udp:127.0.0.1:7722")
# ----- nathelper params -----
modparam("nathelper", "natping_interval", 30)
modparam("nathelper", "ping_nated_only", 1)
@@ -191,17 +187,20 @@ request_route {
# Here will land requests after processing them with CGRateS. Call RELAY or other routes following this route
route[CGRATES_AUTH_REPLY] {
if $avp(CgrError) != "null" { # null is converted in string by json_get_field
xlog("CGR_AUTH_ERROR: $avp(CgrError)");
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;
}
if $avp(CgrMaxSessionTime) != -1 && !dlg_set_timeout("$avp(CgrMaxSessionTime)") {
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;
}
if $avp(CgrSuppliers) != "" { # Enforce the supplier variable to the first one received from CGRateS, more for testing purposes
$dlg_var(supplier) = $(avp(CgrSuppliers){s.select,0,,});
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,,});
}
route(RELAY);
}
@@ -353,8 +352,6 @@ route[NATMANAGE] {
if (!(isflagset(FLT_NATS) || isbflagset(FLB_NATB)))
return;
rtpproxy_manage("co");
if (is_request()) {
if (!has_totag()) {
if(t_is_branch_route()) {