[Serusers] MediaProxy No Sound

TCCHAN tikchoong.chan at redtone.com
Fri Jun 17 09:19:28 CEST 2005


Dear All,


I found out that the following:

(1) if I comment out the use_media_proxy in the on_reply_route, I got
half of the stream working, ie. the called party could hear the caller
party.  

   Sessions will dump a seesion as before.

(2)  if I comment out the use_media_proxy in the if (method=="INVITE")
in main route, I got the whole sessions working, ie called party can
hear caller and vice versa.
   
But sessions didn't get a session dumped, even mediaproxy don't show any
activities, what happened?
( my device are behind NAT, how could they hear if mediaproxy is not
working, and if mediaproxy is working, how come there is not print out
on mediaproxy and sessions show No RTP sessions)



(3) If I use use_media_proxy on both the main route and the
on_reply_route (which is as shown on the example ser.cfg in the
mediaproxy module) I 've got nothing, both the caller and called party
can't hear anything.  But seesions shown a session.


If seems that I can't call use_media_proxy twice or something like that,
but I really not quite sure.

Any suggestion?

Thank for any help available.

Regards,

TC Chan






On Thu, 2005-06-16 at 12:22 +0200, harry gaillac wrote:
> Hello,
> 
> Look at your onreply_route in ser.cfg .
> 
> Harry
> 
> 
> 
#debug=3 
#fork=no
#log_stderror=yes
check_via=no	# (cmd. line: -v)
dns=no           # (cmd. line: -r)
rev_dns=no      # (cmd. line: -R)
#port=5060
#children=4
fifo="/tmp/ser_fifo"

#--------------------------------------------------------------------------------
#TCN:  Need this line for ver 0.9.0
fifo_db_url="mysql://ser:heslo@localhost/ser"
#--------------------------------------------------------------------------------

# ------------------ module loading ----------------------------------
#loadmodule "/usr/local/lib/ser/modules/nathelper.so"
loadmodule "/usr/local/lib/ser/modules/mysql.so"
loadmodule "/usr/local/lib/ser/modules/sl.so"
loadmodule "/usr/local/lib/ser/modules/tm.so"
loadmodule "/usr/local/lib/ser/modules/rr.so"
loadmodule "/usr/local/lib/ser/modules/maxfwd.so"
loadmodule "/usr/local/lib/ser/modules/usrloc.so"
loadmodule "/usr/local/lib/ser/modules/registrar.so"
loadmodule "/usr/local/lib/ser/modules/xlog.so"
loadmodule "/usr/local/lib/ser/modules/exec.so"
loadmodule "/usr/local/lib/ser/modules/auth.so"
loadmodule "/usr/local/lib/ser/modules/auth_db.so"
loadmodule "/usr/local/lib/ser/modules/acc.so"
loadmodule "/usr/local/lib/ser/modules/group.so"
loadmodule "/usr/local/lib/ser/modules/textops.so"
#loadmodule "/usr/local/lib/ser/modules/uri.so"

loadmodule "/usr/local/lib/ser/modules/domain.so"
loadmodule "/usr/local/lib/ser/modules/mediaproxy.so"

#----------------------------------------------------------------------
# mediaproxy
modparam("mediaproxy", "natping_interval", 60)
#modparam("mediaproxy", "mediaproxy_socket", "/var/run/mediaproxy.sock")
modparam("mediaproxy", "mediaproxy_socket",
"/var/run/proxydispatcher.sock")
modparam("registrar",  "nat_flag",         2)
#----------------------------------------------------------------------


#----------------------------------------------------------------------
# uri 
#modparam("uri", "db_url", "sql://root:heslo@localhost/ser")
#modparam("uri", "uri_table", "subscriber")
#----------------------------------------------------------------------


#----------------------------------------------------------------------
# TCN:  no forking
#modparam("registrar","desc_time_order",1)
modparam("usrloc","desc_time_order",1)
modparam("registrar","append_branches",0)
#-----------------------------------------------------------------------



# ----------------- setting module-specific parameters ---------------
modparam("usrloc", "db_mode",   1)
#modparam("usrloc", "db_mode", 2)

#-------------------------------------------------------------------------------------
#TCN:  To chnage the database loc to remote PC change the following
lines
#grep -r 'db_url' sersrc review that the following modules need to be
changed:
# group,vm,usrloc,uri,domain,jabber,auth_db,pdt,acc,msilo
#modparam("auth_db", "db_url", "sql://root:heslo@219.94.42.174/ser")
#modparam("usrloc", "db_url", "sql://root:heslo@219.94.42.174/ser")
#modparam("group", "db_url", "sql://root:heslo@219.94.42.174/ser")

