[Kamailio-Users] I don't have asterisk audio to openser - mediaproxy
luzango mfupe
luzango.mfupe at gmail.com
Fri Oct 31 12:19:25 CET 2008
Hi Ricky,
I think you should increase the mediaproxy natping interval to 30 and then
add use_media_proxy() line after you setflag(6). check below:---
##Detect requests in the dialog behind NAT and flag with 6
if(nat_uac_test("19") || search("^Route:.*;nat=yes")){
append_hf("P-hint: LR|fixcontact,setflag6\r\n");
fix_contact();
setbflag(6);
*USE MEDIA PROXY HERE---> use_media_proxy();
*};
route(1);
} else {
sl_send_reply("404", "Not here");
}
exit;
}
On Fri, Oct 31, 2008 at 5:21 AM, Ricky Gutierrez <xserverlinux at yahoo.com>wrote:
>
> I show you here my openser.cfg
>
> my best regards
>
> rickygm
>
> loadmodule "nathelper.so"
> loadmodule "mediaproxy.so"
>
>
> modparam("registrar", "received_avp", "$avp(i:42)")
> modparam("usrloc", "db_mode", 2)
> modparam("usrloc", "nat_bflag", 4)
>
> modparam("nathelper","rtpproxy_sock", "")
>
> modparam("nathelper","natping_interval", 0)
> modparam("nathelper","received_avp", "$avp(i:42)")
> modparam("mediaproxy","natping_interval",20)
> modparam("mediaproxy","mediaproxy_socket", "/var/run/mediaproxy.sock")
> modparam("mediaproxy", "mediaproxy_socket", "/var/run/proxydispatcher.sock")
>
> modparam("mediaproxy","sip_asymmetrics","/etc/openser/sip-clients")
> modparam("mediaproxy","rtp_asymmetrics","/ect/openser/rtp-clients")
>
>
> route{
> # initial sanity checks -- messages with
> # max_forwards==0, or excessively long requests
> if (!mf_process_maxfwd_header("10")) {
> sl_send_reply("483","Too Many Hops");
> exit;
> };
> if (msg:len >= 2048 ) {
> sl_send_reply("513", "Message too big");
> exit;
> };
> # we record-route all messages -- to make sure that
> # subsequent messages will go through our proxy; that's
> # particularly good if upstream and downstream entities
> # use different transport protocol
> if (!is_method("REGISTER")) {
> if(nat_uac_test("19")){
> record_route(";nat=yes");
> } else {
> record_route();
> };
> };
>
> if (has_totag()) {
> # subsequent messages withing a dialog should take the
> # path determined by
> record-routing
> if (loose_route()) {
> if(method=="BYE") {
> #Account BYE transactions
> setflag(2);
> };
> if (method=="INVITE" && (!allow_trusted())) {
> if (!proxy_authorize("","subscriber")) {
> proxy_challenge("","0");
> exit;
> } else if (!check_from()) {
> sl_send_reply("403", "Forbidden, use From=ID");
> exit;
>
> };
>
> };
> if(method=="BYE" || method=="CANCEL") {
> end_media_session();
> };
>
> ##Detect requests in the dialog behind NAT and flag with 6
> if(nat_uac_test("19") || search("^Route:.*;nat=yes")){
> append_hf("P-hint: LR|fixcontact,setflag6\r\n");
> fix_contact();
> setbflag(6);
> };
> route(1);
> } else {
> sl_send_reply("404", "Not here");
> }
> exit;
> }
>
> ##Loose_route packets
> if
> (loose_route()) {
> if(!has_totag()){
> sl_send_reply("403", "Initial Loose-Routing Rejected");
> exit;
> };
>
>
> route(1);
> };
>
>
> #CANCEL processing
> if (is_method("CANCEL")) {
> if (t_check_trans()) {
> end_media_session();
> t_relay();
> };
> exit;
> }
> t_check_trans();
>
> if (method=="REGISTER"){
> route(2);
> } else {
> route(3);
> };
> }
>
> route[1] {
> # send it out now; use stateful forwarding as it works reliably
> # even for UDP2TCP
> t_on_reply("1");
> t_on_failure("1");
> if (!t_relay()) {
> ; if (method=="INVITE" || method=="ACK") {
> ; end_media_session();
> ; };
>
>
> # sl_reply_error();
> };
> exit;
> }
> route[2] {
> #
> # -- Register request handler --
> #
> if (is_uri_host_local()) {
> if (!www_authorize("", "subscriber")) {
>
> www_challenge("", "0");
> exit;
> };
> if (!check_to()) {
> sl_send_reply("403", "Forbidden");
> exit;
> };
> sl_send_reply("100", "Trying");
> if(!search("^Contact:[ ]*\*") && client_nat_test("7")) {
> setbflag(6);
> fix_nated_register();
> force_rport();
> };
>
> save("location");
> exit;
> } else if {
> sl_send_reply("403", "Forbidden");
> };
> }
>
> route[3] {
> #
> # -- INVITE request handler --
> #
> if (method=="INVITE") {
> # Account INVITE packets
> setflag(2);
> # Account Missed calls
> setflag(3);
> };
> if (is_from_local()){
> # From an internal domain -> check the credentials and the FROM
> if(!allow_trusted()){
> if (!proxy_authorize("","subscriber")) {
> proxy_challenge("","0");
> exit;
> } else if (!check_from()) {
> sl_send_reply("403", "Forbidden, use From=ID");
> exit;
>
> };
>
> };
> if (client_nat_test("3")) {
> append_hf("P-hint: route(3)|setflag7,forcerport,fix_contact\r\n");
> setbflag(7);
> force_rport();
> fix_contact();
> };
>
> if(avp_db_load("$ru/username","$avp(s:callfwd)")) {
> avp_pushto("$ru", "$avp(s:callfwd)");
> route(4);
> route(1);
>
> exit;
> }
>
> consume_credentials();
>
> # Verify aliases
> lookup("aliases");
> if (is_uri_host_local()) {
> # -- Inbound to Inbound
>
> route(10);
> } else {
> # -- Inbound to outbound
> route(11);
> };
>
> } else {
> # From an external domain -> do not check credentials
> #Verify aliases, if found replace R-URI.
> lookup("aliases");
> if (is_uri_host_local()) {
> #-- Outbound to inbound
> route(12);
> } else {
> # -- Outbound to outbound
> route(13);
> };
> };
> }
> route[6] {
>
> #
> # -- NAT handling --
> #
> if (isbflagset(6) || isbflagset(7)) {
> append_hf("P-hint: Route[6]: mediaproxy \r\n");
> use_media_proxy();
> };
> }
>
> route[10] {
> #from an internal domain -> inbound
> #Native SIP destinations are handled using the location table
> append_hf("P-hint: inbound->inbound \r\n");
> if (uri=~"^sip:[2346578][0-9]{6}@.*") {
> if (is_user_in("credentials", "local")){
> # rewritehostport("192.168.10.1:5070");
> route(6);
> route(4);
> exit;
> } else {
> sl_send_reply("403", "No tienes permiso para llamadas locales");
> exit;
> };
> };
>
> if (!lookup("location")) {
> if (does_uri_exist()) {
> revert_uri();
> prefix("u");
> rewritehostport("192.168.10.1:5070");
> route(6);
> route(1);
> } else {
> sl_send_reply("404", "Not Found");
> exit;
> };
> sl_send_reply("404", "Not Found");
> exit;
> };
>
>
> route(6);
> route(1);
> }
>
> route[11] {
> # from an internal domain -> outbound
> # Simply route the call outbound using DNS search
> append_hf("P-hint: inbound->outbound \r\n");
> route(1);
> }
> route[12] {
> # From an external domain -> inbound
> # Verify aliases, if found replace R-URI.
> lookup("aliases");
> if (!lookup("location")) {
> sl_send_reply("404", "Not Found");
> exit;
> };
> route(1);
> }
> route[13] {
> #From an external domain outbound
> #we are not accepting these calls
> append_hf("P-hint: outbound->inbound \r\n");
> sl_send_reply("403", "Forbidden");
> exit;
> }
>
>
> route[4] {
> rewritehostport("192.168.10.1:5070");
> route(1);
>
> }
>
> ### aqui se detecta cunado una llamada es no disponible , ocupada o falla
> failure_route[1] {
> if (t_was_cancelled()) {
> exit;
> };
>
> if (t_check_status("486")) {
> revert_uri();
>
> prefix("b");
> xlog("L_ERR","Stepped into the 486 ruri=<$ru>");
> rewritehostport("192.168.10.1:5070");
> append_branch();
> route(1);
> exit;
> };
> if (t_check_status("408") || t_check_status("480")) {
> revert_uri();
> prefix("u");
> xlog("L_ERR","Stepped into the 480 ruri=<$ru>");
> rewritehostport("192.168.10.1:5070");
> append_branch();
> route(1);
> exit;
> };
> }
> onreply_route[1] {
> #
> #-- On-replay block routing --
> #
> if (client_nat_test("1")) {
> append_hf("P-hint: Onreply-route - fixcontact \r\n");
> fix_nated_contact();
> };
>
> if ((isbflagset(6) || isbflagset(7)) && (status=~"(180)|(183)|2[0-9][0-9]")) {
> if (search("^Content-Type:[ ]*application/sdp")) {
> append_hf("P-hint: onreply_route|usemediaproxy \r\n");
> use_media_proxy();
> };
> };
>
> exit;
> }
>
>
>
>
>
>
>
--
Luzango Mfupe
TUUNE MOBILE
Tel:0128440528/0123825710
Tshwane-RSA
"...Ships are safe in harbor, but they were never meant to stay
there......."
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.kamailio.org/pipermail/users/attachments/20081031/2e48e6fa/attachment.htm
More information about the Users
mailing list