<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
</head>
<body>
<p>Hi Duarte,</p>
<p>answering about how to debug it further and see if it is caused from Kamailio or outside it.<br>
</p>
<p>As you got an error about a wrong SIP message:</p>
<p>ERROR: <core> [core/parser/parse_addr_spec.c:719]: parse_addr_spec(): unexpected char [<] in status 6: ["+351211455000" <sip:Q4525417L_] .</p>
<p>I would do a trace with ngrep or tcpdump and analyze it with wireshark so see if the message has maybe an error around this part quoted above.</p>
<p>Cheers,</p>
<p>Henning<br>
</p>
<p><br>
</p>
<div class="moz-cite-prefix">Am 04.10.19 um 20:42 schrieb Duarte Rocha:<br>
</div>
<blockquote type="cite" cite="mid:CAAJJHZh8MEMe+QoCQMBHH=bWgWEAb1+R3soXTfoUbaNWXmiGGw@mail.gmail.com">
<div dir="auto">
<div class="gmail_quote" dir="auto">
<div dir="ltr" class="gmail_attr">Greetings,<br>
</div>
<div link="#0563C1" vlink="#954F72" lang="PT">
<div class="m_-356955565038666109WordSection1">
<p class="MsoNormal"> </p>
<p class="MsoNormal">This is a repeated problem, but i have more info now. Please help understand if there is a problem on my code or if there is any kind of Kamailio bug.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">On the first INVITE of every call i apply uac_replace_from() and uac_replace_to() in order to normalize numeration. I have the restore_mode set as "auto".
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">The original numeration is :</p>
<p class="MsoNormal"> To : 351250000000</p>
<p class="MsoNormal"> From : 351211455000</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">The INVITE is sent to the client with To and From like this and with the Record-Route headers (Kamailio has 2 Ips and inserts 2 Record-Routes) containing vsf and vst parameters to help the future restores :
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> To: <<a href="mailto:sip%3A%2B351250000000@111.111.111.111" target="_blank" rel="noreferrer" moz-do-not-send="true">sip:+351250000000@111.111.111.111</a>></p>
<p class="MsoNormal"> From: <<a href="mailto:sip%3A%2B351211455000@111.111.111.111" target="_blank" rel="noreferrer" moz-do-not-send="true">sip:+351211455000@111.111.111.111</a>>;tag=BD583030373631320511EAE6</p>
<p class="MsoNormal"> Record-Route: <sip:111.111.111.111;r2=on;lr;ftag=BD583030373631320511EAE6;tbk_i=2_2_Y;tbk_o=128_11_Y;vsf=AAAAABgGBAMDAAUBBQAJCnNyAwMcHwIdHQsWHwUMOA--;vst=AAAAABgGBAMHDQgJDQECA3RyAwMcHwIdGgQeHAIFOQ--;did=18e.5d62></p>
<p class="MsoNormal"> Record-Route: <sip:111.111.111.111;r2=on;lr;ftag=BD583030373631320511EAE6;tbk_i=2_2_Y;tbk_o=128_11_Y;vsf=AAAAABgGBAMDAAUBBQAJCnNyAwMcHwIdHQsWHwUMOA--;vst=AAAAABgGBAMHDQgJDQECA3RyAwMcHwIdGgQeHAIFOQ--;did=18e.5d62></p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">My client, upon receiving the INVITE, also does some changes in the numeration and sends a 183 reply with the following headers :
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> Record-Route: <sip:111.111.111.111;r2=on;lr;ftag=BD583030373631320511EAE6;tbk_i=2_2_Y;tbk_o=128_11_Y;vsf=AAAAABgGBAMDAAUBBQAJCnNyAwMcHwIdHQsWHwUMOA--;vst=AAAAABgGBAMHDQgJDQECA3RyAwMcHwIdGgQeHAIFOQ--;did=18e.5d62></p>
<p class="MsoNormal"> Record-Route: <sip:111.111.111.111;r2=on;lr;ftag=BD583030373631320511EAE6;tbk_i=2_2_Y;tbk_o=128_11_Y;vsf=AAAAABgGBAMDAAUBBQAJCnNyAwMcHwIdHQsWHwUMOA--;vst=AAAAABgGBAMHDQgJDQECA3RyAwMcHwIdGgQeHAIFOQ--;did=18e.5d62></p>
<p class="MsoNormal"> From: "+351211455000" <<a href="mailto:sip%3AI2116446I_500@111.111.111.111" target="_blank" rel="noreferrer" moz-do-not-send="true">sip:I2116446I_500@111.111.111.111</a>>;tag=BD583030373631320511EAE6</p>
<p class="MsoNormal"> To: <<a href="mailto:sip%3A%2B351250000000@111.111.111.111" target="_blank" rel="noreferrer" moz-do-not-send="true">sip:+351250000000@111.111.111.111</a>>;tag=as3e46f684</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> After Kamailio processes the reply, To and From are restored to it's original values and the reply is relayed :
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> From: <<a href="mailto:sip%3A351211455000@111.111.111.111" target="_blank" rel="noreferrer" moz-do-not-send="true">sip:351211455000@111.111.111.111</a>>;tag=BD583030373631320511EAE6</p>
<p class="MsoNormal"> To: <<a href="mailto:sip%3A351250000000@111.111.111.111" target="_blank" rel="noreferrer" moz-do-not-send="true">sip:351250000000@111.111.111.111</a>>;tag=as3e46f684</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> Here, the restore works perfectly.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">By the end of the call the client sends me a BYE request with Route, From and To like this :
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> Route: <sip:111.111.111.111;r2=on;lr;ftag=BD583030373631320511EAE6;tbk_i=2_2_Y;tbk_o=128_11_Y;vsf=AAAAABgGBAMDAAUBBQAJCnNyAwMcHwIdHQsWHwUMOA--;vst=AAAAABgGBAMHDQgJDQECA3RyAwMcHwIdGgQeHAIFOQ--;did=18e.5d62>,<sip:212.13.40.205;r2=on;lr;ftag=BD583030373631320511EAE6;tbk_i=2_2_Y;tbk_o=128_11_Y;vsf=AAAAABgGBAMDAAUBBQAJCnNyAwMcHwIdHQsWHwUMOA--;vst=AAAAABgGBAMHDQgJDQECA3RyAwMcHwIdGgQeHAIFOQ--;did=18e.5d62></p>
<p class="MsoNormal"> From: <<a href="mailto:sip%3A%2B351250000000@111.111.111.111" target="_blank" rel="noreferrer" moz-do-not-send="true">sip:+351250000000@111.111.111.111</a>>;tag=as3e46f684</p>
<p class="MsoNormal"> To: "+351211455000" <<a href="mailto:sip%3AI2116446I_500@111.111.111.111" target="_blank" rel="noreferrer" moz-do-not-send="true">sip:I2116446I_500@111.111.111.111</a>>;tag=BD583030373631320511EAE6</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> Here, the difference between 183 and BYE seems to be only in the Route\Record-Route are built (2 Headers or one header with 2 uri).</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> Now, there are a couple of problems relaying the BYE that seem to me to be related to auto replace.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> This BYE message isn't logged on the onsend-route and it logs a couple of errors :
</p>
<p class="MsoNormal"> ERROR: <core> [core/parser/msg_parser.c:164]: get_hdr_field(): bad to header</p>
<p class="MsoNormal"> ERROR: <core> [core/parser/msg_parser.c:337]: parse_headers(): bad header field [To: "+351211455000" <sip:Q4525417L_<:C212.13.38.148>;tag=3DC130303736313205201F18#015#012Call-ID: 020FAAC7]</p>
<p class="MsoNormal"> ERROR: dialog [dlg_handlers.c:666]: pre_match_parse(): bad request or missing CALLID/TO hdr :-/</p>
<p class="MsoNormal"> ERROR: <core> [core/parser/parse_addr_spec.c:719]: parse_addr_spec(): unexpected char [<] in status 6: ["+351211455000" <sip:Q4525417L_] .</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> Despite not being logged on onsend_route and creating some errors, the BYE is still relayed like this :
</p>
<p class="MsoNormal"> From: <<a href="mailto:sip%3A351250000000@111.111.111.111" target="_blank" rel="noreferrer" moz-do-not-send="true">sip:351250000000@111.111.111.111</a>>;tag=as3e46f684</p>
<p class="MsoNormal"> To: "+351211455000" <sip:Q4525417L_<:C111.111.111.111>;tag=BD583030373631320511EAE6</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> This, naturally, generates a "400 Bad Request" reply from the next equipment.</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> I've also logged the $tU values along the code for BYE requests and it always logs the "I2116446I_500", so i don't know if my code can be the cause of this.
</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal">A couple of questions and comments </p>
<p class="MsoNormal"> - What can i do to better debug this issue? I want to be sure if the problem comes from my code of if it is a Kamailio issue. Right now i'm not sure where to look.</p>
<p class="MsoNormal"> - Can a request be sent without passing on onsend_route ? I have used this code to "catch" the BYE, which works for other BYEs - if( $rm == "BYE") {xerr("On send : To User = $tU");}</p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"> </p>
<p class="MsoNormal"><span> </span></p>
<p class="MsoNormal"> </p>
</div>
</div>
</div>
</div>
<br>
<fieldset class="mimeAttachmentHeader"></fieldset>
<pre class="moz-quote-pre" wrap="">_______________________________________________
Kamailio (SER) - Users Mailing List
<a class="moz-txt-link-abbreviated" href="mailto:sr-users@lists.kamailio.org">sr-users@lists.kamailio.org</a>
<a class="moz-txt-link-freetext" href="https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users">https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users</a>
</pre>
</blockquote>
<pre class="moz-signature" cols="72">--
Kamailio Merchandising - <a class="moz-txt-link-freetext" href="https://skalatan.de/merchandising/">https://skalatan.de/merchandising/</a>
Kamailio services - <a class="moz-txt-link-freetext" href="https://skalatan.de/services">https://skalatan.de/services</a>
Henning Westerholt - <a class="moz-txt-link-freetext" href="https://skalatan.de/blog/">https://skalatan.de/blog/</a></pre>
</body>
</html>