[SR-Users] How to determine correct port to set in record-route header

Pranathi Venkatayogi pvenkatayogi at cyracom.com
Mon Jan 23 23:34:57 CET 2017


Hi,
  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.
  However now I am having trouble choosing the right port number in all scenarios.

        $var(dstPort) = 5061;
        if (dst_port==5060)
        {
           $var(dstPort) = 5060;
        }
        insert_hf("Record-Route: <sip:MY_PUBLICIP_ADDR:$var(dstPort);transport=tls;lr;nat=yes>\r\n", "Record-Route");

   In one scenario I see the conflicting port numbers in “via” header vs “Record route”.
   The ACK is being set to port 5060 based on Record route header and is not being received by the callee.

2017-01-23 14:52:49.970233 [blink.exe 2780]: SENDING: Packet 11, +0:00:36.411867
10.0.27.108:58217 -(SIP over TLS)-> 172.31.211.31:5061
SIP/2.0 180 Ringing
Via: SIP/2.0/TLS 63.149.103.72:5061;received=172.31.211.31;branch=z9hG4bK4799.7067bd2a48063748a4c353fa408eaefa.0
Via: SIP/2.0/UDP 10.0.16.52;rport=5060;branch=z9hG4bK4799.935a27c6ef5ad112225964cbe7c1be44.0;i=2
Via: SIP/2.0/TLS 10.11.200.12:51793;rport=51793;received=10.11.200.12;branch=z9hG4bKPj49f6aeca3f9b4155ab4c5304b544aa4d;alias
Record-Route: <sip:63.149.103.72:5060;transport=tls;lr;nat=yes>
Record-Route: <sip:10.0.16.52:5061;transport=tls;lr;nat=yes>
Call-ID: 09ce10efa6a946bf9445ccc21857393e
From: "cust1" <sip:cust1 at devtranslation.sms-test.cyracom.com>;tag=95082caabecc42548c2fec5ccd29e5de
To: <sip:spanish at translation.sms-test.cyracom.com>;tag=ec365cc8489b48a7bc5725d21b7d97a1
CSeq: 17422 INVITE
Server: Blink 3.0.0 (Windows)
Contact: <sip:20745891 at 10.0.27.108:58216;transport=tls>
Allow: SUBSCRIBE, NOTIFY, PRACK, INVITE, ACK, BYE, CANCEL, UPDATE, MESSAGE, REFER
Content-Length:  0

Questions:
1. How can I let in-built record-route function automatically choose “public ip” so I can get rid of my manual insertion altogether.
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”.
3. Any other pointers to improve the logic here?

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20170123/8eb8aa5b/attachment.html>


More information about the sr-users mailing list