[OpenSIPS-Users] prioritizing branches by usrloc flag

Bogdan-Andrei Iancu bogdan at opensips.org
Mon Oct 26 21:31:14 CET 2015


Hi Tito,

yes, the first contact is pushed into RURI and not into contacts. So 
additionally you need to check that too. See:
http://www.opensips.org/Documentation/Script-CoreVar-1-11#toc77

After 1) did lookup(location) and 2) set the new q values , do 
serialize_branches() -> this will re-arrange them according to the q 
value. See :
http://www.opensips.org/Documentation/Script-CoreFunctions-1-11#toc44

Regards,

Bogdan-Andrei Iancu
OpenSIPS Founder and Developer
http://www.opensips-solutions.com

On 21.10.2015 03:48, Tito Cumpen wrote:
> Bogdan,
>
>
> I tried this
>
> $var(i) = 0;
>
> while ($(branch(uri)[$var(i)]) != null && $var(i) < 5) {
>
> xlog("$$(branch(uri)[$var(i)])=[$(branch(uri)[$var(i)])]\n");
>
>    if ($(branch(uri)[$var(i)]{uri.transport}) == "ws") {
>
>        xlog(" ws branch found number $var(i) with 
> URI=[$(branch(uri)[$var(i)])]\n");
>
>        #remove_branch($var(i));
>
>        $(branch(q)[$var(i)]) = 380;
>
>         xlog("$(branch(q)[$var(i)]) confirming q value for branch 
> $(branch(uri)[$var(i)])\n");
>
>
>    } else {
>
>        $var(i) = $var(i) + 1;
>
>    }
>
>         xlog("$(branch(duri)[*]) finished looping through all 
> branches\n");
>
> }
>
>
>
> but it appears that lookup will only provide the every other branch 
> that isn't the first. I can't control which AOR is added first or 
> second which I must do to prioritize ws . Is there anyway to access 
> all of those contacts and put them in an array? I am hitting a max 
> while loop error here when there is more than one aor. by default all 
> records get a q value of 1. So I am attempting to go under the value 
> for all ws aor contacts and serial fork. Hopefully I'll be able to 
> call all ws contacts in parallel then all standard sip clients in 
> parallel as they all should posses a q value of 1.
>
>
> Thanks,
>
> Tito
>
>
>
>
>
> On Tue, Jul 7, 2015 at 7:01 AM, Bogdan-Andrei Iancu 
> <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>
>     Hi Tito,
>
>     Try $(branch(uri)[x]{uri.transport}) to get the transport param
>     from the URI.
>
>     Or, look into the $(branch(socket)[x]{s.select,0,:}) - the proto
>     of the sending socket.
>
>     Regards,
>
>     Bogdan-Andrei Iancu
>     OpenSIPS Founder and Developer
>     http://www.opensips-solutions.com
>
>     On 07.07.2015 12:14, Tito Cumpen wrote:
>>     Bogdan,
>>
>>
>>     Thanks for your reply. These variables seem like a step in the
>>     right direction although it raises another question as to how to
>>     access the branches and check the destination proto. How does one
>>     access the array of branches? Would they have to be casted and
>>     lopped and checked against a regex? *dP seems to provide the
>>     proto but what would be provided in the case of various
>>     destination protos as in the case of sip and ws?*
>>     *
>>     *
>>     *
>>     *
>>     *Thanks,*
>>     *Tito*
>>
>>     On Thu, Jul 2, 2015 at 9:31 AM, Bogdan-Andrei Iancu
>>     <bogdan at opensips.org <mailto:bogdan at opensips.org>> wrote:
>>
>>         Hi Tito,
>>
>>         The registrar module (responsible for extracting the contacts
>>         from SIP msg and storing into USRLOC) takes the q value from
>>         the Contact header (as SIP RFC requires).
>>         Currently there is no way to change the q value (from script
>>         level) before saving into USRLOC.
>>
>>         But what you can do is to change the q values after the
>>         lookup (when loaded into msg from USRLOC).
>>
>>         Take a look at branch variable $branch(q) :
>>         http://www.opensips.org/Documentation/Script-CoreVar-2-1#toc22
>>         and $ru_q (q value for RURI) :
>>         http://www.opensips.org/Documentation/Script-CoreVar-2-1#toc77
>>
>>         and you may change the q values and do a serialize_branches()
>>         after that.
>>
>>         Best regards,
>>
>>         Bogdan-Andrei Iancu
>>         OpenSIPS Founder and Developer
>>         http://www.opensips-solutions.com
>>
>>         On 01.07.2015 19:57, Tito Cumpen wrote:
>>>         Group,
>>>
>>>
>>>         Is it possible to set the q value upon registration? I need
>>>         to set ws destinations to a lower q value as rtpengine has a
>>>         limitation on sending different media params on a per branch
>>>         basis in parallel. Or should I loop into the branches with a
>>>         certain attribute and order them before serializing them?
>>>
>>>
>>>
>>>         _______________________________________________
>>>         Users mailing list
>>>         Users at lists.opensips.org  <mailto:Users at lists.opensips.org>
>>>         http://lists.opensips.org/cgi-bin/mailman/listinfo/users
>>
>>
>
>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.opensips.org/pipermail/users/attachments/20151026/c7730d4b/attachment.htm>


More information about the Users mailing list