<html><head><style type="text/css"><!-- DIV {margin:0px;} --></style></head><body><div style="font-family:tahoma,new york,times,serif;font-size:10pt"><div>Thank you Luciano for your answer but doesn't it still work me, do the calls enter me of the pstn and don't I listen anything... where I can look for? , there will be some of form so that the IP of where the calls come from
asterisk does not use mediaproxy, somebody has an example.<br><br>any help is appreciated..&nbsp; <br>&nbsp; <br>thank you<br><br>rickygm <br></div><div style="font-family: tahoma,new york,times,serif; font-size: 10pt;"><br><div style="font-family: times new roman,new york,times,serif; font-size: 12pt;"><font size="2" face="Tahoma"><hr size="1"><b><span style="font-weight: bold;">From:</span></b> luzango mfupe &lt;luzango.mfupe@gmail.com&gt;<br><b><span style="font-weight: bold;"></span></b><b><span style="font-weight: bold;">Sent:</span></b> Friday, October 31, 2008 5:19:25 AM<br><b><span style="font-weight: bold;">Subject:</span></b> Re: [Kamailio-Users] I don't have asterisk audio to openser - mediaproxy<br></font><br>
Hi Ricky,<br>I think you should&nbsp; increase the mediaproxy natping interval to 30 and then add use_media_proxy() line after you setflag(6). check below:---<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\r\n");<br>fix_contact();<br>setbflag(6);<br><b><span style="color: rgb(51, 102, 255);">USE MEDIA PROXY HERE---&gt; use_media_proxy();</span><br style="color: rgb(51, 102, 255);">
</b><span style="color: rgb(0, 0, 0);">};</span><br>route(1);<br>} else {<br>sl_send_reply("404", "Not here");<br>}<br>exit;<br>}<br><br><div class="gmail_quote">On Fri, Oct 31, 2008 at 5:21 AM, Ricky Gutierrez <span dir="ltr">&lt;<a rel="nofollow" ymailto="mailto:xserverlinux@yahoo.com" target="_blank" href="mailto:xserverlinux@yahoo.com">xserverlinux@yahoo.com</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;"><div><div style="font-family: tahoma,new york,times,serif; font-size: 10pt;"><div><br></div>
<div style="font-family: tahoma,new york,times,serif; font-size: 10pt;">I show you here my openser.cfg<br><br>my best regards <br><br>rickygm<br><br><pre>loadmodule "<a target="_blank" href="http://nathelper.so">nathelper.so</a>"<br>loadmodule "<a target="_blank" href="http://mediaproxy.so">mediaproxy.so</a>"<br>
</pre><br><pre>modparam("registrar", "received_avp", "$avp(i:42)")<br>modparam("usrloc", "db_mode",   2)<br>modparam("usrloc", "nat_bflag", 4)<br></pre>
modparam("nathelper","rtpproxy_sock", "")<br><pre>modparam("nathelper","natping_interval", 0)<br>modparam("nathelper","received_avp", "$avp(i:42)")<br>
modparam("mediaproxy","natping_interval",20)<br>modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock")<br>modparam("mediaproxy", "mediaproxy_socket", "/var/run/proxydispatcher.sock")<br> <div class="Ih2E3d"><br>modparam("mediaproxy","sip_asymmetrics","/etc/openser/sip-clients")<br>modparam("mediaproxy","rtp_asymmetrics","/ect/openser/rtp-clients")<br>
</div></pre><br><pre>route{<br># initial sanity checks -- messages with<br># max_forwards==0, or excessively long requests<br>                if (!mf_process_maxfwd_header("10")) {<br>                sl_send_reply("483","Too Many Hops");<br>
                        exit;<br>                                };<br>                if (msg:len &gt;= 2048 ) {<br>                sl_send_reply("513", "Message too big");<br>                        exit;<br>                        };<br># we record-route all messages -- to make sure that<br># subsequent messages will go through our proxy; that's<br>
