Hi,<br><br>You get this behavior because of the way of the way top_hiding is implemented.<br>The IP:PORT with which the contact is replaced corresponds to the interface on which the message was received. It seems that in your case the message is actually received on the private interface, so it will use that IP as the local contact.<br>

<br>So the top_hiding implementation has a limitation and won&#39;t work in your case. The way to extend it is to offer the possibility to set the contact to be used for replacing in an avp before calling the top_hiding function and if set, the function will use that value instead of looking at the interface on which the message was received. You could open a feature request for this on sourceforge.<br>

<br>Regards,<br>Anca<br><br><br><br><br><br><br><br><div class="gmail_quote">On Tue, Jan 24, 2012 at 3:24 AM,  <span dir="ltr">&lt;<a href="mailto:discodog62@aol.com">discodog62@aol.com</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0pt 0pt 0pt 0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">

<font color="black" face="arial"><font style="font-size:10pt" face="Arial, Helvetica, sans-serif">I am hoping someone can point me in the right direction.  I am using opensips 1.7.  </font>
<div style="font-size:10pt"><font face="Arial, Helvetica, sans-serif"><br>
</font></div>

<div><font face="Arial, Helvetica, sans-serif">I have 2 networks using mhomed=1.  When I invoke topology_hiding() using the dialog module the header contact uses the internal IP to the external side of the call.</font></div>



<div><font face="Arial, Helvetica, sans-serif"><br>
</font></div>

<div><font face="Arial, Helvetica, sans-serif">Here is my config.  Am I missing something?</font></div>

<div><font face="Arial, Helvetica, sans-serif"><br>
</font></div>

<div><font face="Arial, Helvetica, sans-serif">
<div>debug=3</div>

<div>log_stderror=no</div>

<div>log_facility=LOG_LOCAL0</div>

<div><br>
</div>

<div>fork=yes</div>

<div>children=4</div>

<div>disable_tcp=yes</div>

<div>auto_aliases=yes</div>

<div>sip_warning=yes</div>

<div><br>
</div>

<div>listen=udp:xxx.xxx.xxx.xxx:5060</div>

<div>listen=udp:<a href="http://10.8.1.139:5060" target="_blank">10.8.1.139:5060</a></div>

<div><br>
</div>

<div><br>
</div>

<div>mhomed=1</div>

<div><br>
</div>

<div>group=nobody</div>

<div>user=nobody</div>

<div><br>
</div>

<div>####### Modules Section ########</div>

<div><br>
</div>

<div>#set module path</div>

<div>mpath=&quot;/usr/local/lib64/opensips/modules/&quot;</div>

<div><br>
</div>

<div>/* uncomment next line for MySQL DB support */</div>

<div>loadmodule &quot;db_text.so&quot;</div>

<div>loadmodule &quot;signaling.so&quot;</div>

<div>loadmodule &quot;sl.so&quot;</div>

<div>loadmodule &quot;tm.so&quot;</div>

<div>loadmodule &quot;rr.so&quot;</div>

<div>loadmodule &quot;maxfwd.so&quot;</div>

<div>loadmodule &quot;textops.so&quot;</div>

<div>loadmodule &quot;mi_fifo.so&quot;</div>

<div>loadmodule &quot;uri.so&quot;</div>

<div>loadmodule &quot;domain.so&quot;</div>

<div>loadmodule &quot;permissions.so&quot;</div>

<div>loadmodule &quot;dialog.so&quot;</div>

<div>loadmodule &quot;rtpproxy.so&quot;</div>

<div><br>
</div>

<div>modparam(&quot;mi_fifo&quot;, &quot;fifo_name&quot;, &quot;/tmp/opensips_fifo&quot;)</div>

<div>modparam(&quot;rr&quot;, &quot;append_fromtag&quot;, 0)</div>

<div>modparam(&quot;uri&quot;, &quot;use_uri_table&quot;, 0)</div>

