<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered medium)">
<style><!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:#0563C1;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:#954F72;
        text-decoration:underline;}
span.EstiloCorreo17
        {mso-style-type:personal-compose;
        font-family:"Calibri",sans-serif;
        color:windowtext;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-family:"Calibri",sans-serif;
        mso-fareast-language:EN-US;}
@page WordSection1
        {size:612.0pt 792.0pt;
        margin:70.85pt 3.0cm 70.85pt 3.0cm;}
div.WordSection1
        {page:WordSection1;}
--></style><!--[if gte mso 9]><xml>
<o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
<o:shapelayout v:ext="edit">
<o:idmap v:ext="edit" data="1" />
</o:shapelayout></xml><![endif]-->
</head>
<body lang="ES" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><span lang="EN-GB">I have an IMS core deployed using kamailio 5.0.2. Calls from clients are reaching the core pcscf from a freeswitch (with address A.A.A.A) + a kamailio acting as proxy (with address B.B.B.B), so the INVITE request looks
 like this:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">INVITE sip:1111111111@mnc001.mcc001.3gppnetwork.org SIP/2.0<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Record-Route: <sip:A.A.A.A;lr><o:p></o:p></span></p>
<p class="MsoNormal">Via: SIP/2.0/UDP A.A.A.A;branch=z9hG4bK8735.ef7a61e110f335b2e92a8c1d430de585.0<o:p></o:p></p>
<p class="MsoNormal">Via: SIP/2.0/UDP B.B.B.B:5080;received=B.B.B.B;rport=5080;branch=z9hG4bKHpB704ZaXSKtm<o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB">Max-Forwards: 65<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">From: "222222222" <sip:222222222@B.B.B.B>;tag=eytD49ymQr71S<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">To: <sip:1111111111@mnc001.mcc001.3gppnetwork.org><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Call-ID: 77d249c0-487c-1236-1997-00163edbaa97<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">CSeq: 115249948 INVITE<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Contact: <sip:mod_sofia@B.B.B.B:5080><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">User-Agent: FreeSWITCH-mod_sofia/1.6.19+git~20170927T175834Z~38f568d343~64bit<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Allow: INVITE, ACK, BYE, CANCEL, OPTIONS, MESSAGE, INFO, UPDATE, REGISTER, REFER, NOTIFY<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Supported: timer, path, replaces<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Allow-Events: talk, hold, conference, refer<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Content-Type: application/sdp<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Content-Disposition: session<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Content-Length: 224<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">P-Charge-Info: <sip:222222222@mobile.tuenti.int>;npi=ISDN;noa=4<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">X-FS-Support: update_display,send_info<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Remote-Party-ID: "222222222" <sip:222222222@B.B.B.B>;party=calling;screen=yes;privacy=off<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">If the client cancels the request, the CANCEL request that gets to the core pcscf looks like this:<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal">CANCEL sip:1111111111@mnc001.mcc001.3gppnetwork.org SIP/2.0<o:p></o:p></p>
<p class="MsoNormal">Via: SIP/2.0/UDP A.A.A.A;branch=z9hG4bK8735.ef7a61e110f335b2e92a8c1d430de585.0<o:p></o:p></p>
<p class="MsoNormal"><span lang="EN-GB">Max-Forwards: 65<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">From: "222222222" <sip:222222222@B.B.B.B>;tag=eytD49ymQr71S<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">To: <sip:1111111111@mnc001.mcc001.3gppnetwork.org><o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Call-ID: 77d249c0-487c-1236-1997-00163edbaa97<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">CSeq: 115249948 CANCEL<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Content-Length: 0<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Reason: Q.850;cause=16;text="Normal Call Clearing"<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">The processing of the CANCEL at the pcscf is eventually reaching the t_check_trans() function, but the logs return “no CANCEL matching found!” and thus the processing ends. I have followed the code up to the via_matching
 function in the t_lookup.c file of the tm module source and added some logs. The via matching is failing at the port comparison (the port stored for the INVITE is “5060”, the port stored for the CANCEL is “0”.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">The flow works ok with a different client (connected directly to the core) which includes the port in the Via headers.<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">¿Can this be a bug in kamailio or am I doing something wrong?. AFAIK The RFC 3261 does not mandate to include the ports in the sent-by element of the Via header<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Thanks!<o:p></o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB"><o:p> </o:p></span></p>
<p class="MsoNormal"><span lang="EN-GB">Carlos<o:p></o:p></span></p>
</div>
<br>
<hr>
<font face="Arial" color="Gray" size="1"><br>
Este mensaje y sus adjuntos se dirigen exclusivamente a su destinatario, puede contener información privilegiada o confidencial y es para uso exclusivo de la persona o entidad de destino. Si no es usted. el destinatario indicado, queda notificado de que la
 lectura, utilización, divulgación y/o copia sin autorización puede estar prohibida en virtud de la legislación vigente. Si ha recibido este mensaje por error, le rogamos que nos lo comunique inmediatamente por esta misma vía y proceda a su destrucción.<br>
<br>
The information contained in this transmission is privileged and confidential information intended only for the use of the individual or entity named above. If the reader of this message is not the intended recipient, you are hereby notified that any dissemination,
 distribution or copying of this communication is strictly prohibited. If you have received this transmission in error, do not read it. Please immediately reply to the sender that you have received this communication in error and then delete it.<br>
<br>
Esta mensagem e seus anexos se dirigem exclusivamente ao seu destinatário, pode conter informação privilegiada ou confidencial e é para uso exclusivo da pessoa ou entidade de destino. Se não é vossa senhoria o destinatário indicado, fica notificado de que a
 leitura, utilização, divulgação e/ou cópia sem autorização pode estar proibida em virtude da legislação vigente. Se recebeu esta mensagem por erro, rogamos-lhe que nos o comunique imediatamente por esta mesma via e proceda a sua destruição<br>
</font>
</body>
</html>