<div>Do a</div>
<div>ngrep -W byline -td any . port 5060</div>
<div> </div>
<div>during the call call to see what's going on.<br><br></div>
<div class="gmail_quote">On Tue, Nov 2, 2010 at 7:25 AM, Deon Vermeulen <span dir="ltr"><<a href="mailto:vermeulen.deon@gmail.com">vermeulen.deon@gmail.com</a>></span> wrote:<br>
<blockquote style="BORDER-LEFT: #ccc 1px solid; MARGIN: 0px 0px 0px 0.8ex; PADDING-LEFT: 1ex" class="gmail_quote">Hi List<br><br>I'm trying to setup NAT to NOT use MediaProxy when it detects that 2<br>devices are behind the same NAT Device, but rather have coms go<br>
directly between them.<br>At the moment I can dial between the 2 phones and answer the call.<br>The callee phone says "Call Established" upon answer, but the caller<br>phone still says "trying/connecting".<br>
I am sure this has something to do with my configuration, but I have<br>"NO IDEA" where to start looking.<br>The phones are setup to use their local IPs with no other STUN, ICE,<br>or "proxy like" configurations.<br>
Below is a snipped from my opensips.cfg with the NAT configs and would<br>really appreciate any help to get this working.<br><br>modparam("rr", "enable_full_lr", 1)<br>modparam("registrar", "received_avp", "$avp(i:42)")<br>
modparam("usrloc", "db_mode", 2)<br>modparam("usrloc", "nat_bflag", 6)<br>modparam("domain", "db_mode", 1) # Use caching<br>modparam("auth_db|usrloc|uri|avpops", "use_domain", 1)<br>
modparam("auth_db|alias_db|domain|uri|uri_db|usrloc|permissions|<br>siptrace|group|avpops|presence", "db_url", "mysql://<br>opensips:opensipsrw@localhost/opensips")<br>modparam("nathelper", "natping_interval", 10)<br>
modparam("nathelper", "received_avp", "$avp(i:42)")<br>modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy-<br>dispatcher.sock")<br>modparam("mediaproxy", "mediaproxy_timeout", 500)<br>
modparam("mi_datagram", "socket_name", "/var/run/opensips/<br>opensips.sock")<br>modparam("mi_datagram", "children_count", 4)<br><br><br># ------------------------- request routing logic ------------------- #<br>
<br>route{<br><br> #<br> # -- 1 -- Request Validation<br> #<br> if (!mf_process_maxfwd_header("10")) {<br> sl_send_reply("483","Too Many Hops");<br> exit;<br> }<br>
<br> if (msg:len >= 2048 ) {<br> sl_send_reply("513", "Message too big");<br> exit;<br> }<br><br> #<br> # -- 2 -- Routing Preprocessing<br> #<br> ## Record-route all except Register<br>
## Mark packets with nat=yes<br> ## This mark will be used to identify the request in the loose<br> ## route section<br> if(!is_method("REGISTER")){<br> if(nat_uac_test("19")){<br> record_route(";nat=yes");<br>
} else {<br> record_route();<br> }<br> }<br><br> ##Loose_route packets<br> if (has_totag()) {<br> #sequential request withing a dialog should<br> # take the path determined by record-routing<br>
if (loose_route()) {<br> #Check authentication of re-invites<br> if(method=="INVITE") {<br> if (!proxy_authorize("","subscriber")) {<br> proxy_challenge("","1");<br>
exit;<br> } else if (!db_check_from()) {<br> sl_send_reply("403", "Forbidden, use From=ID");<br> exit;<br> }<br> }<br> ## BYE and CANCEL message handling<br>
if(method=="BYE" || method=="CANCEL") {<br> end_media_session();<br> }<br> ##Detect requests in the dialog behind NAT and flag with 6<br> if(nat_uac_test("19") || search("^Route:.*;nat=yes")){<br>
append_hf("P-hint: LR|fixcontact,setflag6, mediaproxy<br>\r\n");<br> fix_contact();<br> setbflag(6);<br> use_media_proxy();<br> }<br> route(1);<br>
} else {<br> sl_send_reply("404","Not here");<br> }<br> exit;<br> }<br><br> #CANCEL processing<br> if (is_method("CANCEL")) {<br> if (t_check_trans()) {<br>
end_media_session();<br> t_relay();<br> }<br> exit;<br> }<br><br> t_check_trans();<br><br> #<br> # -- 3 -- Determine Request Target<br> #<br> if (method=="REGISTER") {<br>
route(2);<br> } else {<br> route(3);<br> }<br>}<br><br><br>route[1] {<br> #<br> # -- 4 -- Forward request to target<br> #<br> # Forward statefully<br> t_on_reply("1");<br> t_on_failure("1");<br>
if (!t_relay()) {<br> sl_reply_error();<br> }<br> exit;<br>}<br><br>route[2] {<br> ## Register request handler<br> if (is_uri_host_local()) {<br> if (!www_authorize("", "subscriber")) {<br>
www_challenge("", "1");<br> exit;<br> }<br><br> if (!db_check_to()) {<br> sl_send_reply("403", "Forbidden");<br> exit;<br>
}<br><br> # Test to see if Caller is behind NAT<br> if(!search("^Contact:[ ]*\*") && client_nat_test("7")) {<br> setbflag(6);<br> fix_nated_register();<br>
force_rport();<br> }<br> save("location");<br> exit;<br><br> } else {<br> sl_send_reply("403", "Forbidden");<br> }<br>}<br><br><br>route[3] {<br>
## Requests handler<br> if (is_from_local()){<br> # From an internal domain -> check the credentials and the FROM<br> #if(!allow_trusted()){<br> if (!proxy_authorize("","subscriber")) {<br>
proxy_challenge("","0");<br> exit;<br> } else if(!db_check_from()) {<br> sl_send_reply("403", "Forbidden, use From=ID");<br> exit;<br>
}<br><br> if (client_nat_test("3")) {<br> append_hf("P-hint: route(3)|<br>setflag7,forcerport,fix_contact\r\n");<br> setbflag(7);<br> force_rport();<br> fix_contact();<br>
}<br><br>..............<br><br>route[6] {<br> #<br> # -- NAT Traversal handling --<br> #<br> # Route[6] is the routing block responsible for activating the<br>MediaProxy, whenever<br> # the caller or callee is behind NAT (flags 6 or 7 respectively).<br>
if (isbflagset(6) || isbflagset(7)) {<br> if ( $dd == $si ) {<br> xlog("L_INFO", "Both users behind same NAT, so we<br>dont use MediaProxy\n");<br> resetbflag(6); # Unset NAT flag general.<br>
resetbflag(7); # Unset NAT flag general.<br> } else<br> append_hf("P-hint: Route[6]: mediaproxy \r\n");<br> use_media_proxy();<br> }<br>}<br><br>.............<br><br>onreply_route[1] {<br>
#<br>#-- On-replay block routing --<br>#<br> if (client_nat_test("1")) {<br> append_hf("P-hint: Onreply-route - fixcontact \r\n");<br> fix_contact();<br> }<br><br> if ((isbflagset(6) || isbflagset(7)) && (status=~"(180)|(183)|<br>
2[0-9][0-9]")) {<br> if (search("^Content-Type:[ ]*application/sdp")) {<br> append_hf("P-hint: onreply_route|usemediaproxy \r\n");<br> use_media_proxy();<br> }<br> }<br>
exit;<br>}<br><br><br>Thanks again for helping. Really appreciate it.<br><br>Regards<br>Deon<br><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></blockquote></div><br><br clear="all"><br>-- <br>--<br>*--*--*--*--*--*<br>
Duane<br>*--*--*--*--*--*<br>--<br>