<div>modparam(&quot;domain&quot;, &quot;db_url&quot;,&quot;text:///zxa/server/opensipsdb&quot;)</div>

<div>modparam(&quot;domain&quot;, &quot;db_mode&quot;, 1)   # Use caching</div>

<div>modparam(&quot;dialog&quot;, &quot;db_mode&quot;, 1)   # Realtime</div>

<div>modparam(&quot;dialog&quot;, &quot;db_url&quot;,&quot;text:///zxa/server/opensipsdb&quot;)</div>

<div>modparam(&quot;permissions&quot;, &quot;db_url&quot;,&quot;text:///zxa/server/opensipsdb&quot;)</div>

<div>modparam(&quot;rtpproxy&quot;,&quot;rtpproxy_sock&quot;, &quot;udp:<a href="http://127.0.0.1:7891" target="_blank">127.0.0.1:7891</a>&quot;)</div>

<div><br>
</div>

<div>####### Routing Logic ########</div>

<div><br>
</div>

<div>route{</div>

<div><br>
</div>

<div><span style="white-space:pre-wrap">        </span>xlog(&quot;=== TOP ===&quot;);</div>

<div>    xlog(&quot;%%%% tu= $tu | fu= $fu | od= $od | ReceivedINT: $Ri | SourceIP: $si %%%&quot;);</div>

<div><span style="white-space:pre-wrap">        </span> </div>

<div>    if (!check_address(&quot;1&quot;,&quot;$si&quot;,&quot;$sp&quot;,&quot;$proto&quot;))</div>

<div>    {</div>

<div><span style="white-space:pre-wrap">                </span>xlog(&quot;=== ACCESS FAILED ===&quot;);</div>

<div><span style="white-space:pre-wrap">                </span>xlog(&quot;=== $si| $sp | $proto ===&quot;);</div>

<div>        sl_send_reply(&quot;403&quot;,&quot;Forbidden&quot;);</div>

<div>        exit;        </div>

<div>    }</div>

<div><br>
</div>

<div>    if (!mf_process_maxfwd_header(&quot;10&quot;))</div>

<div>    {</div>

<div><span style="white-space:pre-wrap">        </span>    xlog(&quot;=== TOO MANY HOPS ===&quot;);</div>

<div>        sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);</div>

<div>        exit;</div>

<div>    }</div>

<div><span style="white-space:pre-wrap">        </span></div>

<div><span style="white-space:pre-wrap">        </span>#CANCEL processing</div>

<div>    if (is_method(&quot;CANCEL&quot;))</div>

<div>    {</div>

<div><span style="white-space:pre-wrap">        </span>    xlog(&quot;=== CANCEL ===&quot;);</div>

<div>        if (t_check_trans())</div>

<div>            t_relay();</div>

<div>        exit;</div>

<div>    }</div>

<div><span style="white-space:pre-wrap">        </span></div>

<div><span style="white-space:pre-wrap">        </span>if (is_method(&quot;PUBLISH&quot;))</div>

<div>    {</div>

<div>        sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);</div>

<div>        exit;</div>

<div>    }</div>

<div><br>
</div>

<div>       </div>

<div>if (has_totag())</div>

<div>    {</div>

<div>        xlog(&quot;=== HAS TO TAG ===&quot;);</div>

<div><br>
</div>

<div>        if(match_dialog()) &amp;&amp; is_method(&quot;INVITE|ACK|BYE|UPDATE&quot;) #Topology Hide Routine</div>

<div>        {</div>

<div>            xlog(&quot;=== HAS DIALOG MATCH ===&quot;);</div>

<div>                       </div>

<div>            if (is_method(&quot;BYE&quot;))</div>

<div>            {</div>

<div>                xlog(&quot;=== DIALOG MATCH BYE ===&quot;);</div>

<div>                setflag(1); # Accounting bye</div>

<div>                </div>

<div>            } else if (is_method(&quot;INVITE&quot;)) {</div>

<div>                </div>

<div>                xlog(&quot;=== DIALOG MATCH RE-INVITE LOOSE ===&quot;);</div>

<div>                             </div>

<div>                record_route();</div>

<div>                </div>

<div>            } else if (is_method(&quot;ACK&quot;)) {</div>

<div>            </div>

<div>                xlog(&quot;=== DIALOG MATCH ACK ===&quot;);</div>

<div>            }</div>

<div>            </div>

<div>            xlog(&quot; in-dialog topology hiding request - $DLG_dir\n&quot;);</div>

<div><br>
</div>

<div>            route(1);</div>

<div>            exit;</div>

<div>        }</div>

<div>        </div>

<div>    }</div>

<div><br>
</div>

<div><br>
</div>

<div>    t_check_trans();</div>

<div><br>
</div>

<div><span style="white-space:pre-wrap">        </span>if (loose_route()) </div>

<div>    {</div>

<div>        xlog(&quot;L_ERR&quot;,&quot;Attempt to route with preloaded Route&#39;s [$fu/$tu/$ru/$ci]&quot;);</div>

<div>        if (!is_method(&quot;ACK&quot;))</div>

<div>        {</div>

<div>            sl_send_reply(&quot;403&quot;,&quot;Preload Route denied&quot;);</div>

<div>             exit;</div>

<div>        }</div>

<div>    }</div>

<div><br>
</div>

<div>    # record routing</div>

<div>    if (!is_method(&quot;REGISTER|MESSAGE&quot;))</div>

<div><span style="white-space:pre-wrap">        </span>{</div>

<div>        record_route();</div>

<div>    }</div>

<div><br>
</div>

<div><br>
</div>

<div>    </div>

<div>    if (!is_uri_host_local())</div>

<div>    {</div>

<div>        xlog(&quot;Not local so lets just see what happens $rd&quot;);</div>

<div>        route(1);</div>

<div>    }</div>

<div><br>
</div>

<div>    if ($rU==NULL)</div>

<div>    {</div>

<div>        # request with no Username in RURI</div>

<div>        sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);</div>

<div>        exit;</div>

<div>    }</div>

<div>    <span style="white-space:pre-wrap">        </span></div>

<div>    if (is_method(&quot;INVITE&quot;) &amp;&amp; (!has_totag()) )</div>

<div>    {   </div>

<div>        xlog(&quot;(((((((((   NEW CALL   ))))))))))&quot;);</div>

<div>        rewritehostport(&quot;<a href="http://10.6.3.87:5068" target="_blank">10.6.3.87:5068</a>&quot;);</div>

<div>        topology_hiding();</div>

<div>        route(1);</div>

<div>        exit;</div>

<div>    }</div>

<div>    </div>

<div>    </div>

<div><br>
</div>

<div>    send_reply(&quot;420&quot;, &quot;Invalid Extension&quot;);</div>

<div>    exit;</div>

<div>}</div>

<div><br>
</div>

<div><br>
</div>

<div>route[1] {</div>

<div>    </div>

<div>    #---- RTP Proxy handling ---#</div>

<div>    xlog(&quot;=== ROUTE 1 ===&quot;);</div>

<div>    </div>

<div>    if (is_method(&quot;BYE|CANCEL&quot;))</div>

<div>    {</div>

<div>        unforce_rtp_proxy();</div>

<div>    }</div>

<div>   </div>

<div>    if (has_body(&quot;application/sdp&quot;)) </div>

<div>    {</div>

<div>    <span style="white-space:pre-wrap">        </span>append_hf(&quot;P-hint: IE \r\n&quot;);</div>

<div>        rtpproxy_offer(&quot;IE&quot;,&quot;10.8.1.139&quot;);</div>

<div><span style="white-space:pre-wrap">        </span>}</div>

<div><br>
</div>

<div><br>
</div>

<div>    </div>

<div>    t_on_reply(&quot;1&quot;);</div>

<div>    t_on_failure(&quot;1&quot;);</div>

<div><br>
</div>

<div>    if (!t_relay())</div>

<div>    {</div>

<div>        sl_reply_error();</div>

<div>    }</div>

<div>    </div>

<div>    exit;</div>

<div>    </div>

<div>}</div>

<div><br>
</div>

<div><br>
</div>

<div>onreply_route[1] {</div>

<div>    </div>

<div>    xlog(&quot;=== ON REPLY ROUTE 2  rs= $rs | fu= $fu | od= $od | si= $si | Ri= $Ri ===&quot;);</div>

<div>    </div>

<div>    if ( status=~&quot;(183)|(2[0-9][0-9])&quot; )</div>

<div>    {</div>

<div>        if ($Ri == &quot;10.8.1.139&quot;)</div>

<div>        {</div>

<div>            append_hf(&quot;P-hint: RR EI \r\n&quot;);</div>

<div>            rtpproxy_answer(&quot;EI&quot;,&quot;xxx.xxx.xxx.xxx&quot;);<span style="white-space:pre-wrap">        </span></div>

<div><span style="white-space:pre-wrap">                </span>} else {</div>

<div>            append_hf(&quot;P-hint: RR IE \r\n&quot;);</div>

<div><span style="white-space:pre-wrap">                </span>    rtpproxy_answer(&quot;IE&quot;,&quot;10.8.1.139&quot;);</div>

<div>            </div>

<div>        }            </div>

<div>    }</div>

<div>   </div>

<div>}</div>

<div><br>
</div>

<div><br>
</div>

<div>failure_route[1] {</div>

<div><span style="white-space:pre-wrap">        </span>xlog(&quot;=== FAIL ROUTE 2 ===&quot;);  </div>

<div>  </div>

<div><span style="white-space:pre-wrap">        </span>unforce_rtp_proxy();  </div>

<div>    </div>

<div><span style="white-space:pre-wrap">        </span>if (t_was_cancelled())</div>

<div>    {</div>

<div>        exit;</div>

<div>    }</div>

<div><br>
</div>

<div>}</div>

<div><br>
</div>

<div><br>
</div>

<div><br>
</div>

<div>Here is the Sip traces from the external call.</div>

<div>xxx.xxx.xxx.xxx is my opensips server</div>

<div>A.B.C.D is the the external call.</div>

<div>10.8.1.139 is my internal IP for opensips.  On the 180 ringing you can see that the contact is set to 10.8.1.139.  It should be xxx.xxx.xxx.xxx</div>

<div><br>
</div>

<div><br>
</div>

<div><br>
</div>

<div>
<div>INVITE sip:<a href="tel:18584278618" value="+18584278618" target="_blank">18584278618</a>@xxx.xxx.xxx.xxx SIP/2.0</div>

<div>Via: SIP/2.0/UDP A.B.C.D:5068;branch=z9hG4bK1A55</div>

<div>From: IPFax &lt;sip:<a href="tel:8583234002" value="+18583234002" target="_blank">8583234002</a>@A.B.C.D&gt;;tag=IPF_PORT_0001_1A54</div>

<div>To: &lt;sip:<a href="tel:18584278618" value="+18584278618" target="_blank">18584278618</a>@xxx.xxx.xxx.xxx&gt;</div>

<div>Call-ID: 1211a713-96b4-49e0-affb-6c56b73ae54c@A.B.C.D</div>

<div>CSeq: 1 INVITE</div>

<div>Max-Forwards: 70</div>

<div>Contact: &lt;sip:<a href="tel:8583234002" value="+18583234002" target="_blank">8583234002</a>@A.B.C.D:5068&gt;</div>

<div>User-Agent: VFAXSUA/IP_FAX-9.0.5782.743</div>

<div>Allow: INVITE, ACK, BYE, CANCEL, REFER, NOTIFY</div>

<div>Content-Type: application/sdp</div>

<div>Content-Length: 166</div>

