[OpenSIPS-Users] Using dispatcher and t_replicate()

Jody Rudolph jrudolph at qx.net
Mon Dec 27 21:08:55 CET 2010


Bogdan,

I am. The following are the dispatcher params.

modparam("dispatcher", "db_url", "mysql://<DB LOCATION>/opensips")
modparam("dispatcher", "flags",2)
modparam("dispatcher", "ds_probing_mode", 0)
modparam("dispatcher", "ds_ping_interval", 10)

This does explain the 4 failures when i restarted after changing the script to include the "IF" statement.

I am using the IF statement now and running for 4-5 days with no failure. Seems to only break when the IF statement is not in place. I should have been using the IF the whole time. That's what I get for being lazy.

Thanks,
Jody


On Dec 27, 2010, at 2:45 PM, Bogdan-Andrei Iancu wrote:

> Hi Jody,
> 
> Strange as the ds_select_dst() may fail because of only 2 reasons:
> 
> 1) internal error (like no more mem, parsing error, etc)
> 
> 2) no available destinations (if your cfg allows peer disabling by script or probing) - do you do that in your script ?
> 
> Regards,
> Bogdan
> 
> Jody Rudolph wrote:
>> Bogdan,
>> 
>> No other errors. I am testing non-production with only one endpoint registering so theres not a lot of traffic going on.
>> 
>> As of right now all I have found is that this fails constantly:
>> 
>>  
>>>> 		ds_select_dst("1", "4");
>>>> 		t_replicate("$du");
>>>>      
>> 
>> This does not (although it did fail only 4 times when I first made the change)
>> 
>>  
>>>>       
>>>>> if ( ds_select_dst("1", "4") ) {
>>>>>       xlog("replicating to $du \n");
>>>>>       t_replicate("$du");
>>>>> } else {
>>>>>       xlog("failure to select");
>>>>> }
>>>>>        
>> 
>> 
>> 
>> 
>> Thanks,
>> Jody Rudolph
>> Qx.net
>> Office:	(859) 255-1928
>> Fax:		(859) 255-1798
>> jrudolph at qx.net
>> 
>> 
>> On Dec 23, 2010, at 11:07 AM, Bogdan-Andrei Iancu wrote:
>> 
>>  
>>> Jody,
>>> 
>>> when ds_select_dst() fails, don't you get any other previous err logs giving clues on the failures ?
>>> 
>>> Regards,
>>> Bogdan
>>> 
>>> Jody Rudolph wrote:
>>>    
>>>> Bogdan,
>>>> 
>>>> This is how I have I have been using it as a workaround. This does work 100% of the time and $du is being populated by the dispatcher addresses in round-robin.
>>>> 
>>>> 	ds_select_dst("1", "4");
>>>> 	switch($du)
>>>>     	{
>>>>     	  	case "sip:192.168.1.1":
>>>> 	          	xlog("reg destination address is $du\n");
>>>> 	          	t_replicate("sip:192.168.1.1");
>>>> 	        break;
>>>> 	        case "sip:192.168.1.2":
>>>> 	        	xlog("reg destination address is $du\n");
>>>>               	t_replicate("sip:192.168.1.2");
>>>>           break;
>>>> 	 }	
>>>> 
>>>> 
>>>> I changed it to the if statement you suggested and I also see the expected behavior. The correct IPs are being logged from the xlog("replicating to $du \n"); statement. The strange part is this:
>>>> 
>>>> Using the following
>>>> 
>>>>       
>>>>> if ( ds_select_dst("1", "4") ) {
>>>>>       xlog("replicating to $du \n");
>>>>>       t_replicate("$du");
>>>>> } else {
>>>>>       xlog("failure to select");
>>>>> }
>>>>>           
>>>> The first 4 registrations processed triggered a "failure to select". After that, it started working as expected. I have since restarted the service 5 times with no occurrences of failure.
>>>> 
>>>> After this I reverted to the original configuration of
>>>> 
>>>> 		ds_select_dst("1", "4");
>>>> 		t_replicate("$du");
>>>> 
>>>> Dec 23 10:09:39 [16005] ERROR:core:parse_uri: bad uri,  state 0 parsed: <<nul> (4) / <<null>> (6)
>>>> Dec 23 10:09:39 [16005] ERROR:tm:uri2proxy: bad_uri: <null>
>>>> Dec 23 10:09:39 [16005] ERROR:tm:t_forward_nonack: failure to add branches
>>>> 
>>>> 
>>>> 
>>>> I will run it in the if statement for a while and monitor the results.
>>>> 
>>>> 
>>>> Thanks,
>>>> Jody
>>>> 
>>>> 
>>>> On Dec 23, 2010, at 9:33 AM, Bogdan-Andrei Iancu wrote:
>>>> 
>>>>       
>>>>> Hi Jody,
>>>>> 
>>>>> in 1.6.4, it seams that $du is NULL (no value) - are you sure the ds_select_dst() was successful ? put it in an "if" statement :
>>>>> 
>>>>> if ( ds_select_dst("1", "4") ) {
>>>>>       xlog("replicating to $du \n");
>>>>>       t_replicate("$du");
>>>>> } else {
>>>>>       xlog("failure to select");
>>>>> }
>>>>> 
>>>>> Regards,
>>>>> Bogdan
>>>>> 
>>>>> Jody Rudolph wrote:
>>>>>           
>>>>>> Bogdan,
>>>>>> 
>>>>>> I am using SVN latest 1.6 via:
>>>>>> |svn co https://opensips.svn.sourceforge.net/svnroot/opensips/branches/1.6 opensips_1_6|
>>>>>> I tried last week at 1.6.3 and received the errors I posted in the previous email. After 1.6.4 the error messages have changed slightly but still seems to be related.
>>>>>> 
>>>>>> 
>>>>>> call to function:
>>>>>> 
>>>>>> ds_select_dst("1", "4");
>>>>>> t_replicate("$du");
>>>>>> 
>>>>>> 1.6.3 error:
>>>>>>               
>>>>>>>> Dec 20 13:16:02 [12858] ERROR:core:parse_uri: uri too short: <$du> (3)
>>>>>>>> Dec 20 13:16:02 [12858] ERROR:tm:uri2proxy: bad_uri: $du
>>>>>>>>                       
>>>>>> 1.6.4 error:
>>>>>> 
>>>>>> Dec 22 10:18:50 [11874] ERROR:core:parse_uri: bad uri,  state 0 parsed: <<nul> (4) / <<null>> (6)
>>>>>> Dec 22 10:18:50 [11874] ERROR:tm:uri2proxy: bad_uri: <null>
>>>>>> Dec 22 10:18:50 [11874] ERROR:tm:t_forward_nonack: failure to add branches
>>>>>> 
>>>>>> Thanks,
>>>>>> Jody
>>>>>> 
>>>>>> 
>>>>>> On Dec 22, 2010, at 5:18 AM, Bogdan-Andrei Iancu wrote:
>>>>>> 
>>>>>>               
>>>>>>> Hi Jody,
>>>>>>> 
>>>>>>> What version / revsion number are you testing with ?
>>>>>>> 
>>>>>>> That add-on in still there (trunk and 1.6) as far I checked.
>>>>>>> 
>>>>>>> Regards,
>>>>>>> Bogdan
>>>>>>> 
>>>>>>> 
>>>>>>> Jody Rudolph wrote:
>>>>>>>                   
>>>>>>>> This was added and working at one time but in the latest SVN it seems to have reverted back to non-working. Am I missing a setting that has changed?
>>>>>>>> ds_select_dst("1", "4");
>>>>>>>> t_replicate("$du");
>>>>>>>> Dec 20 13:16:02 [12858] ERROR:core:parse_uri: uri too short: <$du> (3)
>>>>>>>> Dec 20 13:16:02 [12858] ERROR:tm:uri2proxy: bad_uri: $du
>>>>>>>> Thanks,
>>>>>>>> Jody Rudolph
>>>>>>>> On Oct 4, 2010, at 9:57 AM, Razvan Crainea wrote:
>>>>>>>> 
>>>>>>>>                       
>>>>>>>>> /  Hi Jody,
>>>>>>>>>                           
>>>>>>>> />/ />/ I just made a commit with this feature. Now t_replicate can also receive />/ a pseudo-variable as argument.
>>>>>>>> />/ Please update from svn (it is both in trunk and 1.6).
>>>>>>>> />/ />/ Regards,
>>>>>>>> />/ />/ -- />/ Razvan Crainea
>>>>>>>> />/ www.voice-system.ro <http://www.voice-system.ro> <http://www.voice-system.ro>
>>>>>>>> />/ />/ />/ />/ On 10/04/2010 02:17 PM, Bogdan-Andrei Iancu wrote:
>>>>>>>> />>/ Hi Jody,
>>>>>>>> />>/ />>/ Indeed, this is not a nice solution - let me put on the TODO list the
>>>>>>>> />>/ support for variables in t_replicate.
>>>>>>>> />>/ />>/ Regards,
>>>>>>>> />>/ Bogdan
>>>>>>>> />>/ />>/ Jody Rudolph wrote:
>>>>>>>> />>>/ Just in case anyone might need a workaround here like I did I thought I would share what I did to get it to work.
>>>>>>>> />>>/ />>>/ Since the servers I am load balancing registrations across share a database backend for registrations I am trying to spread the registrations across single servers using dispatcher.
>>>>>>>> />>>/ />>>/ Lets say we have the following 3 IPs:
>>>>>>>> />>>/ />>>/ 192.168.1.2
>>>>>>>> />>>/ 192.168.1.3
>>>>>>>> />>>/ 192.168.1.4
>>>>>>>> />>>/ />>>/ />>>/ Since we cant use (that I can figure out anyway)
>>>>>>>> />>>/ ds_select_dst("1", "4");
>>>>>>>> />>>/ t_replicate($du);
>>>>>>>> />>>/ />>>/ I used:
>>>>>>>> />>>/ />>>/ ds_select_dst("1", "4");
>>>>>>>> />>>/ switch($du)
>>>>>>>> />>>/         {
>>>>>>>> />>>/             case "sip:192.168.1.2":
>>>>>>>> />>>/                 xlog("reg destination address is $du\n");
>>>>>>>> />>>/                 t_replicate("sip:192.168.1.2");
>>>>>>>> />>>/             break;
>>>>>>>> />>>/             case "sip:192.168.1.3":
>>>>>>>> />>>/                 xlog("reg destination address is $du\n");
>>>>>>>> />>>/                 t_replicate("sip:192.168.1.3");
>>>>>>>> />>>/             break;
>>>>>>>> />>>/             case "sip:192.168.1.4":
>>>>>>>> />>>/                 xlog("reg destination address is $du\n");
>>>>>>>> />>>/                 t_replicate("sip:192.168.1.4");
>>>>>>>> />>>/             break;
>>>>>>>> />>>/             default:
>>>>>>>> />>>/                 xlog("Dispatching Reg failed: $du\n");
>>>>>>>> />>>/                 sl_reply_error();
>>>>>>>> />>>/             break;
>>>>>>>> />>>/        }
>>>>>>>> />>>/ exit;
>>>>>>>> />>>/ />>>/ Not the cleanest way of doing it, but it works.
>>>>>>>> />>>/ />>>/ />>>/ />>>/ Thanks,
>>>>>>>> />>>/ Jody Rudolph
>>>>>>>> />>>/ />>>>/ />>>/ />>>/ _______/
>>>>>>>> 
>>>>>>>> 
>>>>>>>> 
>>>>>>>> ------------------------------------------------------------------------
>>>>>>>> 
>>>>>>>> _______________________________________________
>>>>>>>> Users mailing list
>>>>>>>> Users at lists.opensips.org <mailto:Users at lists.opensips.org>
>>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>> 
>>>>>>>>                       
>>>>>>> -- 
>>>>>>> Bogdan-Andrei Iancu
>>>>>>> OpenSIPS Event - expo, conf, social, bootcamp
>>>>>>> 2 - 4 February 2011, ITExpo, Miami,  USA
>>>>>>> www.voice-system.ro <http://www.voice-system.ro>
>>>>>>> 
>>>>>>> 
>>>>>>> _______________________________________________
>>>>>>> Users mailing list
>>>>>>> Users at lists.opensips.org
>>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>>                   
>>>>>> ------------------------------------------------------------------------
>>>>>> 
>>>>>> _______________________________________________
>>>>>> Users mailing list
>>>>>> Users at lists.opensips.org
>>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>>                
>>>>> -- 
>>>>> Bogdan-Andrei Iancu
>>>>> OpenSIPS Event - expo, conf, social, bootcamp
>>>>> 2 - 4 February 2011, ITExpo, Miami,  USA
>>>>> www.voice-system.ro
>>>>> 
>>>>> 
>>>>> _______________________________________________
>>>>> Users mailing list
>>>>> Users at lists.opensips.org
>>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>>>           
>>>> _______________________________________________
>>>> Users mailing list
>>>> Users at lists.opensips.org
>>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>> 
>>>>       
>>> -- 
>>> Bogdan-Andrei Iancu
>>> OpenSIPS Event - expo, conf, social, bootcamp
>>> 2 - 4 February 2011, ITExpo, Miami,  USA
>>> www.voice-system.ro
>>> 
>>> 
>>> _______________________________________________
>>> Users mailing list
>>> Users at lists.opensips.org
>>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>>    
>> 
>> 
>> _______________________________________________
>> Users mailing list
>> Users at lists.opensips.org
>> http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>> 
>>  
> 
> 
> -- 
> Bogdan-Andrei Iancu
> OpenSIPS Event - expo, conf, social, bootcamp
> 2 - 4 February 2011, ITExpo, Miami,  USA
> www.voice-system.ro
> 
> 
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users




More information about the Users mailing list