<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;}
@font-face
        {font-family:Verdana;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:11.0pt;
        font-family:"Calibri",sans-serif;}
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;}
p
        {mso-style-priority:99;
        mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman",serif;}
span.EmailStyle17
        {mso-style-type:personal;
        font-family:"Verdana",sans-serif;
        color:windowtext;}
span.EmailStyle19
        {mso-style-type:personal-reply;
        font-family:"Calibri",sans-serif;
        color:windowtext;
        font-weight:normal;
        font-style:normal;}
.MsoChpDefault
        {mso-style-type:export-only;
        font-size:10.0pt;}
@page WordSection1
        {size:8.5in 11.0in;
        margin:70.85pt 70.85pt 70.85pt 70.85pt;}
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="EN-US" link="#0563C1" vlink="#954F72">
<div class="WordSection1">
<p class="MsoNormal">Hi,<o:p></o:p></p>
<p class="MsoNormal">  I am using Kamailio behind NAT, unable to figure how to make it put “public ip” in Record-route header, I am manually inserting the hard-coded header myself as below.<o:p></o:p></p>
<p class="MsoNormal">  However now I am having trouble choosing the right port number in all scenarios.
<o:p></o:p></p>
<p class="MsoNormal">  <o:p></o:p></p>
<p class="MsoNormal"><i>        $var(dstPort) = 5061;<br>
        if (dst_port==5060)<br>
        {<br>
           $var(dstPort) = 5060;<br>
        }<br>
        insert_hf("Record-Route: <sip:MY_PUBLICIP_ADDR:$var(dstPort);transport=tls;lr;nat=yes>\r\n", "Record-Route"); <o:p></o:p></i></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal">   In one scenario I see the conflicting port numbers in “via” header vs “Record route”.
<o:p></o:p></p>
<p class="MsoNormal">   The ACK is being set to port 5060 based on Record route header and is not being received by the callee.<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
<p class="MsoNormal"><i>2017-01-23 14:52:49.970233 [blink.exe 2780]: SENDING: Packet 11, +0:00:36.411867<o:p></o:p></i></p>
<p class="MsoNormal"><i>10.0.27.108:58217 -(SIP over TLS)-> 172.31.211.31:5061<o:p></o:p></i></p>
<p class="MsoNormal"><i>SIP/2.0 180 Ringing<o:p></o:p></i></p>
<p class="MsoNormal"><i>Via: <span style="background:yellow;mso-highlight:yellow">
SIP/2.0/TLS 63.149.103.72:5061</span>;received=172.31.211.31;branch=z9hG4bK4799.7067bd2a48063748a4c353fa408eaefa.0<o:p></o:p></i></p>
<p class="MsoNormal"><i>Via: SIP/2.0/UDP 10.0.16.52;rport=5060;branch=z9hG4bK4799.935a27c6ef5ad112225964cbe7c1be44.0;i=2<o:p></o:p></i></p>
<p class="MsoNormal"><i>Via: SIP/2.0/TLS 10.11.200.12:51793;rport=51793;received=10.11.200.12;branch=z9hG4bKPj49f6aeca3f9b4155ab4c5304b544aa4d;alias<o:p></o:p></i></p>
<p class="MsoNormal"><i>Record-Route: <<span style="background:yellow;mso-highlight:yellow">sip:63.149.103.72:5060</span>;transport=tls;lr;nat=yes><o:p></o:p></i></p>
<p class="MsoNormal"><i>Record-Route: <sip:10.0.16.52:5061;transport=tls;lr;nat=yes><o:p></o:p></i></p>
<p class="MsoNormal"><i>Call-ID: 09ce10efa6a946bf9445ccc21857393e<o:p></o:p></i></p>
<p class="MsoNormal"><i>From: "cust1" <sip:cust1@devtranslation.sms-test.cyracom.com>;tag=95082caabecc42548c2fec5ccd29e5de<o:p></o:p></i></p>
<p class="MsoNormal"><i>To: <sip:spanish@translation.sms-test.cyracom.com>;tag=ec365cc8489b48a7bc5725d21b7d97a1<o:p></o:p></i></p>
<p class="MsoNormal"><i>CSeq: 17422 INVITE<o:p></o:p></i></p>
<p class="MsoNormal"><i>Server: Blink 3.0.0 (Windows)<o:p></o:p></i></p>
<p class="MsoNormal"><i>Contact: <sip:20745891@10.0.27.108:58216;transport=tls><o:p></o:p></i></p>
<p class="MsoNormal"><i>Allow: SUBSCRIBE, NOTIFY, PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE, REFER<o:p></o:p></i></p>
<p class="MsoNormal"><i>Content-Length:  0</i><br>
<br>
<o:p></o:p></p>
<p class="MsoNormal"><b>Questions: <o:p></o:p></b></p>
<p class="MsoNormal">1. How can I let in-built record-route function automatically choose “public ip” so I can get rid of my manual insertion altogether.<o:p></o:p></p>
<p class="MsoNormal">2. If no option, what is the right way to choose the port on which packet is being received, so it is same as what is on “VIA”.<o:p></o:p></p>
<p class="MsoNormal">3. Any other pointers to improve the logic here?<o:p></o:p></p>
<p class="MsoNormal"><o:p> </o:p></p>
</div>
</body>
</html>