[OpenSIPS-Users] t_replicate vs forward()

TCB tawandac at gmail.com
Fri Mar 26 20:38:17 CET 2010


I'm trying to get simple register replicated across 4 servers sharing the
same sip
domain. A user can register to any of the proxies. I have 1 major problem
with this setup
and a slightly minor one.

1) NAT does not work at all, why ? if the call goes to the wrong proxy no
deal!, Is there a way
I can force the Invite to go via the registering proxy ? Call without NAT
work 100%.

2) the third server I forward the register to ends up getting 4 Via
statements? Is this proper?

I have attached a sample trace of the (minor) issue and a snippet of my
config file.
I'm close to wits end here. Any ideas most welcome.
I have tried using t_replicate but it only sends to one server as per TM
docs. how do I
setup ""If multiple destinations are to be used, the additional SIP URIs
have to be set as branches."" as per
TM module?

thanks.

-- 
TC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.opensips.org/pipermail/users/attachments/20100326/46ae34f8/attachment-0001.htm 
-------------- next part --------------

#-------Path module-------
loadmodule "path.so"
modparam("path", "use_received", 0)
########################################################################
# Request route 'base-route-register'
########################################################################
route[BASE_ROUTE_REGISTER]
{
	if((src_ip==server2))
	{
		xlog("L_INFO","route[BASE_ROUTE_REGISTER] : Register Received from Peer $si Saving ...");
		save("location","m");
		exit();
	} 
	if((src_ip==server3))
	{
		xlog("L_INFO","route[BASE_ROUTE_REGISTER] : Register Received from Peer $si Saving ...");
		save("location","m");
		exit();
	} 	
	if((src_ip==server4))
	{
		xlog("L_INFO","route[BASE_ROUTE_REGISTER] : Register Received from Peer $si Saving ...");
		#add_path();
		save("location","m");
		exit();
	} 
	#if((src_ip==server1))
	#{
	#	xlog("L_INFO","route[BASE_ROUTE_REGISTER] : Register Received from Peer $si Saving ...");
	#	save("location","m");
	#	exit();
	#} 
	else 
	{ 
		
		sl_send_reply("100", "Trying");
		if(!www_authorize("", "v_voipusers"))
		{

			xlog("L_INFO", "route[BASE_ROUTE_REGISTER] : Register authentication failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
			www_challenge("", "0");
			exit;
		}
		if(!db_check_to())
		{

			xlog("L_INFO", "route[BASE_ROUTE_REGISTER] : Spoofed To-URI detected - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
			sl_send_reply("403", "Spoofed To-URI Detected");
			exit;
		}
		consume_credentials();
		if(!search("^Contact:[ ]*\*") && nat_uac_test("19"))
		{
			force_rport();
			nat_keepalive();
			fix_nated_register();
			setbflag(6);
		}
		if(!save("location"))
		{

			xlog("L_ERR", "route[BASE_ROUTE_REGISTER] : Saving contact failed - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
			sl_reply_error();
			exit;
		}
		add_path();
		add_sock_hdr("Local-Sock");
		force_send_socket("server1");
		forward("server2:5060");
		forward("server3:5060");
		forward("server4:5060");

		xlog("L_INFO", "route[BASE_ROUTE_REGISTER] : Registration successful - M=$rm RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
		exit;
	}

}
-------------- next part --------------
######################
U server1:5060 -> server4:5060
REGISTER sip:server1 SIP/2.0.
Call-ID: 8bf4caccc5ac04802189bf004c6f3247 at 0:0:0:0:0:0:0:0.
CSeq: 147 REGISTER.
From: <sip:402 at server1>;tag=5b1ba465.
To: <sip:402 at server1>.
Max-Forwards: 69.
User-Agent: SIP Communicator1.0-alpha3-nightly.build.2507Linux.
Expires: 3600.
Contact: "402" <sip:402 at 172.16.16.39:5060;transport=udp;registering_acc=server4>;expires=3600.
Via: SIP/2.0/UDP server1;branch=z9hG4bKceb07dac86ca0962499ff271dc43d070373730.
Via: SIP/2.0/UDP server1;branch=z9hG4bKceb07dac86ca0962499ff271dc43d070373730.
Via: SIP/2.0/UDP server1;branch=z9hG4bKceb07dac86ca0962499ff271dc43d070373730.
Via: SIP/2.0/UDP 172.16.16.39:5060;rport=5060;received=172.16.16.39;rport=5060;received=172.16.16.39;rport=5060;received=172.16.16.39;branch=z9hG4bKceb07dac86ca0962499ff271dc43d070373730.
Content-Length: 0.
Path: <sip:server1;lr>.
Local-Sock: udp:server1:5060.
.

#
U server4:5060 -> server1:5060
SIP/2.0 200 OK.
Call-ID: 8bf4caccc5ac04802189bf004c6f3247 at 0:0:0:0:0:0:0:0.
CSeq: 147 REGISTER.
From: <sip:402 at server1>;tag=5b1ba465.
To: <sip:402 at server1>;tag=cbb2b2a10f3d8c83c2c81c71e59f19d7.5e13.
Via: SIP/2.0/UDP server1;branch=z9hG4bKceb07dac86ca0962499ff271dc43d070373730;rport=5060.
Via: SIP/2.0/UDP server1;branch=z9hG4bKceb07dac86ca0962499ff271dc43d070373730.
Via: SIP/2.0/UDP server1;branch=z9hG4bKceb07dac86ca0962499ff271dc43d070373730.
Via: SIP/2.0/UDP 172.16.16.39:5060;rport=5060;received=172.16.16.39;rport=5060;received=172.16.16.39;rport=5060;received=172.16.16.39;branch=z9hG4bKceb07dac86ca0962499ff271dc43d070373730.
Contact: <sip:402 at 172.16.16.39:5060;transport=udp;registering_acc=server4>;q=1;expires=3600.
OpenSIPS Server.
Content-Length: 0.


More information about the Users mailing list