Opensips is a great product, but I have been having problem in configuring the nat traversal + rtpproxy with opensips and have spent about a week on this. I am a novice in this... when opensips runs with the following opensips.cfg relevant portions -- it raises the following rtpproxy problem: <br>
<br>"ERROR:rtpproxy:select_rtpp_node: script error -no valid set selected"<br>"ERROR:rtpproxy:force_rtp_proxy: no available proxies"<br><br>#-------- nat_traversal params -----<br>modparam("nat_traversal", "keepalive_interval", 30)<br>
modparam("nat_traversal", "keepalive_method", "OPTIONS")<br>modparam("nat_traversal", "keepalive_from", "sip:keepalive@a.b.c.d")<br>modparam("nat_traversal", "keepalive_state_file", "/var/run/opensips/keepalive_state")<br>
<br>#ak# --- rtpproxy -----<br># single rtproxy with specific weight<br>modparam("rtpproxy", "rtpproxy_sock", "udp:localhost:9999")<br>modparam("rtpproxy", "nortpproxy_str", "a=sdpmangled:yes\r\n")<br>
modparam("rtpproxy", "db_url", "mysql://opensips:opensipsrw@localhost/opensips")<br>#modparam("rtpproxy", "db_table", "nh_rtpp")<br>modparam("rtpproxy", "rtpp_socket_col", "rtpproxy_sock")<br>
<br><br>####### Routing Logic ########<br><br><br># main request routing logic<br><br>route{<br> ####nat_traversal info<br> force_rport();<br> if (client_nat_test("7")) {<br> fix_contact();<br>
setflag(5);<br> }<br><br> if ((method=="REGISTER" || method=="SUBSCRIBE" ||<br> (method=="INVITE" && !has_totag())) && client_nat_test("7"))<br>
{<br> nat_keepalive();<br> }<br> ####nat_traversal info ends<br><br> if (!mf_process_maxfwd_header("10")) {<br> sl_send_reply("483","Too Many Hops");<br>
exit;<br> }<br><br> ##ak#<br> if ((is_method("INVITE")) && has_totag()) { #(has_body("application/sdp"))) {<br> engage_rtp_proxy();<br> }<br>
<br> if (has_totag()) {<br> # sequential request withing a dialog should<br> # take the path determined by record-routing<br> if (loose_route()) {<br> if (is_method("BYE")) {<br>
setflag(1); # do accounting ...<br> setflag(3); # ... even if the transaction fails<br> } else if (is_method("INVITE")) {<br>
# even if in most of the cases is useless, do RR for<br> # re-INVITEs alos, as some buggy clients do change route set<br> # during the dialog.<br>
record_route();<br> }<br> # route it out to whatever destination was set by loose_route()<br> # in $du (destination URI).<br>
route(1);<br> } else {<br> /* uncomment the following lines if you want to enable presence */<br>##if (is_method("SUBSCRIBE") && $rd == "your.server.ip.address") {<br>
## # in-dialog subscribe requests<br> ## route(2);<br> ## exit;<br> ##}<br> if ( is_method("ACK") ) {<br>
if ( t_check_trans() ) {<br> # non loose-route, but stateful ACK; must be an ACK after<br> # a 487 or e.g. 404 from upstream server<br>
t_relay();<br> exit;<br> } else {<br> # ACK without matching transaction -><br>
# ignore and discard<br> exit;<br> }<br> }<br> sl_send_reply("404","Not here");<br>
}<br> exit;<br> }<br><br> #initial requests<br><br> # CANCEL processing<br> if (is_method("CANCEL"))<br> {<br> if (t_check_trans())<br>
t_relay();<br> #unforce_rtpproxy();<br> exit;<br> }<br><br> t_check_trans();<br><br># preloaded route checking<br> if (loose_route()) {<br> xlog("L_ERR",<br>
"Attempt to route with preloaded Route's [$fu/$tu/$ru/$ci]");<br> if (!is_method("ACK"))<br> sl_send_reply("403","Preload Route denied");<br>
exit;<br> }<br><br> # record routing<br> if (!is_method("REGISTER|MESSAGE"))<br> record_route();<br><br> # account only INVITEs<br> if (is_method("INVITE")) {<br>
setflag(1); # do accounting<br> }<br> if (!uri==myself)<br> ## replace with following line if multi-domain support is used<br> ##if (!is_uri_host_local())<br> {<br> append_hf("P-hint: outbound\r\n");<br>
# if you have some interdomain connections via TLS<br> ##if($rd=="<a href="http://tls_domain1.net">tls_domain1.net</a>") {<br> ## t_relay("tls:<a href="http://domain1.net">domain1.net</a>");<br>
## exit;<br> ##} else if($rd=="<a href="http://tls_domain2.net">tls_domain2.net</a>") {<br> ## t_relay("tls:<a href="http://domain2.net">domain2.net</a>");<br>
## exit;<br> ##}<br> route(1);<br> }<br><br> # requests for my domain<br><br> ## uncomment this if you want to enable presence server<br> ## and comment the next 'if' block<br>
## NOTE: uncomment also the definition of route[2] from below<br> ##if( is_method("PUBLISH|SUBSCRIBE"))<br> ## route(2);<br><br> if (is_method("PUBLISH"))<br>
{<br> sl_send_reply("503", "Service Unavailable");<br> exit;<br> }<br><br><br> if (is_method("REGISTER"))<br> {<br> # authenticate the REGISTER requests (uncomment to enable auth)<br>
##if (!www_authorize("", "subscriber"))<br>##{<br> ## www_challenge("", "0");<br> ## exit;<br> ##}<br> ##<br>
##if (!db_check_to())<br> ##{<br> ## sl_send_reply("403","Forbidden auth ID");<br> ## exit;<br> ##}<br><br> #---- Request is behind NAT(flag5) save with bflag 6 ----#<br>
#---- Use bflag 7 to start SIP pinging (Options) ----#<br> if (isflagset(5)) {<br> setbflag(6);<br> setbflag(7);<br> };<br><br>
if (!save("location"))<br> sl_reply_error();<br><br> exit;<br> }<br><br> if ($rU==NULL) {<br> # request with no Username in RURI<br>
sl_send_reply("484","Address Incomplete");<br> exit;<br> }<br><br> # apply DB based aliases (uncomment to enable)<br> ##alias_db_lookup("dbaliases");<br>
if (!lookup("location","m")) {<br> switch ($retcode) {<br> case -1:<br> case -3:<br> t_newtran();<br> t_reply("404", "Not Found");<br>
exit;<br> case -2:<br> sl_send_reply("405", "Method Not Allowed");<br> exit;<br> }<br>
}<br><br> # when routing via usrloc, log the missed calls also<br> setflag(2);<br><br> route(1);<br>}<br><br><br>route[1] {<br> # for INVITEs enable some additional helper routes<br><br>
#---- RTP Proxy handling ---#<br> if (is_method("BYE|CANCEL")) {<br> unforce_rtp_proxy();<br> } else if (is_method("INVITE")){<br> #---- Activates the RTP Proxy for the CALLEE ---#<br>
rtpproxy_offer();<br> };<br> #ak## catch and fix replies<br> #ak#t_on_reply("2");<br><br> if (is_method("INVITE")) {<br> t_on_branch("2");<br>
t_on_reply("2");<br> t_on_failure("1");<br> }<br><br> if (!t_relay()) {<br> sl_reply_error();<br> };<br> exit;<br>}<br><br>branch_route[2] {<br>
if (client_nat_test("3")) {<br> fix_contact();<br> }<br><br> xlog("new branch at $ru\n");<br>}<br><br><br>onreply_route[2] {<br> if (client_nat_test("7")) {<br>
fix_contact();<br> if ( is_method("INVITE") && has_body("application/sdp") ){<br> ######ak# (isflagset(5) || isbflagset(6)) &&<br> rtpproxy_answer();<br>
}<br> }<br> xlog("incoming reply\n");<br>}<br><br><br>failure_route[1] {<br><br> if (t_was_cancelled()) {<br> exit;<br> }<br><br> # uncomment the following lines if you want to block client<br>
# redirect based on 3xx replies.<br> ##if (t_check_status("3[0-9][0-9]")) {<br> ##t_reply("404","Not found");<br> ## exit;<br> ##}<br><br> # uncomment the following lines if you want to redirect the failed<br>
# calls to a different new destination<br> ##if (t_check_status("486|408")) {<br> ## sethostport("<a href="http://192.168.2.100:5060">192.168.2.100:5060</a>");<br> ## # do not set the missed call flag again<br>
## t_relay();<br> ##}<br>}<br><br><br><br><br><br>