[OpenSIPS-Users] Problem RTP-proxy

Vandeweyer, Eric eric.vandeweyer at be.verizonbusiness.com
Tue May 26 12:07:54 CEST 2009


 
Hi all,

I have opensips 1.5.1 running and signaling work fine (as far as I know) but I've this problem to get my RTP traffic 
Via the RTP-proxy. Can anyone help me out here 
Many thanks

Eric


########################################################################
# Routing
########################################################################
route
{
	if (msg:len > 2048)
	{
		sl_send_reply("513", "Message Too Big");
		exit;
	};
	if (!mf_process_maxfwd_header("10"))
	{
		sl_send_reply("483", "Too Many Hops");
		exit;
	};
	if (!method=="REGISTER")
	{
                if(nat_uac_test("19"))
		{
		       record_route("nat=yes");
                }
                else
                {
                       record_route();
                };
	};
	if (loose_route())
	{
		append_hf("P-hint: loose_route \r\n");
		if (nat_uac_test ("19") || search("^Route:.*;nat=yes"))
		{
                       setflag(6);
                       fix_nated_contact();
                       force_rport();
		};
                if (method=="INVITE")
                {
                        sl_send_reply("403", "No Re-INVITES Allowed");
		        exit;
                }
                if (method=="BYE")
		{
                       unforce_rtp_proxy();
                       t_relay();
                       exit;
                }
                route(1);
                exit;
	};
        if (method=="CANCEL")
	{
		if (t_check_trans())
		{
		       unforce_rtp_proxy();
		}
		t_relay();
		exit;
	};
	t_check_trans();
	if (method=="REGISTER")
	{
		route(2);
		exit;
	};
	if (!method=="REGISTER")
	{
		route(3);
		exit;
	};
}


########################################################################
# SENDING Routine
########################################################################
route[1]
{
	t_on_reply("1");
	if (!t_relay())
	{
                sl_reply_error();
                if (method=="INVITE" || method=="ACK")
		{
			unforce_rtp_proxy();
		};
	};
	exit;
}


########################################################################
# REGISTER Routine
########################################################################
route[2]
{
        if (is_from_local())
	{
                if (!search("^Contact:[ ]*\*") && nat_uac_test("7"))
                {
                         setflag(6);
                         fix_nated_register();
                         force_rport();
                };
                if (!www_authorize("", "subscriber"))
	        {
		         www_challenge("", "1");
		         exit;
                };
	        if (!check_to())
	        {
		         sl_send_reply("403", "Forbidden, Spoofed To-URI Detected");
		         exit;
	        };
                save("location");
                if (!lookup("location")) 
                {
                        sl_send_reply("404", "Not Found"); 
                        exit;
                };
	        consume_credentials();
	        exit;
         }
         else
         {
                sl_send_reply("403", "Forbidden, Not Allowed to Register");
		exit;
         };
}


########################################################################
# Non-REGISTER Routine
########################################################################
route[3]
{
        if (nat_uac_test("19"))
        {
                setflag(7);
                fix_nated_contact();
                force_rport();
        };
        if (is_from_local())
	{
                if (!proxy_authorize("", "subscriber"))
                {
                         proxy_challenge("", "1");
		         exit;
                };
	        if (!check_from())
                {
                         sl_send_reply("403", "Forbidden, No From-URI Detected");
                         exit;
                };
                consume_credentials();
                lookup("aliases");
                if (is_uri_host_local())
                {
                          append_hf("P-hint: inbound -> inbound \r\n");
                          if (!lookup("location"))
                     	  {
		                     sl_send_reply("404", "User Offline");
	                             exit;
	                  };
                          if (has_body("application/sdp"))
                          {
                                     force_rtp_proxy();
	                  };
                          route(1);
                          exit;
                }
                else
                {
                          append_hf("P-hint: inbound -> outbound \r\n");
	                  if (has_body("application/sdp"))
                          {
                                     force_rtp_proxy();
	                  };
                          route(1);
                          exit;
                }
        }
        else
        {
                lookup("aliases");
                if (is_uri_host_local())
                {
                          append_hf("P-hint: outbound -> inbound \r\n");
                          if (!lookup("location"))
                     	  {
		                     sl_send_reply("404", "User Offline");
	                             exit;
	                  };
	                  if (has_body("application/sdp"))
                          {
                                     force_rtp_proxy();
	                  };
	                  route(1);
	                  exit;
                }
                else
                {
		          append_hf("P-hint: outbound -> outbound \r\n");
                          sl_send_reply("403", "Forbidden, No Transit Allowed");
                          exit;
                };
	};
}


########################################################################
# Reply route 'base-nat-reply'
########################################################################
onreply_route[1]
{
         append_hf("P-hint: onreply route \r\n");
         if (nat_uac_test("19"))
         {
                append_hf("P-hint: fix contact \r\n");
                fix_nated_contact();
                force_rport();
         };
         if (has_body("application/sdp"))
         {
                append_hf("P-hint: SDP \r\n");
                force_rtp_proxy();
	 };
         exit;
}



NV Verizon Belgium Luxembourg SA - Siège social: Rue de la Science 37, 1040 Bruxelles, Belgique - Siège principal: Rue de la Science 37, 1040 Bruxelles, Belgique - Registre des Personnes Morales: RPM Bruxelles 0452.182.326

NV Verizon Belgium Luxembourg SA - Maatschappelijke zetel: Wetenschapsstraat 37, 1040 Brussel, België - Hoofdzetel: Wetenschapsstraat 37, 1040 Brussel, België -Rechtspersonenregister: RPR Brussel 0452.182.326



More information about the Users mailing list