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>&quot;ERROR:rtpproxy:select_rtpp_node: script error -no valid set selected&quot;<br>&quot;ERROR:rtpproxy:force_rtp_proxy: no available proxies&quot;<br><br>#-------- nat_traversal params -----<br>modparam(&quot;nat_traversal&quot;, &quot;keepalive_interval&quot;, 30)<br>
modparam(&quot;nat_traversal&quot;, &quot;keepalive_method&quot;, &quot;OPTIONS&quot;)<br>modparam(&quot;nat_traversal&quot;, &quot;keepalive_from&quot;, &quot;sip:keepalive@a.b.c.d&quot;)<br>modparam(&quot;nat_traversal&quot;, &quot;keepalive_state_file&quot;, &quot;/var/run/opensips/keepalive_state&quot;)<br>
<br>#ak# --- rtpproxy -----<br># single rtproxy with specific weight<br>modparam(&quot;rtpproxy&quot;, &quot;rtpproxy_sock&quot;, &quot;udp:localhost:9999&quot;)<br>modparam(&quot;rtpproxy&quot;, &quot;nortpproxy_str&quot;, &quot;a=sdpmangled:yes\r\n&quot;)<br>
modparam(&quot;rtpproxy&quot;, &quot;db_url&quot;, &quot;mysql://opensips:opensipsrw@localhost/opensips&quot;)<br>#modparam(&quot;rtpproxy&quot;, &quot;db_table&quot;, &quot;nh_rtpp&quot;)<br>modparam(&quot;rtpproxy&quot;, &quot;rtpp_socket_col&quot;, &quot;rtpproxy_sock&quot;)<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(&quot;7&quot;)) {<br>                fix_contact();<br>
                setflag(5);<br>        }<br><br>        if ((method==&quot;REGISTER&quot; || method==&quot;SUBSCRIBE&quot; ||<br>                (method==&quot;INVITE&quot; &amp;&amp; !has_totag())) &amp;&amp; client_nat_test(&quot;7&quot;))<br>
        {<br>                nat_keepalive();<br>        }<br>        ####nat_traversal info ends<br><br>        if (!mf_process_maxfwd_header(&quot;10&quot;)) {<br>                sl_send_reply(&quot;483&quot;,&quot;Too Many Hops&quot;);<br>
                exit;<br>        }<br><br>        ##ak#<br>        if ((is_method(&quot;INVITE&quot;)) &amp;&amp; has_totag()) { #(has_body(&quot;application/sdp&quot;))) {<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(&quot;BYE&quot;)) {<br>
                                setflag(1); # do accounting ...<br>                                setflag(3); # ... even if the transaction fails<br>                        } else if (is_method(&quot;INVITE&quot;)) {<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(&quot;SUBSCRIBE&quot;) &amp;&amp; $rd == &quot;your.server.ip.address&quot;) {<br>
                        ##      # in-dialog subscribe requests<br>                        ##      route(2);<br>                        ##      exit;<br>                        ##}<br>                        if ( is_method(&quot;ACK&quot;) ) {<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 -&gt;<br>
                                        # ignore and discard<br>                                        exit;<br>                                }<br>                        }<br>                        sl_send_reply(&quot;404&quot;,&quot;Not here&quot;);<br>
                }<br>                exit;<br>        }<br><br>        #initial requests<br><br>        # CANCEL processing<br>        if (is_method(&quot;CANCEL&quot;))<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(&quot;L_ERR&quot;,<br>
                &quot;Attempt to route with preloaded Route&#39;s [$fu/$tu/$ru/$ci]&quot;);<br>                if (!is_method(&quot;ACK&quot;))<br>                        sl_send_reply(&quot;403&quot;,&quot;Preload Route denied&quot;);<br>
                exit;<br>        }<br><br>        # record routing<br>        if (!is_method(&quot;REGISTER|MESSAGE&quot;))<br>                record_route();<br><br>        # account only INVITEs<br>        if (is_method(&quot;INVITE&quot;)) {<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(&quot;P-hint: outbound\r\n&quot;);<br>
                # if you have some interdomain connections via TLS<br>                ##if($rd==&quot;<a href="http://tls_domain1.net">tls_domain1.net</a>&quot;) {<br>                ##      t_relay(&quot;tls:<a href="http://domain1.net">domain1.net</a>&quot;);<br>
                ##      exit;<br>                ##} else if($rd==&quot;<a href="http://tls_domain2.net">tls_domain2.net</a>&quot;) {<br>                ##      t_relay(&quot;tls:<a href="http://domain2.net">domain2.net</a>&quot;);<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 &#39;if&#39; block<br>
        ##   NOTE: uncomment also the definition of route[2] from  below<br>        ##if( is_method(&quot;PUBLISH|SUBSCRIBE&quot;))<br>        ##              route(2);<br><br>        if (is_method(&quot;PUBLISH&quot;))<br>
        {<br>                sl_send_reply(&quot;503&quot;, &quot;Service Unavailable&quot;);<br>                exit;<br>        }<br><br><br>        if (is_method(&quot;REGISTER&quot;))<br>        {<br>                # authenticate the REGISTER requests (uncomment to enable auth)<br>
                ##if (!www_authorize(&quot;&quot;, &quot;subscriber&quot;))<br>##{<br>                ##      www_challenge(&quot;&quot;, &quot;0&quot;);<br>                ##      exit;<br>                ##}<br>                ##<br>
                ##if (!db_check_to())<br>                ##{<br>                ##      sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<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(&quot;location&quot;))<br>                        sl_reply_error();<br><br>                exit;<br>        }<br><br>        if ($rU==NULL) {<br>                # request with no Username in RURI<br>
                sl_send_reply(&quot;484&quot;,&quot;Address Incomplete&quot;);<br>                exit;<br>        }<br><br>        # apply DB based aliases (uncomment to enable)<br>        ##alias_db_lookup(&quot;dbaliases&quot;);<br>
