[prev in list] [next in list] [prev in thread] [next in thread] 

List:       serusers
Subject:    [SR-Users] http_async_query on carrierfailureroute changes rd back to carrieroute primary
From:       Maharaja Azhagiah via sr-users <sr-users () lists ! kamailio ! org>
Date:       2024-03-18 21:21:06
Message-ID: CAHkGiEeBn42RgrRZvb4AyqXF=V-e07YA32zgEB0_XhmWjUvz=A () mail ! gmail ! com
[Download RAW message or body]

[Attachment #2 (multipart/alternative)]


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

[Attachment #5 (text/html)]

<div dir="ltr"><div class="gmail_default" \
style="font-family:tahoma,sans-serif;color:#073763">Hi  </div><div \
class="gmail_default" \
style="font-family:tahoma,sans-serif;color:#073763"><br></div><div \
class="gmail_default" style="font-family:tahoma,sans-serif;color:#073763">I am \
running kamailio 5.4 on debian  </div><div class="gmail_default" \
style="font-family:tahoma,sans-serif;color:#073763"><br>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<br><br>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)  <br><br>39(285) DEBUG: {1 18398 \
INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} tmx [t_var.c:561]: pv_get_tm_reply_code(): \
reply code is &lt;488&gt;<br>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<br><br>Carrier route rewrites the \
failover carrier<br><br>39(285) INFO: {1 18398 INVITE \
8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} carrierroute [cr_func.c:706]: cr_do_route(): uri \
14371234567 was rewritten to <a \
href="mailto:sip%3A14371234567@sip.primaryprovider.com">sip:14371234567@sip.primaryprovider.com</a>, \
carrier 1, domain 47987<br><br>Before http_async_query rd and ru are still the \
failover carrier<br><br>39(285) INFO: {1 18398 INVITE \
8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} &lt;script&gt;: [callid: \
8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn] - [cfg:2976] - Debug testing ----- rd is <a \
href="http://sip.primaryprovider.com">sip.primaryprovider.com</a> ----- ru is <a \
href="mailto:sip%3A14371234567@sip.primaryprovider.com">sip:14371234567@sip.primaryprovider.com</a><br>39(285) \
DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} http_async_client \
[async_http.c:469]: async_send_query(): transaction suspended \
[5261:1830449764]<br>39(285) DEBUG: {1 18398 INVITE 8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn} \
http_async_client [async_http.c:625]: async_push_query(): query sent [<a \
href="https://authn-uat.ccid.neustar.biz/ccid/authn/v2/identity?apiKey=randomkey">https://authn-uat.ccid.neustar.biz/ccid/authn/v2/identity?apiKey=randomkey</a>] \
(0x7fdcad097e60) to worker 1<br><br>However, when the route is being called after the \
http_async_query it changes to the primary one:<br><br>26(272) DEBUG: tm \
[t_lookup.c:1612]: t_lookup_ident_filter(): transaction found<br>26(272) DEBUG: \
http_async_client [async_http.c:235]: async_http_cb(): resuming transaction \
(5261:1830449764)<br>26(272) DEBUG: tm [t_lookup.c:1612]: t_lookup_ident_filter(): \
transaction found<br>26(272) INFO: &lt;script&gt;: [callid: \
8EmmsLqNuMRYBduMqFgX3w4JHAn4C2xn] - [cfg:2995] - Debug testing ----- rd is 1.2.3.4 \
----- ru is sip:14371234567@1.2.3.4:5061;transport=TLS<br><br>Due to this, call keeps \
going to the primary and it fails<br><br>if ( http_async_query(STIRSHAKEN_AS_URL, \
&quot;AS_RESPONSE&quot;) == -1 ) {<br>				xlog(&quot;L_ERR &quot;, \
&quot;[cfg:$cfg(line)] Failed to connect AS service for token $fu -&gt; $tu \
\n&quot;);<br>				return;<br>			}<br><br>route[AS_RESPONSE] \
{<br>	xlog(&quot;L_INFO&quot;, &quot;[callid: $ci] - [cfg:$cfg(line)] - Debug testing \
----- rd is $rd ----- ru is $ru\n&quot;);<br>	if ($http_ok) \
{<br>		xlog(&quot;L_INFO&quot;, &quot;[cfg:$cfg(line)] Resuming outbound call \
transaction for $fu -&gt; $tu Received - $http_rb \n&quot;);<br>		# Add identity and \
Date headers<br>		if (jansson_get(&quot;identity&quot;, $http_rb, \
&quot;$var(identity)&quot;)) {<br>			insert_hf(&quot;Identity: \
$var(identity)\n&quot;, &quot;Content-Length&quot;);<br>		}<br>		if \
(jansson_get(&quot;date&quot;, $http_rb, &quot;$var(date)&quot;)) {<br>			if \
($hdr(Date) != $null){<br>				remove_hf(&quot;Date&quot;);<br>			}<br>			insert_hf(&quot;Date: \
$var(date)\n&quot;, &quot;Identity&quot;);<br>		}<br>	} else \
{<br>		xlog(&quot;L_ERR&quot;, &quot;[cfg:$cfg(line)] Resuming outbound call \
transaction. Error -   $http_err)\n&quot;);<br>	}<br><br>      \
route(RELAY);<br>	exit;<br>}<br><br>Please help to understand why rd / ru changes to \
primary carrier.</div><div class="gmail_default" \
style="font-family:tahoma,sans-serif;color:#073763"><br></div><div \
class="gmail_default" \
style="font-family:tahoma,sans-serif;color:#073763">Regards,</div><div \
class="gmail_default" style="font-family:tahoma,sans-serif;color:#073763">Maharaja \
Azhagiah<br><br></div></div>



__________________________________________________________
Kamailio - Users Mailing List - Non Commercial Discussions
To unsubscribe send an email to sr-users-leave@lists.kamailio.org
Important: keep the mailing list in the recipients, do not reply only to the sender!
Edit mailing list options or unsubscribe:


[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic