<font color='black' size='2' face='arial'><font face="Arial, Helvetica, sans-serif" style="color: black; font-size: 10pt; ">I am hoping someone can point me in the right direction. I am using opensips 1.7. </font>
<div style="color: black; 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:10.8.1.139:5060</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="/usr/local/lib64/opensips/modules/"</div>
<div><br>
</div>
<div>/* uncomment next line for MySQL DB support */</div>
<div>loadmodule "db_text.so"</div>
<div>loadmodule "signaling.so"</div>
<div>loadmodule "sl.so"</div>
<div>loadmodule "tm.so"</div>
<div>loadmodule "rr.so"</div>
<div>loadmodule "maxfwd.so"</div>
<div>loadmodule "textops.so"</div>
<div>loadmodule "mi_fifo.so"</div>
<div>loadmodule "uri.so"</div>
<div>loadmodule "domain.so"</div>
<div>loadmodule "permissions.so"</div>
<div>loadmodule "dialog.so"</div>
<div>loadmodule "rtpproxy.so"</div>
<div><br>
</div>
<div>modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")</div>
<div>modparam("rr", "append_fromtag", 0)</div>
<div>modparam("uri", "use_uri_table", 0)</div>
<div>modparam("domain", "db_url","text:///zxa/server/opensipsdb")</div>
<div>modparam("domain", "db_mode", 1) # Use caching</div>
<div>modparam("dialog", "db_mode", 1) # Realtime</div>
<div>modparam("dialog", "db_url","text:///zxa/server/opensipsdb")</div>
<div>modparam("permissions", "db_url","text:///zxa/server/opensipsdb")</div>
<div>modparam("rtpproxy","rtpproxy_sock", "udp:127.0.0.1:7891")</div>
<div><br>
</div>
<div>####### Routing Logic ########</div>
<div><br>
</div>
<div>route{</div>
<div><br>
</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>xlog("=== TOP ===");</div>
<div> xlog("%%%% tu= $tu | fu= $fu | od= $od | ReceivedINT: $Ri | SourceIP: $si %%%");</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> </div>
<div> if (!check_address("1","$si","$sp","$proto"))</div>
<div> {</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>xlog("=== ACCESS FAILED ===");</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>xlog("=== $si| $sp | $proto ===");</div>
<div> sl_send_reply("403","Forbidden");</div>
<div> exit; </div>
<div> }</div>
<div><br>
</div>
<div> if (!mf_process_maxfwd_header("10"))</div>
<div> {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> xlog("=== TOO MANY HOPS ===");</div>
<div> sl_send_reply("483","Too Many Hops");</div>
<div> exit;</div>
<div> }</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>#CANCEL processing</div>
<div> if (is_method("CANCEL"))</div>
<div> {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span> xlog("=== CANCEL ===");</div>
<div> if (t_check_trans())</div>
<div> t_relay();</div>
<div> exit;</div>
<div> }</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>if (is_method("PUBLISH"))</div>
<div> {</div>
<div> sl_send_reply("503", "Service Unavailable");</div>
<div> exit;</div>
<div> }</div>
<div><br>
</div>
<div> </div>
<div>if (has_totag())</div>
<div> {</div>
<div> xlog("=== HAS TO TAG ===");</div>
<div><br>
</div>
<div> if(match_dialog()) && is_method("INVITE|ACK|BYE|UPDATE") #Topology Hide Routine</div>
<div> {</div>
<div> xlog("=== HAS DIALOG MATCH ===");</div>
<div> </div>
<div> if (is_method("BYE"))</div>
<div> {</div>
<div> xlog("=== DIALOG MATCH BYE ===");</div>
<div> setflag(1); # Accounting bye</div>
<div> </div>
<div> } else if (is_method("INVITE")) {</div>
<div> </div>
<div> xlog("=== DIALOG MATCH RE-INVITE LOOSE ===");</div>
<div> </div>
<div> record_route();</div>
<div> </div>
<div> } else if (is_method("ACK")) {</div>
<div> </div>
<div> xlog("=== DIALOG MATCH ACK ===");</div>
<div> }</div>
<div> </div>
<div> xlog(" in-dialog topology hiding request - $DLG_dir\n");</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 class="Apple-tab-span" style="white-space:pre">        </span>if (loose_route()) </div>
<div> {</div>
<div> xlog("L_ERR","Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");</div>
<div> if (!is_method("ACK"))</div>
<div> {</div>
<div> sl_send_reply("403","Preload Route denied");</div>
<div> exit;</div>
<div> }</div>
<div> }</div>
<div><br>
</div>
<div> # record routing</div>
<div> if (!is_method("REGISTER|MESSAGE"))</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </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("Not local so lets just see what happens $rd");</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("484","Address Incomplete");</div>
<div> exit;</div>
<div> }</div>
<div> <span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div> if (is_method("INVITE") && (!has_totag()) )</div>
<div> { </div>
<div> xlog("((((((((( NEW CALL ))))))))))");</div>
<div> rewritehostport("10.6.3.87:5068");</div>
<div> topology_hiding();</div>
<div> route(1);</div>
<div> exit;</div>
<div> }</div>
<div> </div>
<div> </div>
<div><br>
</div>
<div> send_reply("420", "Invalid Extension");</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("=== ROUTE 1 ===");</div>
<div> </div>
<div> if (is_method("BYE|CANCEL"))</div>
<div> {</div>
<div> unforce_rtp_proxy();</div>
<div> }</div>
<div> </div>
<div> if (has_body("application/sdp")) </div>
<div> {</div>
<div> <span class="Apple-tab-span" style="white-space:pre">        </span>append_hf("P-hint: IE \r\n");</div>
<div> rtpproxy_offer("IE","10.8.1.139");</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>}</div>
<div><br>
</div>
<div><br>
</div>
<div> </div>
<div> t_on_reply("1");</div>
<div> t_on_failure("1");</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("=== ON REPLY ROUTE 2 rs= $rs | fu= $fu | od= $od | si= $si | Ri= $Ri ===");</div>
<div> </div>
<div> if ( status=~"(183)|(2[0-9][0-9])" )</div>
<div> {</div>
<div> if ($Ri == "10.8.1.139")</div>
<div> {</div>
<div> append_hf("P-hint: RR EI \r\n");</div>
<div> rtpproxy_answer("EI","xxx.xxx.xxx.xxx");<span class="Apple-tab-span" style="white-space:pre">        </span></div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span>} else {</div>
<div> append_hf("P-hint: RR IE \r\n");</div>
<div><span class="Apple-tab-span" style="white-space:pre">                </span> rtpproxy_answer("IE","10.8.1.139");</div>
<div> </div>
<div> } </div>
<div> }</div>
<div> </div>
<div>}</div>
<div><br>
</div>
<div><br>
</div>
<div>failure_route[1] {</div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>xlog("=== FAIL ROUTE 2 ==="); </div>
<div> </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </span>unforce_rtp_proxy(); </div>
<div> </div>
<div><span class="Apple-tab-span" style="white-space:pre">        </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:18584278618@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 <sip:8583234002@A.B.C.D>;tag=IPF_PORT_0001_1A54</div>
<div>To: <sip:18584278618@xxx.xxx.xxx.xxx></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: <sip:8583234002@A.B.C.D:5068></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 <sip:8583234002@A.B.C.D>;tag=IPF_PORT_0001_1A54</div>
<div>To: <sip:18584278618@xxx.xxx.xxx.xxx>;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: <sip:10.8.1.139:5060;did=8b3.a5e06475></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 <sip:8583234002@A.B.C.D>;tag=IPF_PORT_0001_1A54</div>
<div>To: <sip:18584278618@xxx.xxx.xxx.xxx>;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: <sip:10.8.1.139:5060;did=8b3.a5e06475></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>