# particularly good if upstream and downstream entities<br># use different transport protocol<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>                if (has_totag()) {<br># subsequent messages withing a dialog should take the<br># path determined by<br> record-routing<br>                if (loose_route()) {<br>                        if(method=="BYE") {<br>                            #Account BYE transactions<br>                            setflag(2);<br>                };<br>                if (method=="INVITE" &amp;&amp; (!allow_trusted())) {<br>                        if (!proxy_authorize("","subscriber")) {<br>
                        proxy_challenge("","0");<br>                                exit;<br>                        } else if (!check_from()) {<br>                                sl_send_reply("403", "Forbidden, use From=ID");<br>                                exit;<br><br>                                };<br><br>                        };<br>                                if(method=="BYE" || method=="CANCEL") {<br>
                            end_media_session();<br>                                };<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\r\n");<br>
                                fix_contact();<br>                                        setbflag(6);<br>                    };            <br>                                route(1);<br>                                } else {<br>                                 sl_send_reply("404", "Not here");<br>                        }<br>                                exit;<br>                        }<br>
        <br>                ##Loose_route packets<br>                    if<br> (loose_route()) {<br>                                if(!has_totag()){<br>                    sl_send_reply("403", "Initial Loose-Routing Rejected");<br>                    exit;<br>                };<br>        <br>        <br>        route(1);<br>
    };<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>                        t_check_trans();<br><br>if (method=="REGISTER"){<br>
                        route(2);<br>                        } else {<br>                                route(3);<br>                                };<br>                        }<br><br>                route[1] {<br># send it out now; use stateful forwarding as it works reliably<br># even for UDP2TCP<br>                        t_on_reply("1");<br>                        t_on_failure("1");<br>
                        if (!t_relay()) {<br>;                        if (method=="INVITE" || method=="ACK") {<br>;                         end_media_session();<br>;                };<br>                <br><br>#                        sl_reply_error();<br>                                };<br>                                exit;<br>                                }<br>        route[2] {<br>#<br># -- Register request handler --<br>
#<br>        if (is_uri_host_local()) {<br>        if (!www_authorize("", "subscriber")) {<br>
        www_challenge("", "0");<br>        exit;<br>        };<br>        if (!check_to()) {<br>                sl_send_reply("403", "Forbidden");<br>                exit;<br>        };<br>         sl_send_reply("100", "Trying");<br>
         if(!search("^Contact:[ ]*\*") &amp;&amp; client_nat_test("7")) {<br>            setbflag(6);<br>            fix_nated_register();<br>            force_rport();<br>        };<br><br>                save("location");<br>
                        exit;<br>        } else if {<br>                sl_send_reply("403", "Forbidden");<br>                };<br>        }<br><br>        route[3] {<br>#<br># -- INVITE request handler --<br>#<br>                if (method=="INVITE") {<br>        # Account INVITE packets<br>
                 setflag(2);<br>                  # Account Missed calls<br>          setflag(3);<br>};<br>                if (is_from_local()){<br># From an internal domain -&gt; check the credentials and the FROM<br>                if(!allow_trusted()){<br>                if (!proxy_authorize("","subscriber")) {<br>
                proxy_challenge("","0");<br>                exit;<br>                        } else if (!check_from()) {<br>                        sl_send_reply("403", "Forbidden, use From=ID");<br>                exit;<br>
        };<br><br>};<br>            if (client_nat_test("3")) {<br>            append_hf("P-hint: route(3)|setflag7,forcerport,fix_contact\r\n");<br>            setbflag(7);<br>            force_rport();<br>            fix_contact();<br>
        };<br>                        <br>                if(avp_db_load("$ru/username","$avp(s:callfwd)")) {<br>                avp_pushto("$ru", "$avp(s:callfwd)");<br>                route(4);<br>                route(1);<br>                <br>                        exit;<br>                                }<br><br>
