Hi,
This is a question for the sake of comprehension, as I actually solved the problem with a workaround.
I am trying to get Kamailio working with a third party SIP provider. The SIP server of this provider pings my Kamailio with OPTIONS messages. Being located in a sub-network, the SIP messages are relayed to a router (not a SIP router, just a gateway to the Internet) which is not listening/sending on port 5060 but on 13377. When Kamailio answer to OPTIONS, it send back the message to the router on the port 5060 which is wrong. Here is the topology:
*Kamailio* *Router* *SIP Server* /my.sip.domain 174.37.217.1 197.17.144.4/ | | ? <-------------------- 5060 | | 5060 <---------------- 13377 | | | 5060 ----------------−> 5060 | | | | X |
You can see that, Kamailio answers to the wrong port, but I think this is somewhat coherent since the SIP message says that the port 5060 is in use. But still, I would have liked that the correct port was used:
*Kamailio* *Router* *SIP Server* /my.sip.domain 174.37.217.1 197.17.144.4 / | | ? <-------------------- 5060 | | 5060 <---------------- 13377 | | | 5060 ---------------−> 13377 | | | | ? --------------------> 5060 |
But I do not understand where Kamailio is supposed to find the correct port. Below are the transport frames, and SIP frames.
Kamailio receives:
Internet Protocol Version 4, Src: 174.37.217.1 (174.37.217.1), Dst: 172.16.8.61 (172.16.8.61) Source: 174.37.217.1 (174.37.217.1) Destination: 172.16.8.61 (172.16.8.61) User Datagram Protocol, Src Port: 13377 (13377), Dst Port: sip (5060) Source port: 13377 (13377) Destination port: sip (5060)
OPTIONS sip:my.sip.domain:5060 SIP/2.0 Via: SIP/2.0/UDP 197.17.144.4:5060;branch=z9hG4bKb9340cb29ba From: sip:197.17.144.4;tag=1797904074 To: sip:my.sip.domain Date: Mon, 10 Aug 2015 10:01:51 GMT Call-ID: c7f38580-5c817680-b94-38512c6@197.17.144.4 User-Agent: Cisco-CUCM10.5 CSeq: 101 OPTIONS Contact: sip:197.17.144.4:5060 Max-Forwards: 0 Content-Length: 0
...and then sends:
Internet Protocol Version 4, Src: 172.16.8.61 (172.16.8.61), Dst: 174.37.217.1 (174.37.217.1) Source: 172.16.8.61 (172.16.8.61) Destination: 174.37.217.1 (174.37.217.1) User Datagram Protocol, Src Port: sip (5060), Dst Port: sip (5060) Source port: sip (5060) Destination port: sip (5060)
SIP/2.0 200 OK Via: SIP/2.0/UDP 197.17.144.4:5060;branch=z9hG4bKb9340cb29ba;received=174.37.217.1 From: sip:197.17.144.4;tag=1797904074 To: sip:my.sip.domain;tag=b27e1a1d33761e85846fc98f5f3a7e58.de7a Call-ID: c7f38580-5c817680-b94-38512c6@197.17.144.4 CSeq: 101 OPTIONS Allow: INVITE,ACK,BYE,CANCEL,INFO,OPTIONS,REFER,SUBSCRIBE,NOTIFY Accept: */* Accept-Encoding: Accept-Language: en Supported: Server: kamailio (4.3.1 (x86_64/linux)) Content-Length: 0
We see clearly that the port is wrong here. But in the received SIP frame, everything suggests that the correct port is 5060, and I do not think Kamailio will look at the transport frame to send the response back to the correct port. Am I correct stating this ? Maybe the Via header should contain a port along with the IP address ?
I solved the problem by using TCP instead of UDP, as I know that since the TCP connection is maintained, the port would be correct (because imposed by the gateway).
I am sorry if the question does not directly relates to Kamailio, but any explanation here would be appreciated, as I am a student trying to learn how all this is working :)
Cheers, Jean-Marie.
On Monday 10 August 2015 14:43:06 Jean-Marie Baran wrote:
We see clearly that the port is wrong here. But in the received SIP frame, everything suggests that the correct port is 5060, and I do not think Kamailio will look at the transport frame to send the response back to the correct port. Am I correct stating this ?
Are you using force_rport()? That should send a reply to the source ip/port of the socket.
Yes, it appears. I defined WITH_NAT, and I can see a clause "#!ifdef WITH_NAT force_rport();", so yes. I have also rtpproxy running with Kamailio, now that I think of it.
On 10/08/2015 14:55, Daniel Tryba wrote:
On Monday 10 August 2015 14:43:06 Jean-Marie Baran wrote:
We see clearly that the port is wrong here. But in the received SIP frame, everything suggests that the correct port is 5060, and I do not think Kamailio will look at the transport frame to send the response back to the correct port. Am I correct stating this ?
Are you using force_rport()? That should send a reply to the source ip/port of the socket.
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users