<div><br>
</div>

<div>v=0</div>

<div>o=IPFax 0 0 IN IP4 A.B.C.D</div>

<div>s=SIP Fax Call</div>

<div>i=IPFax</div>

<div>c=IN IP4 A.B.C.D</div>

<div>t=0 0</div>

<div>m=audio 49176 RTP/AVP 0</div>

<div>a=rtpmap:0 PCMU/8000</div>

<div>a=ptime:20</div>

<div>a=sendrecv</div>

<div><br>
</div>

<div>--------------------------------------------------------------------------</div>

<div>SIP/2.0 180 Ringing</div>

<div>Via: SIP/2.0/UDP A.B.C.D:5068;branch=z9hG4bK1A55</div>

<div>From: IPFax &lt;sip:<a href="tel:8583234002" value="+18583234002" target="_blank">8583234002</a>@A.B.C.D&gt;;tag=IPF_PORT_0001_1A54</div>

<div>To: &lt;sip:<a href="tel:18584278618" value="+18584278618" target="_blank">18584278618</a>@xxx.xxx.xxx.xxx&gt;;tag=IPF_PORT_0005_1044</div>

<div>Call-ID: 1211a713-96b4-49e0-affb-6c56b73ae54c@A.B.C.D</div>

<div>CSeq: 1 INVITE</div>

<div>Contact: &lt;sip:10.8.1.139:5060;did=8b3.a5e06475&gt;</div>

<div>User-Agent: VFAXSUA/IP_FAX-9.0.5782.743</div>

<div>Content-Length: 0</div>

<div><br>
</div>

<div><br>
</div>

<div><br>
</div>

<div>--------------------------------------------------------------------------</div>

<div>SIP/2.0 200 OK</div>

<div>Via: SIP/2.0/UDP A.B.C.D:5068;branch=z9hG4bK1A55</div>

<div>From: IPFax &lt;sip:<a href="tel:8583234002" value="+18583234002" target="_blank">8583234002</a>@A.B.C.D&gt;;tag=IPF_PORT_0001_1A54</div>

<div>To: &lt;sip:<a href="tel:18584278618" value="+18584278618" target="_blank">18584278618</a>@xxx.xxx.xxx.xxx&gt;;tag=IPF_PORT_0005_1044</div>

<div>Call-ID: 1211a713-96b4-49e0-affb-6c56b73ae54c@A.B.C.D</div>

<div>CSeq: 1 INVITE</div>

<div>Contact: &lt;sip:10.8.1.139:5060;did=8b3.a5e06475&gt;</div>

<div>User-Agent: VFAXSUA/IP_FAX-9.0.5782.743</div>

<div>Allow: INVITE, ACK, BYE, CANCEL, REFER, NOTIFY</div>

<div>Content-Type: application/sdp</div>

<div>Content-Length: 179</div>

<div>P-hint: RR EI </div>

<div><br>
</div>

<div>v=0</div>

<div>o=IPFax 0 0 IN IP4 10.6.3.87</div>

<div>s=SIP Fax Call</div>

<div>i=IPFax</div>

<div>c=IN IP4 xxx.xxx.xxx.xxx</div>

<div>t=0 0</div>

<div>m=audio 7452 RTP/AVP 0</div>

<div>a=rtpmap:0 PCMU/8000</div>

<div>a=ptime:20</div>

<div>a=sendrecv</div>

<div>a=nortpproxy:yes</div>
</div>

<div><br>
</div>

<div><br>
</div>

<div>Thanks.</div>

<div><br>
</div>
</font></div>
</font><br>_______________________________________________<br>
Users mailing list<br>
<a href="mailto:Users@lists.opensips.org">Users@lists.opensips.org</a><br>
<a href="http://lists.opensips.org/cgi-bin/mailman/listinfo/users" target="_blank">http://lists.opensips.org/cgi-bin/mailman/listinfo/users</a><br>
<br></blockquote></div><br>