[Serusers] Can' t receive calls from other domains

harry gaillac gaillacharry at yahoo.fr
Mon Sep 12 17:46:37 CEST 2005


Hello,

I use ser-0.9.3 and mediaproxy 1.4.2

I can dial sip addresses to other domains however i
can't  
receive calls.

I 've been spending time to fix this problem without
success.

In fact ser don't send public ip in sdp of the callee.

Thanks for help

Harry



 $Id: ser.cfg,v 1.27 2005/03/10 14:16:25  Exp $
#
#

# ----------- global configuration parameters
------------------------

debug=3         # debug level (cmd line: -dddddddddd)
fork=yes
log_stderror=no	# (cmd line: -E)
#memlog=5 # memory debug log level
#log_facility=LOG_LOCAL0 # sets the facility used for
logging (see syslog(3))

/* Uncomment these lines to enter debugging mode 
#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"
fifo_db_url="mysql://ser:heslo@serveur1.home.net/ser"
user=root
group=ser
fifo_user=root # owner of the ser fifo
fifo_group=ser
fifo_mode=0660 # fifo's permissions
#disable_core=yes #disables core dumping
#open_fd_limit=1024 # sets the open file descriptors
limit
#mhomed=yes  # usefull for multihomed hosts, small
performance penalty
#disable_tcp=yes 
#tcp_accept_aliases=yes # accepts the tcp alias via
option (see NEWS)
listen=80.119.6.86
#

# ------------------ module loading
----------------------------------

loadmodule "/usr/lib/ser/modules/mysql.so"
loadmodule "/usr/lib/ser/modules/sl.so"
loadmodule "/usr/lib/ser/modules/tm.so"
loadmodule "/usr/lib/ser/modules/rr.so"
loadmodule "/usr/lib/ser/modules/maxfwd.so"
loadmodule "/usr/lib/ser/modules/usrloc.so"
loadmodule "/usr/lib/ser/modules/registrar.so"
loadmodule "/usr/lib/ser/modules/uri.so"
loadmodule "/usr/lib/ser/modules/uri_db.so"
loadmodule "/usr/lib/ser/modules/nathelper.so"
loadmodule "/usr/lib/ser/modules/mediaproxy.so"
loadmodule "/usr/lib/ser/modules/auth.so"
loadmodule "/usr/lib/ser/modules/auth_db.so"
loadmodule "/usr/lib/ser/modules/textops.so"
loadmodule "/usr/lib/ser/modules/permissions.so"
loadmodule "/usr/lib/ser/modules/domain.so"
loadmodule "/usr/lib/ser/modules/group.so"
loadmodule "/usr/lib/ser/modules/acc.so"
loadmodule "/usr/lib/ser/modules/msilo.so"
loadmodule "/usr/lib/ser/modules/avpops.so"

# ----------------- setting module-specific parameters
---------------

#  -- usrloc params--
modparam("usrloc", "db_mode", 2)
modparam("usrloc", "use_domain", 1)

#  -- autdb_params--
modparam("auth_db", "calculate_ha1", yes)
modparam("auth_db", "password_column", "password")
modparam("auth_db", "use_domain", 1)

# -- rr params --
# add value to ;lr param to make some broken UAs happy
modparam("rr", "enable_full_lr", 1)

# -- nathelper params --
modparam("nathelper", "ping_nated_only", 0)
modparam("nathelper", "rtpproxy_disable", 1)

# mediaproxy params --
modparam("mediaproxy", "natping_interval", 10)
modparam("mediaproxy", "mediaproxy_socket",
"/var/run/mediaproxy.sock")

# -- registrar params --
modparam("registrar", "nat_flag", 4)
modparam("registrar", "use_domain", 1)

# -- tm params --
modparam("tm", "fr_inv_timer", 15)
modparam("tm", "fr_timer", 10)

# --domain params --
modparam("domain", "db_url",
"mysql://ser:heslo@serveur1.home.net/ser")  
modparam("domain", "domain_table", "domain")
modparam("domain", "db_mode", 1)   # Use caching

# -- permissions params --
modparam("permissions", "db_url",
"mysql://ser:heslo@serveur1.home.net/ser")
modparam("permissions", "db_mode", 1)
modparam("permissions", "trusted_table", "trusted")
modparam("permissions", "default_deny_file",
"/etc/ser/permissions.deny")
modparam("permissions", "default_allow_file",
"/etc/ser/permissions.allow")

# -- acc params --
modparam("acc", "db_url",
"mysql://ser:heslo@serveur1.home.net/ser")
modparam("acc", "log_fmt", "miocfsp")
modparam("acc", "failed_transactions", 1)
modparam("acc", "db_flag", 2)
modparam("acc", "db_missed_flag", 3)

#  -- msilo params --
modparam("msilo", "db_url",
"mysql://ser:heslo@serveur1.home.net/ser")
modparam("msilo", "check_time", 10)

#  -- avpos params --
modparam("avpops","avp_url","mysql://ser:heslo@serveur1.home.net/ser")
modparam("avpops","avp_table","usr_preferences")

# -------------------------  request routing logic
-------------------


# main 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");
		break;
	};
	if (msg:len >=  max_len ) {
		sl_send_reply("513", "Message too big");
		break;
	};
	
	# 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 (!method=="REGISTER") { 
		record_route();	
	};
	
 
	if (method=="CANCEL" || method=="BYE") {
		end_media_session();
	};

	# subsequent messages withing a dialog should take
the
	# path determined by record-routing
	if (loose_route()) {
		if (has_totag() && method=="INVITE" ||
method=="ACK") {
			if (client_nat_test("3")) {
				setflag(4);
				force_rport();
				fix_contact();
			};
			use_media_proxy();
		};	
		route(1);
		break;
	};



	# if the request is for our domains use UsrLoc
	# (in case, it does not work, use the following
command
	# with proper names and addresses in it)
	if (is_uri_host_local()) {

		if (method=="CANCEL") {
			route(3);
			break;
		} else if (method=="INVITE") {
			route(3);
			break;
		} else if (method=="REGISTER") {
			route(2);
			break;
		} else if (method=="MESSAGE") {
                	route(7);
			break;
		} else if (method=="SUBSCRIBE" || method=="NOTIFY")
{
                	route(8);
			break;
		};
	route(1);
	break;
	};

	# Requests to others domains
	if (!is_uri_host_local()) {

        # Checking Authorization 
	if (!proxy_authorize("","subscriber")) {
		proxy_challenge("","0");
		sl_send_reply("407", "Proxy Authentication
Required");
		break;
	};



        	if (client_nat_test("3")) {
                	setflag(4);
        	};

        	if (isflagset(4)) {
                	force_rport();
                	fix_contact();
                	use_media_proxy();
	       	};

       	#   Message Handler to others domains  #

 	       if (method=="MESSAGE") {
        	        route(1);
                	break;
 	       };



	# mark routing logic in request
	append_hf("P-hint: outbound\r\n"); 

	route(1);
	break;
	};

}

route[1] { 
	###########################
	# Default Message Handler #
	###########################

	t_on_reply("1");

	# send it out now; use stateful forwarding as it
works reliably
	# even for UDP2TCP
	if (!t_relay()) {
		sl_reply_error();
	};
}

route[2] {
	############################
	# Register Message Handler #
	############################

	if (client_nat_test("3")) {
		setflag(4);
		force_rport();
		fix_contact();
	};

	if (!www_authorize("", "subscriber")) {
        	www_challenge("", "0");
		sl_send_reply("401", "Unauthorized");
                break;
	};

	if (!is_from_local()) {
		sl_send_reply("401", "Unauthorized");
                break;
	};	

	consume_credentials();

	if (!save("location")) {
		sl_reply_error();
		break;
	};
	m_dump();
}

route[3] {
	#############################
	# CANCEL and INVITE handler #
	#############################
	# SIP destinations to PSTN
	if (uri=~"^sip:[0-9]{4}@.*$" ||
uri=~"^sip:[0-9]{10}@.*$" ||
uri=~"^sip:06[0-9]{8}@.*$" || uri=~"^sip:00.*@.*$") {
		route(4); 
		route(1);
		break;
	};

	# SIP destinations to IPBX
	if (uri=~"^sip:8[0-3]@.*$") {
		route(5);
		route(1);
		break;
	}


        # Check AVPs for Voicemail
	if
((avp_db_load("$ruri","s:fw_voicemail/usr_preferences")
&& avp_check("fw_voicemail", "eq/i:1"))) {
		route(6);
		route(1);
		break;
	};


        # accounting db flags
        setflag(2);
        setflag(3);
	acc_db_request("404 missed call", "missed_calls");

        # Check Nated User Agents
        if (client_nat_test("3")) {
                setflag(4);
        };

        if (isflagset(4)) {
                force_rport();
                fix_contact();
                use_media_proxy();
        };

        # Check ACL for Voicemail
        if (is_user_in("Request-URI","voicemail")) {
                setflag(5);
        };

	
        # native SIP destinations are handled using
our USRLOC DB
        lookup("aliases"); 
        if (!lookup("location")) {
		if (isflagset(5)) {
                	route(6);
			route(1);
			break;
      	} else { 
		sl_send_reply("404", "User Not Found");
		break;
		};
	};
	
	t_on_failure("1");
	route(1);
	break;



}


route[4] {
        ##########################
        # Outgoing PSTN Handler  #
        ##########################

        # Checking Authorization to PSTN 
	if (!proxy_authorize("","subscriber")) {
		proxy_challenge("","0");
		sl_send_reply("407", "Proxy Authentication
Required");
		break;
	};



	if (uri=~"^sip:[0-9]{4}@.*$") {
		if (!is_user_in("From", "local")) { 
			sl_send_reply("403", "Forbidden");
			break;
		};
	
	} else if (uri=~"^sip:[0-9]{10}@.*$") {
                if (!is_user_in("From", "local")) {
                        sl_send_reply("403",
"Forbidden");
                        break;
		};

        } else if (uri=~"^sip:06[0-9]{8}@.*$") {
                if (!is_user_in("From", "cellphone"))
{
                        sl_send_reply("403",
"Forbidden");
                        break;
		};

        } else if (uri=~"^sip:00. at .*$") {
                if (!is_user_in("From", "int")) {
                        sl_send_reply("403",
"Forbidden");
                        break;
		};
	};		


	prefix("0");
	rewritehostport("asterisk.home.net:5050");
	break;
}

route[5] {
        ##########################
        #    Asterisk Handler    #
        ##########################

        # Checking Authorization to Asterisk 
	if (!proxy_authorize("","subscriber")) {
		proxy_challenge("","0");
		sl_send_reply("407", "Proxy Authentication
Required");
		break;
	};


        if (uri=~"^sip:8[0-3]@.*$") {
                if (!is_user_in("From", "local")) {
                        sl_send_reply("403",
"Forbidden");
                        break;
                };
	};

        

	rewritehostport("asterisk.home.net:5050");
	break;
}

route[6] {
        ##########################
        #   Voicemail Handler    #
        ##########################

 		revert_uri(); # resend to voicemail with original
request URI
		prefix("u");
       		rewritehostport("asterisk.home.net:5050");
		break;

}

route[7] {
        ##########################
        #   Message Handler      #
        ###########################

        # Checking Authorization  
	if (!proxy_authorize("","subscriber")) {
		proxy_challenge("","0");
		sl_send_reply("407", "Proxy Authentication
Required");
		break;
	};



	lookup("aliases");
	if (!lookup("location")) {
    		if (method == "MESSAGE") {
        		if (!t_newtran()) {
            			sl_reply_error();
            			break;
        		};

        	if (m_store("0")) {
            		t_reply("202", "Accepted for Later
Delivery");
            		break;
        	};

        	t_reply("503", "Service Unavailable");
        	break;
 	   	};
	};
	route(1);
}

route[8] {
        ################################
        #   SUBSCRIBE/NOTIFY Handler   #
        ################################

        # Checking Authorization  
	if (!proxy_authorize("","subscriber")) {
		proxy_challenge("","0");
		sl_send_reply("407", "Proxy Authentication
Required");
		break;
	};



	lookup("aliases");
        if (!lookup("location")) {
                sl_send_reply("404", "User Not
Found");
                break;
        };
	route(1);


}

onreply_route[1] {
        ##########################
        #    Statefull Handler   #
        ##########################

                if (isflagset(4) || isflagset(6) &&
status=~"(180) || (183) || 2[0-9][0-9]") {
                        if(search("^Content-Type:
.*$")) {
                                use_media_proxy();
                        };
                };

                if (client_nat_test("1")) {
                        fix_contact();
                };



}

failure_route[1] {
        ##########################
        #    Voicemail Handler   #
        ##########################

	if (t_check_status("486")) {
 		revert_uri(); # resend to voicemail with original
request URI
		prefix("b");
       		rewritehostport("asterisk.home.net:5050");
		append_branch();
		t_relay_to_udp("asterisk.home.net","5050");
		break;
	};
	if (t_check_status("408")) {
 		revert_uri(); # resend to voicemail with original
request URI
		prefix("u");
       		rewritehostport("asterisk.home.net:5050");
		append_branch();
		t_relay_to_udp("asterisk.home.net","5050");
		break;
	};
	
}









	

	
		
___________________________________________________________________________ 
Appel audio GRATUIT partout dans le monde avec le nouveau Yahoo! Messenger 
Téléchargez cette version sur http://fr.messenger.yahoo.com




More information about the sr-users mailing list