consume_credentials();<br><br>                # Verify aliases<br>                        lookup("aliases");<br>                if (is_uri_host_local()) {<br>        # -- Inbound to Inbound<br><br>                route(10);<br>                        } else {<br># -- Inbound to outbound<br>                route(11);<br>
                };<br><br>        } else {<br># From an external domain -&gt; do not check credentials<br>#Verify aliases, if found replace R-URI.<br>                        lookup("aliases");<br>                                if (is_uri_host_local()) {<br>                #-- Outbound to inbound<br>
                        route(12);<br>                                } else {<br>        # -- Outbound to outbound<br>                                route(13);<br>                                        };<br>                                };<br>                        }<br>        route[6] {<br>   <br> #<br>    # -- NAT handling --<br>    #<br>    if (isbflagset(6) || isbflagset(7)) {<br>        append_hf("P-hint: Route[6]: mediaproxy \r\n");<br>        use_media_proxy();<br>    };<br>}<br><br>                route[10] {<br>
                #from an internal domain -&gt; inbound<br>        #Native SIP destinations are handled using the location table<br>        append_hf("P-hint: inbound-&gt;inbound \r\n");<br>        if (uri=~"^sip:[2346578][0-9]{6}@.*") {<br>
         if (is_user_in("credentials", "local")){        <br>#        rewritehostport("<a rel="nofollow" target="_blank"  href="http://192.168.10.1:5070">192.168.10.1:5070</a>");<br>        route(6);<br>        route(4);<br>        exit;<br>        } else { <br>
                sl_send_reply("403", "No tienes permiso para llamadas locales");<br>                exit;<br>                        };<br>                                };<br><br>if (!lookup("location")) {<br>                if (does_uri_exist()) {<br>                revert_uri();<br>                prefix("u");<br>
                rewritehostport("<a rel="nofollow" target="_blank"  href="http://192.168.10.1:5070">192.168.10.1:5070</a>");<br>                route(6);<br>                route(1);<br>                } else {<br>                sl_send_reply("404", "Not Found");<br>        exit;<br>
        };<br>                sl_send_reply("404", "Not Found");<br>                exit;<br>                };        <br>
        <br>                route(6);        <br>                route(1);<br>        }<br><br>        route[11] {<br># from an internal domain -&gt; outbound<br># Simply route the call outbound using DNS search<br>        append_hf("P-hint: inbound-&gt;outbound \r\n");<br>
        route(1);<br>        }<br>        route[12] {<br># From an external domain -&gt; inbound<br># Verify aliases, if found replace R-URI.<br>        lookup("aliases");<br>        if (!lookup("location")) {<br>        sl_send_reply("404", "Not Found");<br>
        exit;<br>        };<br>        route(1);<br>        }<br>        route[13] {<br>#From an external domain outbound<br>#we are not accepting these calls<br>        append_hf("P-hint: outbound-&gt;inbound \r\n");<br>        sl_send_reply("403", "Forbidden");<br>
        exit;<br>        }<br><br>        <br>        route[4] {<br>        rewritehostport("<a rel="nofollow" target="_blank"  href="http://192.168.10.1:5070">192.168.10.1:5070</a>");<br>        route(1);<br><br>}<br><br>### aqui se detecta cunado una llamada es no disponible , ocupada o falla<br>
failure_route[1] {<br>        if (t_was_cancelled()) {<br>        exit;<br>};<br><br>        if (t_check_status("486")) {<br>        revert_uri();<br>
        prefix("b");<br>        xlog("L_ERR","Stepped into the 486 ruri=&lt;$ru&gt;");<br>        rewritehostport("<a rel="nofollow" target="_blank"  href="http://192.168.10.1:5070">192.168.10.1:5070</a>");<br>        append_branch();<br>
        route(1);<br>        exit;<br>};<br>        if (t_check_status("408") || t_check_status("480")) {<br>        revert_uri();<br>        prefix("u");<br>        xlog("L_ERR","Stepped into the 480 ruri=&lt;$ru&gt;");<br>
        rewritehostport("<a rel="nofollow" target="_blank"  href="http://192.168.10.1:5070">192.168.10.1:5070</a>");<br>        append_branch();<br>        route(1);<br>        exit;<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_nated_contact();<br>        };<br><br>        if ((isbflagset(6) || isbflagset(7)) &amp;&amp; (status=~"(180)|(183)|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>      <br> exit;<br>}<br><br><br><br><br></pre><br></div></div><br>



      </div></blockquote></div><br><br clear="all"><br>-- <br>Luzango Mfupe<br>TUUNE MOBILE<br>Tel:0128440528/0123825710<br>Tshwane-RSA<br><br>"...Ships are safe in harbor, but they were never meant to stay there......."<br>

</div></div></div><br>



      </body></html>