Hi<br><br>I have two user clients behind separate NAT networks. My OpenSER is directly connected to the Internet and has it&#39;s own external IP address.<br><br>Both clients are using STUN to get their external IP address and correct port for SIP messages.<br>
<br>They successfully register with Openser, which is using Nathelper module and Mediaproxy.<br><br>In this case, since the client is behind NAT, it puts the wrong port in the Contact field of a SIP message.<br><br>As a result, SOME SIP messages from OpenSER are never received by the client.<br>
<br>But with the help of Nathelper, OpenSER should correct the port in Contact field, by replacing the NAT port with the src port of a SIP message (UDP pack).<br><br>The problem is, that it looks like OpenSER only corrects the port in Contact field for client A (The one who initiates the call) but not Client B(The one who&#39;s called).<br>
<br>For a better explaination, please check out my logs from ngrep.<br><br><br>CLIENT A to OPENSER<br><br>U 2008/05/26 16:53:26.285586 <a href="http://157.157.78.173:54182">157.157.78.173:54182</a> -&gt; <a href="http://212.50.206.33:5060">212.50.206.33:5060</a><br>
INVITE <a href="mailto:sip%3A1001@212.50.206.33">sip:1001@212.50.206.33</a> SIP/2.0.<br>From: 1006&lt;<a href="mailto:sip%3A1006@212.50.206.33">sip:1006@212.50.206.33</a>&gt;;tag=10007500-26260f5b.<br>To: &lt;<a href="mailto:sip%3A1001@212.50.206.33">sip:1001@212.50.206.33</a>&gt;.<br>
Via: SIP/2.0/UDP 157.157.78.173:62356;branch=z9hG4bKc0a8150a10007e0026261023.<br>Contact: 1006&lt;<a href="http://sip:1006@157.157.78.173:62356">sip:1006@157.157.78.173:62356</a>&gt;. !!!NB!!! &lt;-- This is the WRONG reply port.<br>
<br>OPENSER RELAYS TO CLIENT B<br><br>U 2008/05/26 16:53:26.301864 <a href="http://212.50.206.33:5060">212.50.206.33:5060</a> -&gt; <a href="http://130.208.183.251:49211">130.208.183.251:49211</a><br>INVITE <a href="http://sip:1001@130.208.183.251:49208">sip:1001@130.208.183.251:49208</a> SIP/2.0.<br>
Record-Route: &lt;sip:<a href="http://212.50.206.33">212.50.206.33</a>;lr;ftag=10007500-26260f5b;nat=yes&gt;.<br>From: 1006&lt;<a href="mailto:sip%3A1006@212.50.206.33">sip:1006@212.50.206.33</a>&gt;;tag=10007500-26260f5b.<br>
To: &lt;<a href="mailto:sip%3A1001@212.50.206.33">sip:1001@212.50.206.33</a>&gt;.<br>Via: SIP/2.0/UDP <a href="http://212.50.206.33">212.50.206.33</a>;branch=z9hG4bK5db1.ce9aea2.0;rport.<br>Via: SIP/2.0/UDP 157.157.78.173:62356;rport=54182;branch=z9hG4bKc0a8150a10007e0026261023.<br>
Contact: 1006&lt;<a href="http://sip:1006@157.157.78.173:54182">sip:1006@157.157.78.173:54182</a>&gt;. !!!NB!!! &lt;-- OpenSER detects it and changes it to correct reply port. Works great.<br><br>CLIENT B ANSWERS TO OPENSER<br>
<br>U 2008/05/26 16:53:27.301368 <a href="http://130.208.183.251:49211">130.208.183.251:49211</a> -&gt; <a href="http://212.50.206.33:5060">212.50.206.33:5060</a><br>SIP/2.0 200 OK.<br>From: 1006&lt;<a href="mailto:sip%3A1006@212.50.206.33">sip:1006@212.50.206.33</a>&gt;;tag=10007500-26260f5b.<br>
To: &lt;<a href="mailto:sip%3A1001@212.50.206.33">sip:1001@212.50.206.33</a>&gt;;tag=10007900-26261046.<br>Via: SIP/2.0/UDP <a href="http://212.50.206.33">212.50.206.33</a>;branch=z9hG4bK5db1.ce9aea2.0.<br>Via: SIP/2.0/UDP 157.157.78.173:62356;branch=z9hG4bKc0a8150a10007e0026261023.<br>
Contact: 1001&lt;<a href="http://sip:1001@130.208.183.251:49208">sip:1001@130.208.183.251:49208</a>&gt;. !!!NB!!! &lt;-- Now lets try Client B. Wrong reply port.<br><br>OPENSER TO CLIENT A<br><br>U 2008/05/26 16:53:27.305241 <a href="http://212.50.206.33:5060">212.50.206.33:5060</a> -&gt; <a href="http://157.157.78.173:54182">157.157.78.173:54182</a><br>
SIP/2.0 200 OK.<br>From: 1006&lt;<a href="mailto:sip%3A1006@212.50.206.33">sip:1006@212.50.206.33</a>&gt;;tag=10007500-26260f5b.<br>To: &lt;<a href="mailto:sip%3A1001@212.50.206.33">sip:1001@212.50.206.33</a>&gt;;tag=10007900-26261046.<br>
Via: SIP/2.0/UDP 157.157.78.173:62356;branch=z9hG4bKc0a8150a10007e0026261023.<br>Contact: 1001&lt;<a href="http://sip:1001@130.208.183.251:49208">sip:1001@130.208.183.251:49208</a>&gt;. !!!NB!!! &lt;-- OpenSER didn&#39;t change the port like before, so now Client B never receives ACK from Client A.<br>
<br>CLIENT A TO OPENSER<br><br>U 2008/05/26 16:53:27.518621 <a href="http://157.157.78.173:54182">157.157.78.173:54182</a> -&gt; <a href="http://212.50.206.33:5060">212.50.206.33:5060</a><br>ACK <a href="http://sip:1001@130.208.183.251:49208">sip:1001@130.208.183.251:49208</a> SIP/2.0.<br>
From: 1006&lt;<a href="mailto:sip%3A1006@212.50.206.33">sip:1006@212.50.206.33</a>&gt;;tag=10007500-26260f5b.<br>To: &lt;<a href="mailto:sip%3A1001@212.50.206.33">sip:1001@212.50.206.33</a>&gt;;tag=10007900-26261046.<br>Via: SIP/2.0/UDP 157.157.78.173:62356;branch=z9hG4bKc0a8150a10007e0026261505.<br>
Contact: 1006&lt;<a href="http://sip:1006@157.157.78.173:62356">sip:1006@157.157.78.173:62356</a>&gt;.<br>Route: &lt;sip:<a href="http://212.50.206.33">212.50.206.33</a>;lr;ftag=10007500-26260f5b;nat=yes&gt;.<br><br>OPENSER TO CLIENT B<br>
<br>U 2008/05/26 16:53:27.519192 <a href="http://212.50.206.33:5060">212.50.206.33:5060</a> -&gt; <a href="http://130.208.183.251:49208">130.208.183.251:49208</a>&nbsp; !!!NB!!! &lt;-- OpenSER sends to the WRONG port!<br>ACK <a href="http://sip:1001@130.208.183.251:49208">sip:1001@130.208.183.251:49208</a> SIP/2.0.<br>
Record-Route: &lt;sip:<a href="http://212.50.206.33">212.50.206.33</a>;lr;ftag=10007500-26260f5b;nat=yes&gt;.<br>From: 1006&lt;<a href="mailto:sip%3A1006@212.50.206.33">sip:1006@212.50.206.33</a>&gt;;tag=10007500-26260f5b.<br>
To: &lt;<a href="mailto:sip%3A1001@212.50.206.33">sip:1001@212.50.206.33</a>&gt;;tag=10007900-26261046.<br>CSeq: 101 ACK.<br>Via: SIP/2.0/UDP <a href="http://212.50.206.33">212.50.206.33</a>;branch=z9hG4bK5db1.ce9aea2.2;rport.<br>
Via: SIP/2.0/UDP 157.157.78.173:62356;rport=54182;branch=z9hG4bKc0a8150a10007e0026261505.<br><br><br>This last ACK message is never received by Client B because the client isn&#39;t listening on port 49208.<br>If I manually use rewriteport(&quot;49211&quot;) it works, because obviously this last package is then forced to port 49211 which the client listening on.<br>
<br>Also, the first line in my main route is force_rport(); but that still doesn&#39;t do it.<br><br>I&#39;ve been struggling with this problem for a few weeks now so all comments and suggestions are very welcome.<br><br>
My OpenSER config file can be found here: <a href="http://hoski.public.is/openser.cfg">http://hoski.public.is/openser.cfg</a><br><br>Best regards,<br>Höskuldur<br>