modparam("acc", "db_url", "mysql://root:heslo@localhost/ser")
modparam("auth_db", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("usrloc", "db_url", "mysql://ser:heslo@localhost/ser")
modparam("group", "db_url", "mysql://ser:heslo@localhost/ser")
#-------------------------------------------------------------------------------------

modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("rr", "enable_full_lr", 1)
modparam("tm", "fr_inv_timer", 30 )

###################  NAT  #####################
# We will you flag 6 to mark NATed contacts
#modparam("registrar", "nat_flag", 6)
# Enable NAT pinging
#modparam("nathelper", "natping_interval", 3)
# Ping only contacts that are known to be
# behind NAT
#modparam("nathelper", "ping_nated_only", 1)
##############################################


#----------------------------------------------------------------------
# accounting 
#modparam("acc", "log_flag", 2)
#modparam("acc", "db_flag", 2)
#----------------------------------------------------------------------




alias="redtone"
alias="redtone.sip"
alias="redtone.sip.com"
alias="redtone.sip.com.my"


# -------------------------  request routing logic -------------------
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");
		xlog
("L_INFO","-----------------------------------------------------------------\r\n\r\n\r\n\r\n");
		break;
	};
	
	if ( msg:len > max_len ) 
	{
		sl_send_reply("513", "Message too Large");
		xlog
("L_INFO","-----------------------------------------------------------------\r\n\r\n\r\n\r\n");
		break;
	};
	
	if (method=="NOTIFY")
	{
		break;
	}


    if (method=="REGISTER") 
    {
  	  xlog("L_INFO","xlog %Tf: REGISTER route uri:%ru method:%rm\r\nfrom:
%fu To:%tu Contact:%ct\r\n\r\n\r\n");

	  #if (is_from_local()) 
	  #{
           	  xlog("L_INFO","xlog %Tf: FROM LOCAL REGISTER route uri:%ru
method:%rm\r\nfrom:%fu To:%tu Contact:%ct\r\n\r\n\r\n");

		   # Mark as NAT'ed
            if (client_nat_test("3")) 
		{
                #setflag(2);
                force_rport();
                fix_contact();
            };
		xlog("L_INFO","xlog %Tf: start REGISTER route uri:%ru method:%rm\r
\nfrom:%fu To:%tu Contact:%ct\r\n\r\n\r\n");
			
		if (!www_authorize("redtone", "subscriber")) 
		{
			xlog("L_INFO","%fu failed authentification!\r\n");
			www_challenge("redtone", "0");
			xlog("L_INFO","%fu failed authentification and challenge!\r\n");
			xlog
("L_INFO","-----------------------------------------------------------------\r\n\r\n\r\n\r\n");
			break;
		};
			
		save("location");
		xlog("L_INFO","username %fu location REGISTERed!\r\n");
		xlog
("L_INFO","-----------------------------------------------------------------\r\n\r\n\r\n\r\n");
		break;
	/*
  	} 
	else 
	{
		xlog("L_INFO","This domain is not served here!\r\n");
            sl_send_reply("403", "This domain is not served here");
      };
	*/
        break;
    };

    /*  	
    if (method=="INVITE") {
		
        if (!(is_from_local() || is_uri_host_local())) {
            sl_send_reply("403", "Relaying is forbidden");
            break;
        };
        t_on_failure("1");
	  	

    } else */ if (method == "BYE" || method == "CANCEL") {
		 		xlog("L_INFO","end_media_session uri:%ru method:%rm \r\nfrom:%fu
To:%tu  Contact:%ct\r\n");

        			end_media_session();
    };
	
	
   	    	
/*
    if (loose_route()) { 
        if (method=="INVITE" || method=="ACK") {
            use_media_proxy();
        };
        # end media session for BYE and CANCEL is done above
        # before entering the loose route. no need to call it here
        t_relay();
        break;
    };
*/
   	
    # Force subsequent messages to pass trough this proxy
    if (method == "INVITE") {
	  xlog("L_INFO","invite record route   uri:%ru method:%rm \r\nfrom:%fu
To:%tu  Contact:%ct\r\n");
        record_route();
    };

    if (client_nat_test("3") && !search("^Record-Route:")) {
        # Mark as NAT'ed
	  xlog("L_INFO","force port and fixcontact  uri:%ru method:%rm \r
\nfrom:%fu To:%tu  Contact:%ct\r\n");

        force_rport();
        fix_contact();
    };

    if (method=="INVITE") {
	  xlog("L_INFO","set t_onreply  uri:%ru method:%rm \r\nfrom:%fu To:%tu
Contact:%ct\r\n");
        t_on_reply("1");
	  setflag(6);
    };


   	
   # if (is_uri_host_local()) {
	   lookup("aliases"); 	
        if (!lookup("location")) {
            sl_send_reply("404", "User not found");
            break;
        };

   # };
   

	 
    #if (method=="INVITE" || method=="ACK") {
    if (method=="INVITE") {	
    #if (method=="ACK") {		
	  xlog("L_INFO","use mediapproxy  uri:%ru method:%rm \r\nfrom:%fu To:%
tu  Contact:%ct\r\n");
        use_media_proxy();
    };
    
    xlog("L_INFO","relay out\r\n");

    if (!t_relay()) {
        if (method=="INVITE" || method=="ACK") {
            end_media_session();
        };
        sl_reply_error();
    };
}


failure_route[1] {
    end_media_session();
}

onreply_route[1] {
    xlog("L_INFO","on reply uri:%ru method:%rm \r\nfrom:%fu To:%tu
Contact:%ct\r\n");

    #if (status=~"(183)|(2[0-9][0-9])") {
   if (status=="200") {
   	 xlog("L_INFO","REPLY OK uri:%ru method:%rm \r\nfrom:%fu To:%tu
Contact:%ct\r\n");
	
        #if (client_nat_test("1")) {
            fix_contact();
        #};
	  	
	  if (!isflagset(7))
	  {
        	use_media_proxy();
		setflag(7);
		
	  }
	 
    };
}








More information about the sr-users mailing list