Regards
Maharaja Azhagiah
Hello,
Using http_async_query can change some script behaviour due to some side effects, I noticed this also e.g. on rtpengine functions.
I did not looked into your cfg in details, but one easy option from your side would be to try a maintained Kamailio version (e.g. 5.7.x) and see if the problem also is observable there.
Cheers,
Henning
From: Maharaja Azhagiah via sr-users <sr-users@lists.kamailio.org>
Sent: Montag, 18. März 2024 22:21
To: Kamailio (SER) - Users Mailing List <sr-users@lists.kamailio.org>
Cc: Maharaja Azhagiah <er.maharaja@gmail.com>
Subject: [SR-Users] http_async_query on carrierfailureroute changes rd back to carrieroute primary
Hi
I am running kamailio 5.4 on debian
I have carrierfailureroute configured incase of primary service provider fails. I also have Stirshaken configured to add Identity header on outbound calls. Issue is when call fail overs to carrierfailureroute, http_async_query changes $ru to the primary carrier
From the debug logs, when primary carrier sends a 488 (primary carrier expects SIP TLS but my call is UDP - to test the failover scenario)
39(285) DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} tmx [t_var.c:561]: pv_get_tm_reply_code(): reply code is <488>
39(285) DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} carrierroute [cr_func.c:178]: set_next_domain_on_rule(): searching for matching routing rules39(285) INFO: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} carrierroute [cr_func.c:197]: set_next_domain_on_rule(): next_domain is 47987
Carrier route rewrites the failover carrier
39(285) INFO: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} carrierroute [cr_func.c:706]: cr_do_route(): uri 14371234567 was rewritten to sip:14371234567@sip.primaryprovider.com, carrier 1, domain 47987
Before http_async_query rd and ru are still the failover carrier
39(285) INFO: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} <script>: [callid: 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn] - [cfg:2976] - Debug testing ----- rd is sip.primaryprovider.com ----- ru is sip:14371234567@sip.primaryprovider.com
39(285) DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} http_async_client [async_http.c:469]: async_send_query(): transaction suspended [5261:1830449764]
39(285) DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} http_async_client [async_http.c:625]: async_push_query(): query sent [https://authn-uat.ccid.neustar.biz/ccid/authn/v2/identity?apiKey=randomkey] (0x7fdcad097e60) to worker 1
However, when the route is being called after the http_async_query it changes to the primary one:
26(272) DEBUG: tm [t_lookup.c:1612]: t_lookup_ident_filter(): transaction found
26(272) DEBUG: http_async_client [async_http.c:235]: async_http_cb(): resuming transaction (5261:1830449764)
26(272) DEBUG: tm [t_lookup.c:1612]: t_lookup_ident_filter(): transaction found
26(272) INFO: <script>: [callid: 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn] - [cfg:2995] - Debug testing ----- rd is 1.2.3.4 ----- ru is sip:14371234567@1.2.3.4:5061;transport=TLS
Due to this, call keeps going to the primary and it fails
if ( http_async_query(STIRSHAKEN_AS_URL, "AS_RESPONSE") == -1 ) {
xlog("L_ERR ", "[cfg:$cfg(line)] Failed to connect AS service for token $fu -> $tu \n");
return;
}
route[AS_RESPONSE] {
xlog("L_INFO", "[callid: $ci] - [cfg:$cfg(line)] - Debug testing ----- rd is $rd ----- ru is $ru\n");
if ($http_ok) {
xlog("L_INFO", "[cfg:$cfg(line)] Resuming outbound call transaction for $fu -> $tu Received - $http_rb \n");
# Add identity and Date headers
if (jansson_get("identity", $http_rb, "$var(identity)")) {
insert_hf("Identity: $var(identity)\n", "Content-Length");
}
if (jansson_get("date", $http_rb, "$var(date)")) {
if ($hdr(Date) != $null){
remove_hf("Date");
}
insert_hf("Date: $var(date)\n", "Identity");
}
} else {
xlog("L_ERR", "[cfg:$cfg(line)] Resuming outbound call transaction. Error - $http_err)\n");
}
route(RELAY);
exit;
}
Please help to understand why rd / ru changes to primary carrier.
Regards,
Maharaja Azhagiah