[OpenSIPS-Users] BYE and dialog delete (load balance, top hiding with looping and sdp fileds change)

saneku ukhov at ycc.ru
Mon Aug 1 07:33:08 CEST 2011


Hello!
i have next opensips cnfg:    
	  PSTN<-------->OPENSIPS<-------->ASTERISK1 (IVR) 
             (10.107.10.10)  (10.130.0.140)       (10.130.0.136) 
			            <-------->ASTERISK2 (IVR) 
				            (10.130.0.137) 
				 
So it uses top hiding with looping, load balancing and SDP fields change as
it uses different VLANS for signalling and for rtp.
So I have decided to put my working cnfg file here. 
Hope someone will find it usefull.

But there is still one thing to do. And I dont know which...
When the called party hangs up, dialog not being deleted (i can see it in
dialog table) so it causes LB module to 
reject incomming calls after all available resourses becomes occupated.  

BUT! when the calling party drops the call everything goes just perfect
(dialog being deleted). so there are 
no rejected incoming calls.

All sip-exchange is going fine in both cases.
Hopping for your help.


config file:
----------------
...
port=5061
listen=udp:10.130.0.140:5061
listen=tcp:10.130.0.140:5061

mpath="//lib/opensips/modules/"

loadmodule "db_mysql.so"
loadmodule "signaling.so"
loadmodule "sl.so"
loadmodule "tm.so"
loadmodule "rr.so"
loadmodule "maxfwd.so"
loadmodule "usrloc.so"
loadmodule "registrar.so"
loadmodule "textops.so"
loadmodule "mi_fifo.so"
loadmodule "uri.so"
loadmodule "acc.so"
loadmodule "load_balancer.so"
loadmodule "dialog.so"
loadmodule "nathelper.so"

loadmodule "b2b_entities.so"
loadmodule "b2b_logic.so" 

modparam("mi_fifo", "fifo_name", "/tmp/opensips_fifo")

modparam("dialog", "dlg_flag", 13)
modparam("dialog", "db_mode", 1)


modparam("load_balancer|dialog|b2b_entities|b2b_logic", "db_url",
"mysql://xxxxxxxxxxxxxxxx")
modparam("b2b_entities", "server_address", "sip:10.130.0.140:5061")
modparam("tm", "pass_provisional_replies", 1)

modparam("load_balancer", "probing_from", "sip:sip at 10.130.0.140")
modparam("load_balancer", "probing_interval", 30)

route
{	
	if (!method=="REGISTER") 
	{ 
		xlog("+++++++++Recording route...\n"); 
		record_route(); 
	}
		
	if (loose_route())
	{
		xlog("+++++++++Append rr-enforced...\n"); 
		append_hf("P-hint: rr-enforced\r\n"); 
		route(1);
	}
	
	#skip Invite messages generated by the server
	if(is_method("INVITE") && !(src_ip=="10.130.0.140"))
	{			
		xlog("++++++++++Doing top hiding\n");
		b2b_init_request("top hiding");	
		exit;
	};
	route(1);
}

route[1]
{
	xlog("++++++++++In route 1\n");	
	if(is_method("INVITE") && (src_ip=="10.130.0.140"))
	{
		load_balance("1","pstn");
		if ($retcode<0)
		{
			 sl_send_reply("501","PROXY: all channels are busy!");
			 exit;
		}
		xlog("+++++++++Selected dst: $du\n");
	}
	#-----------------------
	
	t_on_failure("1");
	t_on_reply("1");
	
	if (!t_relay()) 
	{
		sl_reply_error();
	};
	exit;
}

onreply_route[1]
{
	if(t_check_status("(200)|(183)"))
	{
		if(has_body("application/sdp"))
		{
			if(search("IN IP4 10.130.0.136"))
			{
				fix_nated_sdp("2","10.130.0.88");
				fix_nated_sdp("8","10.130.0.88");
			}

			if(search("IN IP4 10.130.0.137"))
			{
				fix_nated_sdp("2","10.130.0.87");
				fix_nated_sdp("8","10.130.0.87");
			}
		}
	}
}

failure_route[1]
{
    if (t_check_status("(408)|(5[0-9][0-9])"))
    {
		lb_disable();
		if (load_balance("1","pstn"))
		{
			t_on_failure("1");
			t_on_reply("1");
		
			xlog("PROXY: New destination is $du\n");
			t_relay();
		}
		else
		{
			t_reply("501", "PROXY: Service unavailable");
		}
    }
}

--
View this message in context: http://opensips-open-sip-server.1449251.n2.nabble.com/BYE-and-dialog-delete-load-balance-top-hiding-with-looping-and-sdp-fileds-change-tp6639898p6639898.html
Sent from the OpenSIPS - Users mailing list archive at Nabble.com.



More information about the Users mailing list