<div dir="ltr"><div>For engage_rtpproxy there are two flags that are used i.e. i for LAN interface and E for WAN interface. you can use these two flags to specify your direction of bridging. e.g. ie for LAN to WAN bridging and ei for WAN to LAN bridging. Meanwhile look at this documentation for detailed flag usage.<br>
<br><a href="http://www.opensips.org/html/docs/modules/1.8.x/rtpproxy.html#id292744">http://www.opensips.org/html/docs/modules/1.8.x/rtpproxy.html#id292744</a><br><br><br></div>Regards,<br>Qasim<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">On Thu, May 9, 2013 at 4:09 PM, Michele Pinassi <span dir="ltr">&lt;<a href="mailto:michele.pinassi@unisi.it" target="_blank">michele.pinassi@unisi.it</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi all,<br>
<br>
i have an OpenSIPS server with two interface, PUBLIC (xxx) and PRIVATE<br>
(172.20.1.2). The PRIVATE interface works inside a LAN dedicated to<br>
VoIP, with a MediaServer (172.20.1.5) and a Patton Gateway for PSTN<br>
(172.20.1.4).<br>
<br>
Users phone&#39;s can register on both interface and i use RTPProxy (in<br>
bridging mode) to ensure that both side can talk togheter.<br>
<br>
But something don&#39;t work as expected....<br>
<br>
Here&#39;s my OpenSIPS routing logic:<br>
<br>
===========================================<br>
route{<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>
        if (msg:len &gt;=  2048 ) {<br>
            sl_send_reply(&quot;513&quot;, &quot;Message too big&quot;);<br>
            exit;<br>
        };<br>
<br>
        if(is_method(&quot;INVITE&quot;) &amp;&amp; has_totag()) {<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;<a href="http://voip.unisi.it" target="_blank">voip.unisi.it</a>&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>
                exit;<br>
        }<br>
<br>
        t_check_trans();<br>
<br>
        # authenticate if from local subscriber (uncomment to enable auth)<br>
        # authenticate all initial non-REGISTER request that pretend to be<br>
        # generated by local subscriber (domain from FROM URI is local)<br>
        # if (!(method==&quot;REGISTER&quot;) &amp;&amp; from_uri==myself) /*no multidomain version*/<br>
        if (!(method==&quot;REGISTER&quot;) &amp;&amp; is_from_local())  /*multidomain version*/<br>
        {<br>
                if(!check_source_address(&quot;0&quot;)){<br>
                    if (!proxy_authorize(&quot;&quot;, &quot;subscriber&quot;)) {<br>
                        proxy_challenge(&quot;&quot;, &quot;0&quot;);<br>
                        exit;<br>
                    }<br>
                    if (!db_check_from()) {<br>
                        sl_send_reply(&quot;403&quot;,&quot;Forbidden auth ID&quot;);<br>
                        exit;<br>
                    }<br>
<br>
                    consume_credentials();<br>
                    # caller authenticated<br>
                }<br>
        }<br>
<br>
        # preloaded route checking<br>
        if (loose_route()) {<br>
                xlog(&quot;L_ERR&quot;, &quot;Attempt to route with preloaded Route&#39;s<br>
[$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>
                append_hf(&quot;P-hint: outbound\r\n&quot;);<br>
                route(1);<br>
        }<br>
<br>
        if( is_method(&quot;PUBLISH|SUBSCRIBE&quot;)) {<br>
            route(2);<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>
                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>
        # media service number? (digits starting with *)<br>
        if($rU=~&quot;^\*&quot;) {<br>
            route(4);<br>
        }<br>
<br>
        # apply DB based aliases (uncomment to enable)<br>
        alias_db_lookup(&quot;dbaliases&quot;);<br>
<br>
        # do lookup with method filtering<br>
        if (!lookup(&quot;location&quot;,&quot;m&quot;)) {<br>
                switch ($retcode) {<br>
                        case -1: # no contact: route it !<br>
                                cr_user_carrier(&quot;$fU&quot;, &quot;$fd&quot;, &quot;$avp(carrier)&quot;);<br>
                                if($avp(carrier)==0) {<br>
                                    xlog(&quot;L_INFO&quot;,&quot;Not here: default route [$fd/$fu/$rd/$ru/$si]\n&quot;);<br>
                                    # Not here: default route<br>
[<a href="http://172.20.1.4/sip:2425@172.20.1.4:5060/voip.unisi.it/sip:50@voip.unisi.it:5060/172.20.1.4" target="_blank">172.20.1.4/sip:2425@172.20.1.4:5060/voip.unisi.it/sip:50@voip.unisi.it:5060/172.20.1.4</a>]<br>
                                    if($(rU{s.len}) &lt; 4) {<br>
                                        xlog(&quot;L_ERR&quot;, &quot;Number incomplete/failure for $rU\n&quot;);<br>
                                        prefix(&quot;FAIL_&quot;);<br>
                                        route(4);<br>
                                    }<br>
<br>
                                    if(!cr_route(&quot;default&quot;, &quot;$fd&quot;, &quot;$rU&quot;, &quot;$rU&quot;, &quot;call_id&quot;,<br>
&quot;$avp(host)&quot;)) {<br>
                                        xlog(&quot;L_ERR&quot;, &quot;Number not found for $rU\n&quot;);<br>
                                        prefix(&quot;FAIL_&quot;);<br>
                                        route(4);<br>
                                    }<br>
                                } else {<br>
                                    xlog(&quot;L_INFO&quot;,&quot;Not here: user route<br>
[$fd/$fu/$rd/$ru/$si/$avp(carrier)]\n&quot;);<br>
                                    $avp(domain)=&quot;<a href="http://voip.unisi.it" target="_blank">voip.unisi.it</a>&quot;;<br>
                                    if (!cr_route(&quot;$avp(carrier)&quot;, &quot;$avp(domain)&quot;, &quot;$rU&quot;,<br>
&quot;$rU&quot;,&quot;call_id&quot;, &quot;$avp(host)&quot;)) {<br>
                                        sl_send_reply(&quot;404&quot;, &quot;Not found&quot;);<br>
                                        xlog(&quot;L_ERR&quot;, &quot;cr_route failed\n&quot;);<br>
                                        exit;<br>
                                    }<br>
                                }<br>
                                t_on_failure(&quot;1&quot;);<br>
                                if (!t_relay()) {<br>
                                    sl_reply_error();<br>
                                };<br>
                                exit;<br>
                        case -3: # internal error<br>
                                t_newtran();<br>
                                t_reply(&quot;404&quot;, &quot;Not Found&quot;);<br>
                                exit;<br>
                        case -2: # method not supported<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>
route[1] {<br>
        xlog(&quot;L_INFO&quot;,&quot;Route1  [$fd/$fu/$rd/$ru/$si/]\n&quot;);<br>
<br>
        # for INVITEs enable some additional helper routes<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>
<br>
# Presence route<br>
route[2] {<br>
    xlog(&quot;L_INFO&quot;,&quot;Route2  [$fd/$fu/$rd/$ru/$si/]\n&quot;);<br>
<br>
    if (!t_newtran())   {<br>
        sl_reply_error();<br>
        exit;<br>
    };<br>
<br>
    if(is_method(&quot;PUBLISH&quot;)) {<br>
        handle_publish();<br>
    } else if( is_method(&quot;SUBSCRIBE&quot;)) {<br>
        handle_subscribe();<br>
    }<br>
<br>
    exit;<br>
}<br>
<br>
route[4] {<br>
    xlog(&quot;L_INFO&quot;,&quot;Route4  [$fd/$fu/$rd/$ru/$si/]\n&quot;);<br>
<br>
    rewritehostport(&quot;<a href="http://172.20.1.5:5060" target="_blank">172.20.1.5:5060</a>&quot;);<br>
    route(1);<br>
}<br>
<br>
branch_route[2] {<br>
    xlog(&quot;L_INFO&quot;,&quot;Branch Route2  [$fd/$fu/$rd/$ru/$si/]\n&quot;);<br>
}<br>
<br>
onreply_route[2] {<br>
    xlog(&quot;L_INFO&quot;,&quot;OnReply Route2  [$fd/$fu/$rd/$ru/$si/]\n&quot;);<br>
}<br>
<br>
failure_route[1] {<br>
    xlog(&quot;L_INFO&quot;,&quot;Failure Route1  [$fd/$fu/$rd/$ru/$si/]\n&quot;);<br>
<br>
    if (t_was_cancelled()) {<br>
        exit;<br>
    }<br>
<br>
    if (t_check_status(&quot;408|5[0-9][0-9]&quot;)) {<br>
        if(!cr_route(&quot;default&quot;, &quot;$fd&quot;, &quot;$rU&quot;, &quot;$rU&quot;, &quot;call_id&quot;,<br>
&quot;$avp(host)&quot;)){<br>
            t_reply(&quot;403&quot;, &quot;Not allowed&quot;);<br>
        } else {<br>
            t_on_failure(&quot;2&quot;);<br>
            t_relay();<br>
        }<br>
    }<br>
}<br>
<br>
failure_route[2] {<br>
    xlog(&quot;L_INFO&quot;,&quot;Failure Route2  [$fd/$fu/$rd/$ru/$si/]\n&quot;);<br>
<br>
    if (t_was_cancelled()) {<br>
        exit;<br>
    }<br>
<br>
    revert_uri();<br>
    prefix(&quot;FAILURE_&quot;);<br>
    rewritehostport(&quot;<a href="http://172.20.1.5:5060" target="_blank">172.20.1.5:5060</a>&quot;);<br>
    t_relay();<br>
}<br>
===========================================<br>
<br>
and this is the RTPProxy config:<br>
<br>
===========================================<br>
CONTROL_SOCK=udp:<a href="http://127.0.0.1:12221" target="_blank">127.0.0.1:12221</a><br>
<br>
# Additional options that are passed to the daemon.<br>
EXTRA_OPTS=&quot;-l [external IP]/<a href="http://172.20.1.2" target="_blank">172.20.1.2</a>&quot;<br>
===========================================<br>
<br>
Anybody can help me ?<br>
<span class="HOEnZb"><font color="#888888"><br>
Michele<br>
<br>
--<br>
Michele Pinassi<br>
Responsabile Telefonia di Ateneo<br>
Servizio Reti, Sistemi e Sicurezza Informatica - Universitą degli Studi<br>
di Siena<br>
tel: <a href="tel:0577.%2823%292169" value="+92577232169">0577.(23)2169</a> - fax: <a href="tel:0577.%2823%292053" value="+92577232053">0577.(23)2053</a><br>
<br>
Per trovare una soluzione rapida ai tuoi problemi tecnici<br>
consulta le FAQ di Ateneo, <a href="http://www.faq.unisi.it" target="_blank">http://www.faq.unisi.it</a><br>
<br>
</font></span><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>
<br></blockquote></div><br></div>