Hello,
Following http://www.voip-info.org/wiki/index.php?page=OpenSER%20v1.2.x%20and%20RTPPro xy and cleaning up the errors in the log, I have OpenSER 1.3 and RTPProxy running in my local domain (192.168.2.10)
I have two SIP phones in my local domain, on two machines. (2.5 and 2.3)
I added an alias via openserctl ul add gail sip:192.168.2.5
Looking at the packets captured from a call between 2.5 and 2.3, 2.3 should start streaming RTP packets after it ACKs the 200 from 2.5
I call from 192.168.2.5 to gail@192.168.2.10 and the connection is established between the three, but no RTP streams ever begin. I expected to see 2.3 streaming RTP after it ACKs the 200 from 2.10.
Any suggestions?
Here's my cfg file:
# # sample config file to be used with nathelper/rtpproxy # # start RTPProxy with: rtpproxy -l your_public_ip -s udp:localhost:8899 #
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd) fork=yes log_stderror=no # (cmd line: -E)
/* Uncomment these lines to enter debugging mode fork=no log_stderror=yes */
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4
# --- module loading
mpath="/usr/local/lib/openser/modules/"
loadmodule "mysql.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "usrloc.so" loadmodule "textops.so" loadmodule "auth.so" loadmodule "auth_db.so" loadmodule "xlog.so" loadmodule "registrar.so" loadmodule "mi_fifo.so" loadmodule "presence.so" loadmodule "presence_xml.so" loadmodule "xcap_client.so" loadmodule "nathelper.so"
# --- setting module parameters
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("auth_db","db_url","mysql://openser:secret@127.0.0.1/openser")
modparam("registrar", "received_avp", "$avp(s:rcv)")
modparam("xcap_client", "db_url", "mysql://openser:secret@127.0.0.1/openser")
# -- usrloc params -- modparam("usrloc", "db_url", "mysql://openser:secret@127.0.0.1/openser") modparam("usrloc", "db_mode", 2) modparam("usrloc", "nat_bflag", 3)
# -- registrar params -- modparam("registrar", "received_avp", "$avp(s:rcv)")
# -- auth params -- modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password")
# -- rr params -- modparam("rr", "enable_full_lr", 1)
# -- nathelper modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:8899") modparam("nathelper", "natping_interval", 30) modparam("nathelper", "ping_nated_only", 1) #modparam("nathelper", "sipping_bflag", 7) modparam("nathelper", "sipping_from", "sip:pinger@openser.org") modparam("nathelper", "received_avp", "$avp(s:rcv)")
# -- xlog modparam("xlog", "buf_size", 8192)
# -- presence params -- modparam("presence|presence_xml|usrloc", "db_url", "mysql://openser:secret@127.0.0.1/openser") modparam("presence", "max_expires", 3600) modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:127.0.0.1:5060" )
# --- main routing logic route{ xlog("***start***\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); xlog("***end - Too Many Hops"); exit; }; if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); xlog("***end - Too big"); exit; };
# NAT detection route(2);
if (!method=="REGISTER") { xlog("***route - recordroute\n"); record_route(); } if (loose_route()) { xlog("***route - looseroute\n"); append_hf("P-hint: rr-enforced\r\n"); route(1); };
if (!uri==myself) { xlog("***route - not myself\n"); append_hf("P-hint: outbound\r\n"); route(1); };
if (uri==myself) { if (method=="REGISTER") { xlog("***route - register"); if (!www_authorize("openser.org", "subscriber")) { xlog("***route - challenging"); www_challenge("openser.org", "0"); exit; };
if (isflagset(5)) { xlog("***route - isflagset(5)"); setflag(6); # if you want OPTIONS natpings uncomment next # setflag(7); }; save("location"); xlog("***route - registered"); exit; };
if (!lookup("location")) { sl_send_reply("404", "Not Found"); xlog("***route - 404, Not found"); exit; }; append_hf("P-hint: usrloc applied\r\n"); };
route(1); xlog("***end***\n"); }
route[1] { xlog("***route1***\n"); if (subst_uri('/(sip:.*);nat=yes/\1/')){ xlog("***route[1] - setflag(6)"); setflag(6); };
if (isflagset(5)||isflagset(6)) { xlog("***route[1] - route(3)"); route(3); }
if (!t_relay()) { xlog("***route[1] - error"); sl_reply_error(); }; xlog("***end - route[1]"); exit; }
route[2]{ xlog("***route2***\n"); force_rport(); if (nat_uac_test("19")) { xlog("***route2 - nat_uac_test(19)\n"); if (method=="REGISTER") { xlog("***route2 - register\n"); fix_nated_register(); } else { xlog("***route2 - contact\n"); fix_nated_contact(); }; setflag(5); }; }
route[3] { xlog("***route3***\n"); if (is_method("BYE|CANCEL")) { xlog("***route3 - unforce\n"); unforce_rtp_proxy(); } else if (is_method("INVITE")){ xlog("***route3 - force\n"); force_rtp_proxy("i"); t_on_failure("1"); }; if (isflagset(5)) { xlog("***route3 - isflagset(5)\n"); search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes'); } t_on_reply("1"); }
failure_route[1] { xlog("***failureroute1***\n"); if (isflagset(6) || isflagset(5)) { xlog("***failroute1 - unforce\n"); unforce_rtp_proxy(); } }
onreply_route[1] { xlog("***onreplyroute1***\n"); if ((isflagset(5) || isflagset(6)) && status=~"(183)|(2[0-9][0-9])") { xlog("***onreplyroute1 - force\n"); force_rtp_proxy("i"); } search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
if (isflagset(6)) { xlog("***onreplyroute1 - contact\n"); fix_nated_contact(); } xlog("***end - onreplyrout[1]"); exit; }
Thanks,
Eric
The pro's seem to be busy so I'll give it a go.
If gail == 2.5 then a call from 2.5 to gail does not make much sense but maybe it was a typo.
You did not say anything about your topology. Where were expecting to find the RTP packets?
uac test 19 ( really 16+2+1 ) maybe isn't really what you want. Check the nathelper documentation. Among other things it will check for a private address. If you have local to local calls, there is no NAT involved. Sending the RTP through a proxy is unnecessary. It probably would work though.
On Thursday 14 February 2008, Eric Phetteplace wrote:
Hello,
Following http://www.voip-info.org/wiki/index.php?page=OpenSER%20v1.2.x%20and%20RTPPr o xy and cleaning up the errors in the log, I have OpenSER 1.3 and RTPProxy running in my local domain (192.168.2.10)
I have two SIP phones in my local domain, on two machines. (2.5 and 2.3)
I added an alias via openserctl ul add gail sip:192.168.2.5
Looking at the packets captured from a call between 2.5 and 2.3, 2.3 should start streaming RTP packets after it ACKs the 200 from 2.5
I call from 192.168.2.5 to gail@192.168.2.10 and the connection is established between the three, but no RTP streams ever begin. I expected to see 2.3 streaming RTP after it ACKs the 200 from 2.10.
Any suggestions?
Here's my cfg file:
# # sample config file to be used with nathelper/rtpproxy # # start RTPProxy with: rtpproxy -l your_public_ip -s udp:localhost:8899 #
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd) fork=yes log_stderror=no # (cmd line: -E)
/* Uncomment these lines to enter debugging mode fork=no log_stderror=yes */
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4
# --- module loading
mpath="/usr/local/lib/openser/modules/"
loadmodule "mysql.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "usrloc.so" loadmodule "textops.so" loadmodule "auth.so" loadmodule "auth_db.so" loadmodule "xlog.so" loadmodule "registrar.so" loadmodule "mi_fifo.so" loadmodule "presence.so" loadmodule "presence_xml.so" loadmodule "xcap_client.so" loadmodule "nathelper.so"
# --- setting module parameters
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("auth_db","db_url","mysql://openser:secret@127.0.0.1/openser")
modparam("registrar", "received_avp", "$avp(s:rcv)")
modparam("xcap_client", "db_url", "mysql://openser:secret@127.0.0.1/openser")
# -- usrloc params -- modparam("usrloc", "db_url", "mysql://openser:secret@127.0.0.1/openser") modparam("usrloc", "db_mode", 2) modparam("usrloc", "nat_bflag", 3)
# -- registrar params -- modparam("registrar", "received_avp", "$avp(s:rcv)")
# -- auth params -- modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password")
# -- rr params -- modparam("rr", "enable_full_lr", 1)
# -- nathelper modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:8899") modparam("nathelper", "natping_interval", 30) modparam("nathelper", "ping_nated_only", 1) #modparam("nathelper", "sipping_bflag", 7) modparam("nathelper", "sipping_from", "sip:pinger@openser.org") modparam("nathelper", "received_avp", "$avp(s:rcv)")
# -- xlog modparam("xlog", "buf_size", 8192)
# -- presence params -- modparam("presence|presence_xml|usrloc", "db_url", "mysql://openser:secret@127.0.0.1/openser") modparam("presence", "max_expires", 3600) modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:127.0.0.1:5060" )
# --- main routing logic route{ xlog("***start***\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); xlog("***end - Too Many Hops"); exit; }; if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); xlog("***end - Too big"); exit; };
# NAT detection route(2);
if (!method=="REGISTER") { xlog("***route - recordroute\n"); record_route(); } if (loose_route()) { xlog("***route - looseroute\n"); append_hf("P-hint: rr-enforced\r\n"); route(1); };
if (!uri==myself) { xlog("***route - not myself\n"); append_hf("P-hint: outbound\r\n"); route(1); };
if (uri==myself) { if (method=="REGISTER") { xlog("***route - register"); if (!www_authorize("openser.org", "subscriber")) { xlog("***route - challenging"); www_challenge("openser.org", "0"); exit; };
if (isflagset(5)) { xlog("***route - isflagset(5)"); setflag(6); # if you want OPTIONS natpings uncomment
next # setflag(7); }; save("location"); xlog("***route - registered"); exit; };
if (!lookup("location")) { sl_send_reply("404", "Not Found"); xlog("***route - 404, Not found"); exit; }; append_hf("P-hint: usrloc applied\r\n");
};
route(1); xlog("***end***\n"); }
route[1] { xlog("***route1***\n"); if (subst_uri('/(sip:.*);nat=yes/\1/')){ xlog("***route[1] - setflag(6)"); setflag(6); };
if (isflagset(5)||isflagset(6)) { xlog("***route[1] - route(3)"); route(3); }
if (!t_relay()) { xlog("***route[1] - error"); sl_reply_error(); }; xlog("***end - route[1]"); exit; }
route[2]{ xlog("***route2***\n"); force_rport(); if (nat_uac_test("19")) { xlog("***route2 - nat_uac_test(19)\n"); if (method=="REGISTER") { xlog("***route2 - register\n"); fix_nated_register(); } else { xlog("***route2 - contact\n"); fix_nated_contact(); }; setflag(5); }; }
route[3] { xlog("***route3***\n"); if (is_method("BYE|CANCEL")) { xlog("***route3 - unforce\n"); unforce_rtp_proxy(); } else if (is_method("INVITE")){ xlog("***route3 - force\n"); force_rtp_proxy("i"); t_on_failure("1"); }; if (isflagset(5)) { xlog("***route3 - isflagset(5)\n"); search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes'); } t_on_reply("1"); }
failure_route[1] { xlog("***failureroute1***\n"); if (isflagset(6) || isflagset(5)) { xlog("***failroute1 - unforce\n"); unforce_rtp_proxy(); } }
onreply_route[1] { xlog("***onreplyroute1***\n"); if ((isflagset(5) || isflagset(6)) && status=~"(183)|(2[0-9][0-9])") { xlog("***onreplyroute1 - force\n"); force_rtp_proxy("i"); } search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
if (isflagset(6)) { xlog("***onreplyroute1 - contact\n"); fix_nated_contact(); } xlog("***end - onreplyrout[1]"); exit; }
Thanks,
Eric
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
Hi Robert,
I placed a call from 2.3 to 2.5(gail) to observe the traffic. Then I place a call from 2.3 to gail@2.10 to observe the traffic through openser.
For the network topology, it's all on the same local network. I tried the default cfg file and it works fine. I'll try adjusting nat_uac_test, as it's not recognizing I'm on the local network.
All set, Thanks!
-----Original Message----- From: Robert Dyck Sent: Thursday, February 14, 2008 9:49 PM To: users@lists.openser.org Cc: Eric Phetteplace Subject: Re: [OpenSER-Users] OpenSerand RTPProxy, no RTP audio
The pro's seem to be busy so I'll give it a go.
If gail == 2.5 then a call from 2.5 to gail does not make much sense but maybe it was a typo.
You did not say anything about your topology. Where were expecting to find the RTP packets?
uac test 19 ( really 16+2+1 ) maybe isn't really what you want. Check the nathelper documentation. Among other things it will check for a private address. If you have local to local calls, there is no NAT involved. Sending
the RTP through a proxy is unnecessary. It probably would work though.
On Thursday 14 February 2008, Eric Phetteplace wrote:
Hello,
Following
http://www.voip-info.org/wiki/index.php?page=OpenSER%20v1.2.x%20and%20RTPPr
o xy and cleaning up the errors in the log, I have OpenSER 1.3 and RTPProxy running in my local domain (192.168.2.10)
I have two SIP phones in my local domain, on two machines. (2.5 and 2.3)
I added an alias via openserctl ul add gail sip:192.168.2.5
Looking at the packets captured from a call between 2.5 and 2.3, 2.3
should
start streaming RTP packets after it ACKs the 200 from 2.5
I call from 192.168.2.5 to gail@192.168.2.10 and the connection is established between the three, but no RTP streams ever begin. I expected to see 2.3 streaming RTP after it ACKs the 200 from 2.10.
Any suggestions?
Here's my cfg file:
# # sample config file to be used with nathelper/rtpproxy # # start RTPProxy with: rtpproxy -l your_public_ip -s udp:localhost:8899 #
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd) fork=yes log_stderror=no # (cmd line: -E)
/* Uncomment these lines to enter debugging mode fork=no log_stderror=yes */
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4
# --- module loading
mpath="/usr/local/lib/openser/modules/"
loadmodule "mysql.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "usrloc.so" loadmodule "textops.so" loadmodule "auth.so" loadmodule "auth_db.so" loadmodule "xlog.so" loadmodule "registrar.so" loadmodule "mi_fifo.so" loadmodule "presence.so" loadmodule "presence_xml.so" loadmodule "xcap_client.so" loadmodule "nathelper.so"
# --- setting module parameters
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("auth_db","db_url","mysql://openser:secret@127.0.0.1/openser")
modparam("registrar", "received_avp", "$avp(s:rcv)")
modparam("xcap_client", "db_url", "mysql://openser:secret@127.0.0.1/openser")
# -- usrloc params -- modparam("usrloc", "db_url", "mysql://openser:secret@127.0.0.1/openser") modparam("usrloc", "db_mode", 2) modparam("usrloc", "nat_bflag", 3)
# -- registrar params -- modparam("registrar", "received_avp", "$avp(s:rcv)")
# -- auth params -- modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password")
# -- rr params -- modparam("rr", "enable_full_lr", 1)
# -- nathelper modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:8899") modparam("nathelper", "natping_interval", 30) modparam("nathelper", "ping_nated_only", 1) #modparam("nathelper", "sipping_bflag", 7) modparam("nathelper", "sipping_from", "sip:pinger@openser.org") modparam("nathelper", "received_avp", "$avp(s:rcv)")
# -- xlog modparam("xlog", "buf_size", 8192)
# -- presence params -- modparam("presence|presence_xml|usrloc", "db_url", "mysql://openser:secret@127.0.0.1/openser") modparam("presence", "max_expires", 3600) modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:127.0.0.1:5060" )
# --- main routing logic route{ xlog("***start***\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); xlog("***end - Too Many Hops"); exit; }; if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); xlog("***end - Too big"); exit; };
# NAT detection route(2);
if (!method=="REGISTER") { xlog("***route - recordroute\n"); record_route(); } if (loose_route()) { xlog("***route - looseroute\n"); append_hf("P-hint: rr-enforced\r\n"); route(1); };
if (!uri==myself) { xlog("***route - not myself\n"); append_hf("P-hint: outbound\r\n"); route(1); };
if (uri==myself) { if (method=="REGISTER") { xlog("***route - register"); if (!www_authorize("openser.org", "subscriber")) { xlog("***route - challenging"); www_challenge("openser.org", "0"); exit; };
if (isflagset(5)) { xlog("***route - isflagset(5)"); setflag(6); # if you want OPTIONS natpings uncomment
next # setflag(7); }; save("location"); xlog("***route - registered"); exit; };
if (!lookup("location")) { sl_send_reply("404", "Not Found"); xlog("***route - 404, Not found"); exit; }; append_hf("P-hint: usrloc applied\r\n");
};
route(1); xlog("***end***\n"); }
route[1] { xlog("***route1***\n"); if (subst_uri('/(sip:.*);nat=yes/\1/')){ xlog("***route[1] - setflag(6)"); setflag(6); };
if (isflagset(5)||isflagset(6)) { xlog("***route[1] - route(3)"); route(3); }
if (!t_relay()) { xlog("***route[1] - error"); sl_reply_error(); }; xlog("***end - route[1]"); exit; }
route[2]{ xlog("***route2***\n"); force_rport(); if (nat_uac_test("19")) { xlog("***route2 - nat_uac_test(19)\n"); if (method=="REGISTER") { xlog("***route2 - register\n"); fix_nated_register(); } else { xlog("***route2 - contact\n"); fix_nated_contact(); }; setflag(5); }; }
route[3] { xlog("***route3***\n"); if (is_method("BYE|CANCEL")) { xlog("***route3 - unforce\n"); unforce_rtp_proxy(); } else if (is_method("INVITE")){ xlog("***route3 - force\n"); force_rtp_proxy("i"); t_on_failure("1"); }; if (isflagset(5)) { xlog("***route3 - isflagset(5)\n"); search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes'); } t_on_reply("1"); }
failure_route[1] { xlog("***failureroute1***\n"); if (isflagset(6) || isflagset(5)) { xlog("***failroute1 - unforce\n"); unforce_rtp_proxy(); } }
onreply_route[1] { xlog("***onreplyroute1***\n"); if ((isflagset(5) || isflagset(6)) && status=~"(183)|(2[0-9][0-9])") { xlog("***onreplyroute1 - force\n"); force_rtp_proxy("i"); } search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
if (isflagset(6)) { xlog("***onreplyroute1 - contact\n"); fix_nated_contact(); } xlog("***end - onreplyrout[1]"); exit; }
Thanks,
Eric
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
The example script you are using and maybe all the example scripts were written from the perspective of a service provider. The idea is to detect users who had to pass through a NAT to reach openser. The contact information that these users provide cannot be relied upon so openser needs to work around the misinformation. The NAT is of no concern when calling between local phones.
In my case I use openser as an ALG and for local calling. I make no attempt to test whether any user is behind a NAT. A local origination is determined by
# Check if package originates from LAN if (src_ip==192.168.1.0/255.255.255.0) { } else { }
Is this generally what you are trying to accomplish?
On Friday 15 February 2008, Eric Phetteplace wrote:
Hi Robert,
I placed a call from 2.3 to 2.5(gail) to observe the traffic. Then I place a call from 2.3 to gail@2.10 to observe the traffic through openser.
For the network topology, it's all on the same local network. I tried the default cfg file and it works fine. I'll try adjusting nat_uac_test, as it's not recognizing I'm on the local network.
All set, Thanks!
-----Original Message----- From: Robert Dyck Sent: Thursday, February 14, 2008 9:49 PM To: users@lists.openser.org Cc: Eric Phetteplace Subject: Re: [OpenSER-Users] OpenSerand RTPProxy, no RTP audio
The pro's seem to be busy so I'll give it a go.
If gail == 2.5 then a call from 2.5 to gail does not make much sense but maybe it was a typo.
You did not say anything about your topology. Where were expecting to find the RTP packets?
uac test 19 ( really 16+2+1 ) maybe isn't really what you want. Check the nathelper documentation. Among other things it will check for a private address. If you have local to local calls, there is no NAT involved. Sending
the RTP through a proxy is unnecessary. It probably would work though.
On Thursday 14 February 2008, Eric Phetteplace wrote:
Hello,
Following
http://www.voip-info.org/wiki/index.php?page=OpenSER%20v1.2.x%20and%20RTPPr
o xy and cleaning up the errors in the log, I have OpenSER 1.3 and RTPProxy running in my local domain (192.168.2.10)
I have two SIP phones in my local domain, on two machines. (2.5 and 2.3)
I added an alias via openserctl ul add gail sip:192.168.2.5
Looking at the packets captured from a call between 2.5 and 2.3, 2.3
should
start streaming RTP packets after it ACKs the 200 from 2.5
I call from 192.168.2.5 to gail@192.168.2.10 and the connection is established between the three, but no RTP streams ever begin. I expected to see 2.3 streaming RTP after it ACKs the 200 from 2.10.
Any suggestions?
Here's my cfg file:
# # sample config file to be used with nathelper/rtpproxy # # start RTPProxy with: rtpproxy -l your_public_ip -s udp:localhost:8899 #
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd) fork=yes log_stderror=no # (cmd line: -E)
/* Uncomment these lines to enter debugging mode fork=no log_stderror=yes */
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4
# --- module loading
mpath="/usr/local/lib/openser/modules/"
loadmodule "mysql.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "usrloc.so" loadmodule "textops.so" loadmodule "auth.so" loadmodule "auth_db.so" loadmodule "xlog.so" loadmodule "registrar.so" loadmodule "mi_fifo.so" loadmodule "presence.so" loadmodule "presence_xml.so" loadmodule "xcap_client.so" loadmodule "nathelper.so"
# --- setting module parameters
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("auth_db","db_url","mysql://openser:secret@127.0.0.1/openser")
modparam("registrar", "received_avp", "$avp(s:rcv)")
modparam("xcap_client", "db_url", "mysql://openser:secret@127.0.0.1/openser")
# -- usrloc params -- modparam("usrloc", "db_url", "mysql://openser:secret@127.0.0.1/openser") modparam("usrloc", "db_mode", 2) modparam("usrloc", "nat_bflag", 3)
# -- registrar params -- modparam("registrar", "received_avp", "$avp(s:rcv)")
# -- auth params -- modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password")
# -- rr params -- modparam("rr", "enable_full_lr", 1)
# -- nathelper modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:8899") modparam("nathelper", "natping_interval", 30) modparam("nathelper", "ping_nated_only", 1) #modparam("nathelper", "sipping_bflag", 7) modparam("nathelper", "sipping_from", "sip:pinger@openser.org") modparam("nathelper", "received_avp", "$avp(s:rcv)")
# -- xlog modparam("xlog", "buf_size", 8192)
# -- presence params -- modparam("presence|presence_xml|usrloc", "db_url", "mysql://openser:secret@127.0.0.1/openser") modparam("presence", "max_expires", 3600) modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:127.0.0.1:5060" )
# --- main routing logic route{ xlog("***start***\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); xlog("***end - Too Many Hops"); exit; }; if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); xlog("***end - Too big"); exit; };
# NAT detection route(2);
if (!method=="REGISTER") { xlog("***route - recordroute\n"); record_route(); } if (loose_route()) { xlog("***route - looseroute\n"); append_hf("P-hint: rr-enforced\r\n"); route(1); };
if (!uri==myself) { xlog("***route - not myself\n"); append_hf("P-hint: outbound\r\n"); route(1); };
if (uri==myself) { if (method=="REGISTER") { xlog("***route - register"); if (!www_authorize("openser.org", "subscriber")) { xlog("***route - challenging"); www_challenge("openser.org", "0"); exit; };
if (isflagset(5)) { xlog("***route - isflagset(5)"); setflag(6); # if you want OPTIONS natpings uncomment
next # setflag(7); }; save("location"); xlog("***route - registered"); exit; };
if (!lookup("location")) { sl_send_reply("404", "Not Found"); xlog("***route - 404, Not found"); exit; }; append_hf("P-hint: usrloc applied\r\n");
};
route(1); xlog("***end***\n"); }
route[1] { xlog("***route1***\n"); if (subst_uri('/(sip:.*);nat=yes/\1/')){ xlog("***route[1] - setflag(6)"); setflag(6); };
if (isflagset(5)||isflagset(6)) { xlog("***route[1] - route(3)"); route(3); }
if (!t_relay()) { xlog("***route[1] - error"); sl_reply_error(); }; xlog("***end - route[1]"); exit; }
route[2]{ xlog("***route2***\n"); force_rport(); if (nat_uac_test("19")) { xlog("***route2 - nat_uac_test(19)\n"); if (method=="REGISTER") { xlog("***route2 - register\n"); fix_nated_register(); } else { xlog("***route2 - contact\n"); fix_nated_contact(); }; setflag(5); }; }
route[3] { xlog("***route3***\n"); if (is_method("BYE|CANCEL")) { xlog("***route3 - unforce\n"); unforce_rtp_proxy(); } else if (is_method("INVITE")){ xlog("***route3 - force\n"); force_rtp_proxy("i"); t_on_failure("1"); }; if (isflagset(5)) { xlog("***route3 - isflagset(5)\n"); search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes'); } t_on_reply("1"); }
failure_route[1] { xlog("***failureroute1***\n"); if (isflagset(6) || isflagset(5)) { xlog("***failroute1 - unforce\n"); unforce_rtp_proxy(); } }
onreply_route[1] { xlog("***onreplyroute1***\n"); if ((isflagset(5) || isflagset(6)) && status=~"(183)|(2[0-9][0-9])") { xlog("***onreplyroute1 - force\n"); force_rtp_proxy("i"); } search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes');
if (isflagset(6)) { xlog("***onreplyroute1 - contact\n"); fix_nated_contact(); } xlog("***end - onreplyrout[1]"); exit; }
Thanks,
Eric
Users mailing list Users@lists.openser.org http://lists.openser.org/cgi-bin/mailman/listinfo/users
Thanks to for your advice, I got it working!
For now, I crippled nat_uac_test.
I have: 2.3 My SIP phone 2.4 IVR server 2.10 OpenSER with RTPProxy.
And instead of 2.5, I'm now hitting 2.4. 2.4 Replies with a 302 (temporarily moved) to 2.10, which is relayed to 2.3. When I monitor the traffic, 2.3 ACKs 2.10 and *still* starts the RTP directly with 2.4.
I'm going to try customizing onreply_route[1] to accommodate this. Correct?
Eric
# # sample config file to be used with nathelper/rtpproxy # # start RTPProxy with: rtpproxy -l your_public_ip -s udp:localhost:8899 #
# ----------- global configuration parameters ------------------------
debug=3 # debug level (cmd line: -dddddddddd) fork=yes log_stderror=no # (cmd line: -E)
/* Uncomment these lines to enter debugging mode fork=no log_stderror=yes */
check_via=no # (cmd. line: -v) dns=no # (cmd. line: -r) rev_dns=no # (cmd. line: -R) port=5060 children=4
# --- module loading
mpath="/usr/local/lib/openser/modules/"
loadmodule "mysql.so" loadmodule "sl.so" loadmodule "tm.so" loadmodule "rr.so" loadmodule "maxfwd.so" loadmodule "usrloc.so" loadmodule "textops.so" loadmodule "auth.so" loadmodule "auth_db.so" loadmodule "xlog.so" loadmodule "registrar.so" loadmodule "mi_fifo.so" loadmodule "presence.so" loadmodule "presence_xml.so" loadmodule "xcap_client.so" loadmodule "nathelper.so" loadmodule "uri.so"
# --- setting module parameters
modparam("mi_fifo", "fifo_name", "/tmp/openser_fifo")
modparam("auth_db","db_url","mysql://openser:Don'tBother@127.0.0.1/openser")
modparam("registrar", "received_avp", "$avp(s:rcv)")
modparam("xcap_client", "db_url", "mysql://openser:Don'tBother@127.0.0.1/openser")
# -- usrloc params -- modparam("usrloc", "db_url", "mysql://openser:Don'tBother@127.0.0.1/openser") modparam("usrloc", "db_mode", 2) modparam("usrloc", "nat_bflag", 3)
# -- registrar params -- modparam("registrar", "received_avp", "$avp(s:rcv)")
# -- auth params -- modparam("auth_db", "calculate_ha1", yes) modparam("auth_db", "password_column", "password")
# -- rr params -- modparam("rr", "enable_full_lr", 1)
# -- nathelper modparam("nathelper", "rtpproxy_sock", "udp:127.0.0.1:8899") modparam("nathelper", "natping_interval", 30) modparam("nathelper", "ping_nated_only", 1) #modparam("nathelper", "sipping_bflag", 7) modparam("nathelper", "sipping_from", "sip:pinger@openser.org") modparam("nathelper", "received_avp", "$avp(s:rcv)")
# -- xlog modparam("xlog", "buf_size", 8192)
# -- presence params -- modparam("presence|presence_xml|usrloc", "db_url", "mysql://openser:Don'tBother@127.0.0.1/openser") modparam("presence", "max_expires", 3600) modparam("presence_xml", "force_active", 1) modparam("presence", "server_address", "sip:127.0.0.1:5060" )
# --- main routing logic route{ xlog("***start***\n"); xlog("***$fd $si***\n"); if (!mf_process_maxfwd_header("10")) { sl_send_reply("483","Too Many Hops"); xlog("***end - Too Many Hops"); exit; }; if (msg:len >= 2048 ) { sl_send_reply("513", "Message too big"); xlog("***end - Too big"); exit; };
# NAT detection route(2);
if (!method=="REGISTER") { xlog("***route - recordroute\n"); record_route(); } if (loose_route()) { xlog("***route - looseroute\n"); append_hf("P-hint: rr-enforced\r\n"); route(1); };
if (!uri==myself) { xlog("***route - not myself\n"); append_hf("P-hint: outbound\r\n"); route(1); };
if (uri==myself) { if (method=="REGISTER") { xlog("***route - register"); if (!www_authorize("openser.org", "subscriber")) { xlog("***route - challenging"); www_challenge("openser.org", "0"); exit; };
if (isflagset(5)) { xlog("***route - isflagset(5)"); setflag(6); # if you want OPTIONS natpings uncomment next # setflag(7); }; save("location"); xlog("***route - registered"); exit; };
if (!lookup("location")) { sl_send_reply("404", "Not Found"); xlog("***route - 404, Not found"); exit; }; append_hf("P-hint: usrloc applied\r\n"); };
route(1); xlog("***end***\n"); }
route[1] { xlog("***route1***\n"); if (subst_uri('/(sip:.*);nat=yes/\1/')){ xlog("***route[1] - setflag(6)"); setflag(6); };
if (isflagset(5)||isflagset(6)||isflagset(7)) { xlog("***route[1] - route(3)"); route(3); }
add_uri_param("transport=tcp");
if (!t_relay()) { xlog("***route[1] - error"); sl_reply_error(); }; xlog("***end - route[1]"); exit; }
route[2]{ xlog("***route2***\n"); force_rport(); # if (nat_uac_test("19")) { if (nat_uac_test("0")) { xlog("***route2 - nat_uac_test(19)\n"); if (method=="REGISTER") { xlog("***route2 - fix nated register\n"); fix_nated_register(); } else { xlog("***route2 - fix nated contact\n"); fix_nated_contact(); }; setflag(5); } else { #local network setflag(7); }; }
route[3] { xlog("***route3***\n"); if (is_method("BYE|CANCEL")) { xlog("***route3 - unforce\n"); unforce_rtp_proxy(); } else if (is_method("INVITE")){ xlog("***route3 - force\n"); if (isflagset(7)) { force_rtp_proxy("i"); } else { force_rtp_proxy(); } t_on_failure("1"); }; if (isflagset(5)) { xlog("***route3 - isflagset(5)\n"); if (!isflagset(7)) { search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes'); } } t_on_reply("1"); }
failure_route[1] { xlog("***failureroute1***\n"); if (isflagset(6) || isflagset(5) || isflagset(7)) { xlog("***failroute1 - unforce\n"); unforce_rtp_proxy(); } }
onreply_route[1] { xlog("***onreplyroute1***\n"); if ((isflagset(5) || isflagset(6) || isflagset(7)) && status=~"(183)|(2[0-9][0-9])") { xlog("***onreplyroute1 - force\n"); if (isflagset(7)) { force_rtp_proxy("i"); } else { force_rtp_proxy(); } } if (!isflagset(7)) { search_append('Contact:.*sip:[^>[:cntrl:]]*', ';nat=yes'); } if (isflagset(6)) { xlog("***onreplyroute1 - contact\n"); fix_nated_contact(); } xlog("***end - onreplyrout[1]"); exit; }
Eric
-----Original Message----- From: Robert Dyck [mailto:rob.dyck@telus.net] Sent: Friday, February 15, 2008 4:23 PM To: Eric Phetteplace Cc: users@lists.openser.org Subject: Re: [OpenSER-Users] OpenSerand RTPProxy, no RTP audio
The example script you are using and maybe all the example scripts were written from the perspective of a service provider. The idea is to detect users who had to pass through a NAT to reach openser. The contact information that these users provide cannot be relied upon so openser needs to work around the misinformation. The NAT is of no concern when calling between local phones.
In my case I use openser as an ALG and for local calling. I make no attempt to test whether any user is behind a NAT. A local origination is determined by
# Check if package originates from LAN if (src_ip==192.168.1.0/255.255.255.0) { } else { }
Is this generally what you are trying to accomplish?