[OpenSIPS-Users] R: serialize_branches() and q value....
Mauro Davi'
mauro.davi at acotel.com
Wed Feb 25 15:01:39 CET 2009
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
>
More information about the Users
mailing list