if (!lookup(&quot;location&quot;,&quot;m&quot;)) {<br>                switch ($retcode) {<br>                        case -1:<br>                        case -3:<br>                                t_newtran();<br>                                t_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>
                                exit;<br>                        case -2:<br>                                sl_send_reply(&quot;405&quot;, &quot;Method Not Allowed&quot;);<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(&quot;BYE|CANCEL&quot;)) {<br>                unforce_rtp_proxy();<br>        } else if (is_method(&quot;INVITE&quot;)){<br>                #---- Activates the RTP Proxy for the CALLEE ---#<br>
                rtpproxy_offer();<br>        };<br>        #ak## catch and fix replies<br>        #ak#t_on_reply(&quot;2&quot;);<br><br>        if (is_method(&quot;INVITE&quot;)) {<br>                t_on_branch(&quot;2&quot;);<br>
                t_on_reply(&quot;2&quot;);<br>                t_on_failure(&quot;1&quot;);<br>        }<br><br>        if (!t_relay()) {<br>                sl_reply_error();<br>        };<br>        exit;<br>}<br><br>branch_route[2] {<br>
        if (client_nat_test(&quot;3&quot;)) {<br>                fix_contact();<br>        }<br><br>        xlog(&quot;new branch at $ru\n&quot;);<br>}<br><br><br>onreply_route[2] {<br>        if (client_nat_test(&quot;7&quot;)) {<br>
                fix_contact();<br>                if ( is_method(&quot;INVITE&quot;) &amp;&amp; has_body(&quot;application/sdp&quot;) ){<br>                        ######ak# (isflagset(5) || isbflagset(6)) &amp;&amp;<br>                        rtpproxy_answer();<br>
                }<br>        }<br>        xlog(&quot;incoming reply\n&quot;);<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(&quot;3[0-9][0-9]&quot;)) {<br>        ##t_reply(&quot;404&quot;,&quot;Not found&quot;);<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(&quot;486|408&quot;)) {<br>        ##      sethostport(&quot;<a href="http://192.168.2.100:5060">192.168.2.100:5060</a>&quot;);<br>        ##      # do not set the missed call flag again<br>
        ##      t_relay();<br>        ##}<br>}<br><br><br><br><br><br>