[OpenSIPS-Users] R: R: R: R: R: R: R: serialize_branches() and q value....
Bogdan-Andrei Iancu
bogdan at voice-system.ro
Tue Mar 10 21:41:40 CET 2009
Hi Mauro,
There are some fishy things here.
1) the Q for user3 is 300 (as per DB example) and not 299 (as per logs)
2) the branches (in log) are not q ordered.
3) the flags don't seam to be correctly set.
I made on 1.5 a fix (related to (2)) - could you please update and re-test.
Regards,
Bogdan
Mauro Davi' wrote:
> Hi Bogdan,
>
> I update the source code from the svn and I do the test.
>
> The qvalue are now loaded correctly from the database, how you can see below:
>
> Mar 10 15:17:07 [8789] DBG:core:serialize_branches: loaded <sip:user1 at 192.168.193.54:33680;rinstance=323bd97f8a0dae2e<99><99><99>ÃÃÃÃÃïë>, q=100 q_fl<0>
> Mar 10 15:17:07 [8789] DBG:core:serialize_branches: loaded <sip:user3 at 192.168.193.60:6651;rinstance=312f0937682fe662>, q=299 q_flag <16>
> Mar 10 15:17:07 [8789] DBG:core:serialize_branches: loaded <sip:user2 at 192.168.193.61:6328;rinstance=88793931d487ca32>, q=200 q_flag <0>
>
> But when in the failure_route I call the next_branches() function the result is:
>
> Mar 10 15:17:16 [8795] DBG:core:next_branches: branch is <sip:user2 at 192.168.193.61:6328;rinstance=88793931d487ca32>
> params(0xb5f83000, 0xb6198524), called from usr_avp.c: destroy_avp(352)
> freeing frag. 0xb619850c alloc'ed from usr_avp.c: add_avp(116)
> Mar 10 15:17:16 [8795] DBG:core:next_branches: branch is <sip:user3 at 192.168.193.60:6651;rinstance=312f0937682fe662>
> params(0xb5f83000, 0xb61984a8), called from usr_avp.c: destroy_avp(352)
> freeing frag. 0xb6198490 alloc'ed from usr_avp.c: add_avp(116)
>
> i.e. the second call is a parallel fork with user2 and user 3... and not a serialized call to user2...
>
> I think that the bug is present yet.... But now the problem is in the next_branches function where the qvalue aren't correctly stored...
>
> Best regards
> MD
>
> -----Messaggio originale-----
> Da: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
> Inviato: lunedì 9 marzo 2009 13:40
> A: Mauro Davi'
> Cc: users at lists.opensips.org
> Oggetto: Re: R: R: R: R: [OpenSIPS-Users] R: R: serialize_branches() and q value....
>
> Hi Mauro,
>
> indeed there is a issue here. The Q value for the default branch (the
> RURI) was not properly pushed into the branches.....I made a fix on SVN
> - could you please update and give it another try?
>
> Thanks and regards,
> Bogdan
>
> Mauro Davi' wrote:
>
>> Hi Bogdan,
>>
>> yes I use usrloc module with DB MODE set to 3.
>>
>> I have 4 UAC registered to the system.
>> After the registration procedure I modified, manually, the q value on the DB, in the location table, in the following way:
>>
>> Username Domain q
>>
>> User1 domain.com 0.10
>> User2 domain.com 0.20
>> User3 domain.com 0.30
>>
>> The executed script code is the following:
>>
>> seturi("sip:user1 at domain.com");
>> lookup("location");
>> append_branch();
>> seturi("sip:user2 at domain.com");
>> lookup("location");
>> append_branch()
>> seturi("sip:user3 at domain.com");
>> lookup("location");
>> serialize_branches();
>> t_relay();
>>
>> The on_failureroute function is:
>>
>> failure_route[1]{
>> if ( next_branches() )
>> t_relay();
>> }
>>
>> This is the log result...
>>
>> Mar 5 14:47:10 [32494] DBG:core:serialize_branches: loaded <sip:user2 at 192.168.193.61:6500;rinstance=f846856f765b6605>, q=-1 q_flag <0>
>> Mar 5 14:47:10 [32494] DBG:core:serialize_branches: loaded <sip:user1 at 192.168.193.60:7020;rinstance=2f7556d27898c691>, q=-1 q_flag <0>
>> Mar 5 14:47:10 [32494] DBG:core:serialize_branches: loaded <sip:user3 at 192.168.193.54:6638;rinstance=721b473849350f3c>, q=299 q_flag <16>
>>
>> It isn't correct because user1 must have q value equal to 100 and user2 must have qvalue equal to 200... Only the last added sip uri (sip:user3 at domain.com) have the correct DB q value.
>>
>> The result was a serialization of two call. The first one to user3, and the second one a parallal fork to user1 and user2...
>>
>> Regards
>> MD
>>
>> P.S. there is a way to modify the qvalue associated to a sip uri or it is possible only in registration phase? Thanks.
>>
>> -----Messaggio originale-----
>> Da: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
>> Inviato: giovedì 5 marzo 2009 10:25
>> A: Mauro Davi'; users at lists.opensips.org
>> Oggetto: Re: R: R: R: [OpenSIPS-Users] R: R: serialize_branches() and q value....
>>
>> Do you use usrloc module with DB_MODE 3 (DB_ONLY) and manually add the
>> records in the location table? If so, what is the exact content you put
>> in the table? (maybe the q value is not properly filled).
>>
>> Regards,
>> Bogdan
>>
>> Mauro Davi' wrote:
>>
>>
>>> Yes, if I invoke lookup(location) more than one time...
>>>
>>> -----Messaggio originale-----
>>> Da: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
>>> Inviato: martedì 3 marzo 2009 18:34
>>> A: Mauro Davi'
>>> Cc: users at lists.opensips.org
>>> Oggetto: Re: R: R: [OpenSIPS-Users] R: R: serialize_branches() and q value....
>>>
>>> you mean by lookup(location) ?
>>>
>>> Regards,
>>> Bogdan
>>>
>>> Mauro Davi' wrote:
>>>
>>>
>>>
>>>> Hi Bogdan,
>>>>
>>>> yes I did in this way... But the problem, I think, is that the qvalue aren't loaded correctly from the DB.
>>>>
>>>> Regards,
>>>> MD
>>>>
>>>> -----Messaggio originale-----
>>>> Da: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
>>>> Inviato: martedì 3 marzo 2009 18:06
>>>> A: Mauro Davi'
>>>> Cc: users at lists.opensips.org
>>>> Oggetto: Re: R: [OpenSIPS-Users] R: R: serialize_branches() and q value....
>>>>
>>>> Hi Mauro,
>>>>
>>>> serialize_branches() just prepare the sets.
>>>>
>>>> To use the sets (for each q value) you need to call next_branches().
>>>>
>>>> So, the algorithm should be like this:
>>>>
>>>> route{
>>>> serialize_branches()
>>>>
>>>> next_branches();
>>>>
>>>> t_on_failure("1");
>>>>
>>>> t_relay();
>>>> }
>>>>
>>>> failure_route[1]{
>>>> if ( next_branches() )
>>>> t_relay();
>>>> }
>>>>
>>>> Regards,
>>>> Bogdan
>>>>
>>>> Mauro Davi' wrote:
>>>>
>>>>
>>>>
>>>>
>>>>> Hi Bodan,
>>>>>
>>>>> I think that the serial fork have some problem.
>>>>>
>>>>> On the DB I modified the q value of two user
>>>>>
>>>>> User1, qvalue=0.1
>>>>> User2, qvalue=0.2
>>>>>
>>>>> I insert in the script the following line of code:
>>>>>
>>>>> $ru=user1 at domain.com
>>>>> Lookup("location");
>>>>> Append_branch();
>>>>> $ru=user2 at domain.com
>>>>> Lookup("location");
>>>>> Serialize_branches();
>>>>> T_relay();
>>>>>
>>>>> The result was:
>>>>>
>>>>> Mar 2 17:36:53 [26014] DBG:core:serialize_branches: loaded <sip:user1 at 192.168.193.54:6685;rinstance=0f314641b36adb7d>, q=-1 q_flag <0>
>>>>> Mar 2 17:36:53 [26014] DBG:core:serialize_branches: loaded <sip:user2 at 192.168.193.73:54218;rinstance=e70bfc2dadad8857>, q=100 q_flag <16>
>>>>>
>>>>> The call are correctly serialized but if I add three destinations the result was:
>>>>>
>>>>> Mar 2 17:42:04 [26014] DBG:core:serialize_branches: loaded <sip:user1 at 192.168.193.54:6685;rinstance=0f314641b36adb7d>, q=-1 q_flag <0>
>>>>> Mar 2 17:42:04 [26014] DBG:core:serialize_branches: loaded <sip:user2 at 192.168.193.73:54218;rinstance=e70bfc2dadad8857>, q=-1 q_flag <0>
>>>>> Mar 2 17:42:04 [26014] DBG:core:serialize_branches: loaded <sip:user3 at 192.168.193.71:54218;rinstance=e70bfc2dadad8857>, q=100 q_flag <16>
>>>>>
>>>>> The qvalue aren't inserted correctly...
>>>>>
>>>>> Is it a bug?
>>>>>
>>>>> Thanks in advance
>>>>> MD
>>>>>
>>>>> -----Messaggio originale-----
>>>>> Da: users-bounces at lists.opensips.org [mailto:users-bounces at lists.opensips.org] Per conto di Bogdan-Andrei Iancu
>>>>> Inviato: giovedì 26 febbraio 2009 19:08
>>>>> A: Mauro Davi'
>>>>> Cc: users at lists.opensips.org
>>>>> Oggetto: Re: [OpenSIPS-Users] R: R: serialize_branches() and q value....
>>>>>
>>>>> Hi Mauro,
>>>>>
>>>>> you have to ways to go:
>>>>>
>>>>> 1) use the @domain.com URIs and relay them back to your proxy in order
>>>>> to do lookup
>>>>>
>>>>> 2) try to do lookup directly in the first step - the logic you tried.
>>>>> But to work replace the
>>>>> append_branch("$ru","0.1");
>>>>> with
>>>>> append_branch();
>>>>>
>>>>> this will take the RURI and add it as a branch, so you can override it
>>>>> with the next user2 URI.
>>>>>
>>>>> Regards,
>>>>> Bogdan
>>>>>
>>>>> Mauro Davi' wrote:
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>> Hi Bogdan,
>>>>>>
>>>>>> I have a little problem...
>>>>>>
>>>>>> In this way I can serialize a set of know called party (i.e. with the sip address in the form sip:username at ipaddress:port)...
>>>>>>
>>>>>> But I cannot add, for example the following branch:
>>>>>>
>>>>>> Append_branch("sip:user1 at domain.com","0.1")
>>>>>> Append_branch("sip:user2 at domain.com","0.2")
>>>>>> Append_branch("sip:user3 at domain.com","0.3")
>>>>>>
>>>>>> Because the result is a misrouted call (i.e. the requested sip uri isn't reacheable...).
>>>>>>
>>>>>> So I thought to add a RURI after invoked the lookup function...
>>>>>>
>>>>>> Somethink like this:
>>>>>>
>>>>>> $ru="sip:user1 at domain.com";
>>>>>> lookup("location");
>>>>>> #Now $ru contain the resolved URI of user1
>>>>>> append_branch("$ru","0.1");
>>>>>> $ru="sip:user2 at domain.com";
>>>>>> lookup("location");
>>>>>> #Now $ru contain the resolved URI of user2
>>>>>> append_branch("$ru","0.2");
>>>>>> $ru="sip:user3 at domain.com";
>>>>>> lookup("location");
>>>>>> #Now $ru contain the resolved URI of user3
>>>>>> append_branch("$ru","0.3");
>>>>>>
>>>>>> But I didn't had the expected result... I cannot use pseudo-variable in the append_branch function...
>>>>>>
>>>>>> Could you tell me how I can solve this problem? There is a work-around? Or is there a correct way to call a group of user associated to a SIP URI via serial forking?
>>>>>>
>>>>>> Thank in andvance
>>>>>> MD
>>>>>>
>>>>>> -----Messaggio originale-----
>>>>>> Da: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
>>>>>> Inviato: mercoledì 25 febbraio 2009 15:14
>>>>>> A: Mauro Davi'
>>>>>> Cc: users at lists.opensips.org
>>>>>> Oggetto: Re: R: [OpenSIPS-Users] serialize_branches() and q value....
>>>>>>
>>>>>> Hi Mauro,
>>>>>>
>>>>>> (sorry for mistyping your name in the first place)
>>>>>>
>>>>>> the correct way to inject a q value via the append_branch is:
>>>>>> Append_branch("sip:user2 at domain.com", 10 );
>>>>>>
>>>>>> Regards,
>>>>>> Bogdan
>>>>>>
>>>>>>
>>>>>> Mauro Davi' wrote:
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>>> Hi Bogdan,
>>>>>>>
>>>>>>> Thanks for the reply. But I have only one question...
>>>>>>>
>>>>>>> Is it possible to set the branches qvalue from a script code?
>>>>>>>
>>>>>>> I try samething like:
>>>>>>>
>>>>>>> Append_branch();
>>>>>>> $ru="sip:user2 at domain.com;q=0.1"
>>>>>>>
>>>>>>> Or:
>>>>>>>
>>>>>>> Append_branch("sip:user2 at domain.com;q=0.1");
>>>>>>>
>>>>>>> But the log result is ever:
>>>>>>>
>>>>>>> "DBG:core:serialize_branches: nothing to do - all same q!"
>>>>>>>
>>>>>>> Coould you help me, please?
>>>>>>>
>>>>>>> Thanks a lot
>>>>>>> MD
>>>>>>>
>>>>>>>
>>>>>>> -----Messaggio originale-----
>>>>>>> Da: Bogdan-Andrei Iancu [mailto:bogdan at voice-system.ro]
>>>>>>> Inviato: mercoledì 25 febbraio 2009 14:54
>>>>>>> A: Mauro Davi'
>>>>>>> Cc: users at lists.opensips.org
>>>>>>> Oggetto: Re: [OpenSIPS-Users] serialize_branches() and q value....
>>>>>>>
>>>>>>> Hi Marco,
>>>>>>>
>>>>>>> before getting into your script, just some important notice about SIP,
>>>>>>> forking and q value...
>>>>>>>
>>>>>>> According to RFC 3261 (and how the serialize_branches() works), when you
>>>>>>> have a set of destinations with different q values, the forking must
>>>>>>> work like this:
>>>>>>>
>>>>>>> 1) order the entire set based on the q value
>>>>>>> 2) select all dsts that have as q value the min q val from the set (of
>>>>>>> course all of the selected dsts will have the q)
>>>>>>> 3) do parallel forking with the selected dsts
>>>>>>> 4) if still failed, remove the used dsts and go back to step 2 (serial
>>>>>>> forking).
>>>>>>>
>>>>>>>
>>>>>>> So, this is actually a combination of serial and parallel forking - the
>>>>>>> dsts with different q will be serial forked, but dsts with the same q
>>>>>>> will be parallel forked.
>>>>>>>
>>>>>>> Regards,
>>>>>>> Bogdan
>>>>>>>
>>>>>>> Mauro Davi' wrote:
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>>> Hi All,
>>>>>>>>
>>>>>>>> I saw the documentation but it is to much difficult for me J (really I
>>>>>>>> think that the folloeing information is missed...), so I have a question.
>>>>>>>>
>>>>>>>> The below script code add two new destination to my voip platform,
>>>>>>>> parallel at domain.com and serial at domain.com <mailto:serial at domain.com>.
>>>>>>>>
>>>>>>>> The first one works great, but the second one have the same behaviour
>>>>>>>> of the first one...
>>>>>>>>
>>>>>>>> The question is: How I can specify the q value of every branches?
>>>>>>>>
>>>>>>>> Thanks in advance.
>>>>>>>>
>>>>>>>> MD
>>>>>>>>
>>>>>>>> if(uri=~"^sip:parallel@" || uri=~"^sip:serial@" )
>>>>>>>>
>>>>>>>> {
>>>>>>>>
>>>>>>>> xlog("L_INFO","Check passed!!!\n");
>>>>>>>>
>>>>>>>> $var(i)=0;
>>>>>>>>
>>>>>>>> while ($var(i) < 2)
>>>>>>>>
>>>>>>>> {
>>>>>>>>
>>>>>>>> xlog("L_INFO","Cycle Enter $var(i), RURI:$ru\n");
>>>>>>>>
>>>>>>>> if ($var(i) == 0)
>>>>>>>>
>>>>>>>> {
>>>>>>>>
>>>>>>>> $ru="sip:user1 at domain.com";
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> else
>>>>>>>>
>>>>>>>> {
>>>>>>>>
>>>>>>>> append_branch();
>>>>>>>>
>>>>>>>> $ru="sip:user2 at domain.com";
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> alias_db_lookup("dbaliases");
>>>>>>>>
>>>>>>>> if (is_uri_host_local())
>>>>>>>>
>>>>>>>> {
>>>>>>>>
>>>>>>>> # -- Inbound to inbound
>>>>>>>>
>>>>>>>> if(uri=~"^sip:[0-9]+@")
>>>>>>>>
>>>>>>>> {
>>>>>>>>
>>>>>>>> # only route numeric users to PSTN
>>>>>>>>
>>>>>>>> t_on_failure("2");
>>>>>>>>
>>>>>>>> route(5);
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> route(6);
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> else
>>>>>>>>
>>>>>>>> {
>>>>>>>>
>>>>>>>> # -- Inbound to outbound
>>>>>>>>
>>>>>>>> # Here we must check the to domain to verify if
>>>>>>>>
>>>>>>>> # we can send the request to a corporate SBC
>>>>>>>>
>>>>>>>> sl_send_reply("403", "Forbidden");
>>>>>>>>
>>>>>>>> exit;
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> $var(i) = $var(i) + 1;
>>>>>>>>
>>>>>>>> xlog("L_INFO","Cycle Leave $var(i), RURI:$ru");
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> if (uri=~"^sip:serial@")
>>>>>>>>
>>>>>>>> {
>>>>>>>>
>>>>>>>> setbflag(10);
>>>>>>>>
>>>>>>>> serialize_branches(1);
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> route(3);
>>>>>>>>
>>>>>>>> exit;
>>>>>>>>
>>>>>>>> }
>>>>>>>>
>>>>>>>> ------------------------------------------------------------------------
>>>>>>>>
>>>>>>>> _______________________________________________
>>>>>>>> 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
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>>
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>>
>>
>>
>
>
>
More information about the Users
mailing list