Hi, You get this behavior because of the way of the way top_hiding is implemented. 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.
So the top_hiding implementation has a limitation and won'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. Regards, Anca On Tue, Jan 24, 2012 at 3:24 AM, <[email protected]> wrote: > I am hoping someone can point me in the right direction. I am using > opensips 1.7. > > 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. > > Here is my config. Am I missing something? > > debug=3 > log_stderror=no > log_facility=LOG_LOCAL0 > > fork=yes > children=4 > disable_tcp=yes > auto_aliases=yes > sip_warning=yes > > listen=udp:xxx.xxx.xxx.xxx:5060 > listen=udp:10.8.1.139:5060 > > > mhomed=1 > > group=nobody > user=nobody > > ####### Modules Section ######## > > #set module path > mpath="/usr/local/lib64/opensips/modules/" > > /* uncomment next line for MySQL DB support */ > loadmodule "db_text.so" > loadmodule "signaling.so" > loadmodule "sl.so" > loadmodule "tm.so" > loadmodule "rr.so" > loadmodule "maxfwd.so" > loadmodule "textops.so" > loadmodule "mi_fifo.so" > loadmodule "uri.so" > loadmodule "domain.so" > loadmodule "permissions.so" > loadmodule "dialog.so" > loadmodule "rtpproxy.so" > > modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo") > modparam("rr", "append_fromtag", 0) > modparam("uri", "use_uri_table", 0) > modparam("domain", "db_url","text:///zxa/server/opensipsdb") > modparam("domain", "db_mode", 1) # Use caching > modparam("dialog", "db_mode", 1) # Realtime > modparam("dialog", "db_url","text:///zxa/server/opensipsdb") > modparam("permissions", "db_url","text:///zxa/server/opensipsdb") > modparam("rtpproxy","rtpproxy_sock", "udp:127.0.0.1:7891") > > ####### Routing Logic ######## > > route{ > > xlog("=== TOP ==="); > xlog("%%%% tu= $tu | fu= $fu | od= $od | ReceivedINT: $Ri | SourceIP: > $si %%%"); > > if (!check_address("1","$si","$sp","$proto")) > { > xlog("=== ACCESS FAILED ==="); > xlog("=== $si| $sp | $proto ==="); > sl_send_reply("403","Forbidden"); > exit; > } > > if (!mf_process_maxfwd_header("10")) > { > xlog("=== TOO MANY HOPS ==="); > sl_send_reply("483","Too Many Hops"); > exit; > } > #CANCEL processing > if (is_method("CANCEL")) > { > xlog("=== CANCEL ==="); > if (t_check_trans()) > t_relay(); > exit; > } > if (is_method("PUBLISH")) > { > sl_send_reply("503", "Service Unavailable"); > exit; > } > > > if (has_totag()) > { > xlog("=== HAS TO TAG ==="); > > if(match_dialog()) && is_method("INVITE|ACK|BYE|UPDATE") > #Topology Hide Routine > { > xlog("=== HAS DIALOG MATCH ==="); > > if (is_method("BYE")) > { > xlog("=== DIALOG MATCH BYE ==="); > setflag(1); # Accounting bye > > } else if (is_method("INVITE")) { > > xlog("=== DIALOG MATCH RE-INVITE LOOSE ==="); > > record_route(); > > } else if (is_method("ACK")) { > > xlog("=== DIALOG MATCH ACK ==="); > } > > xlog(" in-dialog topology hiding request - $DLG_dir\n"); > > route(1); > exit; > } > > } > > > t_check_trans(); > > if (loose_route()) > { > xlog("L_ERR","Attempt to route with preloaded Route's > [$fu/$tu/$ru/$ci]"); > if (!is_method("ACK")) > { > sl_send_reply("403","Preload Route denied"); > exit; > } > } > > # record routing > if (!is_method("REGISTER|MESSAGE")) > { > record_route(); > } > > > > if (!is_uri_host_local()) > { > xlog("Not local so lets just see what happens $rd"); > route(1); > } > > if ($rU==NULL) > { > # request with no Username in RURI > sl_send_reply("484","Address Incomplete"); > exit; > } > > if (is_method("INVITE") && (!has_totag()) ) > { > xlog("((((((((( NEW CALL ))))))))))"); > rewritehostport("10.6.3.87:5068"); > topology_hiding(); > route(1); > exit; > } > > > > send_reply("420", "Invalid Extension"); > exit; > } > > > route[1] { > > #---- RTP Proxy handling ---# > xlog("=== ROUTE 1 ==="); > > if (is_method("BYE|CANCEL")) > { > unforce_rtp_proxy(); > } > > if (has_body("application/sdp")) > { > append_hf("P-hint: IE \r\n"); > rtpproxy_offer("IE","10.8.1.139"); > } > > > > t_on_reply("1"); > t_on_failure("1"); > > if (!t_relay()) > { > sl_reply_error(); > } > > exit; > > } > > > onreply_route[1] { > > xlog("=== ON REPLY ROUTE 2 rs= $rs | fu= $fu | od= $od | si= $si | > Ri= $Ri ==="); > > if ( status=~"(183)|(2[0-9][0-9])" ) > { > if ($Ri == "10.8.1.139") > { > append_hf("P-hint: RR EI \r\n"); > rtpproxy_answer("EI","xxx.xxx.xxx.xxx"); > } else { > append_hf("P-hint: RR IE \r\n"); > rtpproxy_answer("IE","10.8.1.139"); > > } > } > > } > > > failure_route[1] { > xlog("=== FAIL ROUTE 2 ==="); > > unforce_rtp_proxy(); > > if (t_was_cancelled()) > { > exit; > } > > } > > > > Here is the Sip traces from the external call. > xxx.xxx.xxx.xxx is my opensips server > A.B.C.D is the the external call. > 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 > > > > INVITE sip:[email protected] SIP/2.0 > Via: SIP/2.0/UDP A.B.C.D:5068;branch=z9hG4bK1A55 > From: IPFax <sip:[email protected]>;tag=IPF_PORT_0001_1A54 > To: <sip:[email protected]> > Call-ID: [email protected] > CSeq: 1 INVITE > Max-Forwards: 70 > Contact: <sip:[email protected]:5068> > User-Agent: VFAXSUA/IP_FAX-9.0.5782.743 > Allow: INVITE, ACK, BYE, CANCEL, REFER, NOTIFY > Content-Type: application/sdp > Content-Length: 166 > > v=0 > o=IPFax 0 0 IN IP4 A.B.C.D > s=SIP Fax Call > i=IPFax > c=IN IP4 A.B.C.D > t=0 0 > m=audio 49176 RTP/AVP 0 > a=rtpmap:0 PCMU/8000 > a=ptime:20 > a=sendrecv > > > -------------------------------------------------------------------------- > SIP/2.0 180 Ringing > Via: SIP/2.0/UDP A.B.C.D:5068;branch=z9hG4bK1A55 > From: IPFax <sip:[email protected]>;tag=IPF_PORT_0001_1A54 > To: <sip:[email protected]>;tag=IPF_PORT_0005_1044 > Call-ID: [email protected] > CSeq: 1 INVITE > Contact: <sip:10.8.1.139:5060;did=8b3.a5e06475> > User-Agent: VFAXSUA/IP_FAX-9.0.5782.743 > Content-Length: 0 > > > > > -------------------------------------------------------------------------- > SIP/2.0 200 OK > Via: SIP/2.0/UDP A.B.C.D:5068;branch=z9hG4bK1A55 > From: IPFax <sip:[email protected]>;tag=IPF_PORT_0001_1A54 > To: <sip:[email protected]>;tag=IPF_PORT_0005_1044 > Call-ID: [email protected] > CSeq: 1 INVITE > Contact: <sip:10.8.1.139:5060;did=8b3.a5e06475> > User-Agent: VFAXSUA/IP_FAX-9.0.5782.743 > Allow: INVITE, ACK, BYE, CANCEL, REFER, NOTIFY > Content-Type: application/sdp > Content-Length: 179 > P-hint: RR EI > > v=0 > o=IPFax 0 0 IN IP4 10.6.3.87 > s=SIP Fax Call > i=IPFax > c=IN IP4 xxx.xxx.xxx.xxx > t=0 0 > m=audio 7452 RTP/AVP 0 > a=rtpmap:0 PCMU/8000 > a=ptime:20 > a=sendrecv > a=nortpproxy:yes > > > Thanks. > > > _______________________________________________ > Users mailing list > [email protected] > http://lists.opensips.org/cgi-bin/mailman/listinfo/users > >
_______________________________________________ Users mailing list [email protected] http://lists.opensips.org/cgi-bin/mailman/listinfo/users
