[SR-Users] append_branch with pseudo variables

Carlos Ruiz Díaz carlos.ruizdiaz at gmail.com
Fri Aug 17 22:55:11 CEST 2012


I figured out what was happening.

By doing "$(branch(q)[1]) = "0.1";" I was trying to write into an non
existent branch since 1 is actually the second branch because the main
branch ($ru)  is not counted.

$(branch(q)[0]) = "0.1" // is the 1st.
$(branch(q)[1]) = "0.1" // is the 2nd.

Regards.

Carlos.

On Fri, Aug 17, 2012 at 4:32 PM, Carlos Ruiz Díaz <carlos.ruizdiaz at gmail.com
> wrote:

> I can't set any of the attributes values using the assignment syntax.
> Everytime I do:
>
> $(branch(q)[1]) = "0.1";
>
> I get
>
> ERROR: <core> [lvalue.c:354]: setting pvar failed.
>
> This is true for all attributes, nut just for "q".
>
> Am I doing something wrong? I'm using Kamailio 3.2.3.
>
> Regards.
>
> Carlos.
>
>
> On Fri, Aug 17, 2012 at 11:38 AM, Carlos Ruiz Díaz <
> carlos.ruizdiaz at gmail.com> wrote:
>
>> I'll try that :).
>>
>> Thanks for your help.
>>
>> Carlos.
>>
>>
>> On Fri, Aug 17, 2012 at 5:30 AM, Daniel-Constantin Mierla <
>> miconda at gmail.com> wrote:
>>
>>>
>>> On 8/16/12 10:50 PM, Carlos Ruiz Díaz wrote:
>>>
>>>
>>>
>>> On Thu, Aug 16, 2012 at 4:30 PM, Daniel-Constantin Mierla <
>>> miconda at gmail.com> wrote:
>>>
>>>>
>>>> On 8/16/12 9:15 PM, Carlos Ruiz Díaz wrote:
>>>>
>>>> Looks like km_append_branch() doesn't have all of the signatures that
>>>> the original append_branch() has. I can't add q values for serial/parallel
>>>> forking with km_append_branch().
>>>>
>>>>  What signature are you looking for?
>>>>
>>>
>>>  The latter is the one I'm looking for, but with the possibility of
>>> using pseudovars.
>>>
>>>  append_branch() overloads:
>>>
>>>  - append_branch();
>>> - append_branch("sip:a at abc.com");
>>> - append_branch("sip:a at abc.com", "0.1");
>>>
>>>
>>> I am considering adding the second parameter to km_append_branch() for
>>> backward compatibility reasons.
>>>
>>> Alternative is to use $branch(...) variable to set the q after you
>>> called append branch:
>>>
>>>
>>> http://www.kamailio.org/wiki/cookbooks/3.3.x/pseudovariables#branch_attributes
>>>
>>> Q has to be set via integer value, with range from 0 to 100 (0.1 would
>>> be 10).
>>>
>>>
>>>
>>>
>>>  Also, apparently there's no way of setting the RURI by calling a
>>> function that does that.
>>>
>>>
>>>   What do you mean here? I don't understand.
>>>>
>>>
>>>  I'm was talking about setting the request-uri from a PV.
>>>
>>>  For example: seturi("$var(my_uri)");
>>>
>>>  But it works using assignation.
>>>
>>>  $ru = $var(my_uri);
>>>
>>>
>>> The core functions were added before the existence of cfg variables,
>>> they take only static strings as parameters. The way to do it is via
>>> assignments.
>>>
>>> Cheers,
>>> Daniel
>>>
>>>
>>>
>>>
>>>
>>>>
>>>> Cheers,
>>>> Daniel
>>>>
>>>>
>>>>  I guess I'll have to do it using assignation on $ru pseudovariable and
>>>> writing a route to manage the serial forking I need.
>>>>
>>>>  Thanks.
>>>>
>>>>  Carlos.
>>>>
>>>> On Thu, Aug 16, 2012 at 2:17 PM, Carlos Ruiz Díaz <
>>>> carlos.ruizdiaz at gmail.com> wrote:
>>>>
>>>>> Great! I'll give it a try.
>>>>>
>>>>>  Thanks!
>>>>>
>>>>>  Carlos.
>>>>>
>>>>>
>>>>> On Thu, Aug 16, 2012 at 12:13 PM, Daniel-Constantin Mierla <
>>>>> miconda at gmail.com> wrote:
>>>>>
>>>>>> Hello,
>>>>>>
>>>>>>
>>>>>>
>>>>>> On 8/16/12 5:25 PM, Carlos Ruiz Díaz wrote:
>>>>>>
>>>>>>> Hello guys,
>>>>>>>
>>>>>>> Why I can only append_branch() a SIP URI as a literal constant
>>>>>>> string? Why not from a pseudovariable? It's the same for most of the core
>>>>>>> functions.
>>>>>>>
>>>>>>> My intention is to do something like this:
>>>>>>>
>>>>>>> append_branch("$cnx3a(route1)");
>>>>>>> t_relay();
>>>>>>>
>>>>>>> where cnx3a is a variable containing the SIP URIs.
>>>>>>>
>>>>>>> The only "fix" I have found for this is by doing it as follows:
>>>>>>>
>>>>>>> $ru = $cnx3a(route1);
>>>>>>> append_branch();
>>>>>>> t_relay();
>>>>>>>
>>>>>>> Is there any other (and more elegant) way?
>>>>>>>
>>>>>>
>>>>>>  you can use km_append_branch:
>>>>>>
>>>>>> http://kamailio.org/docs/modules/stable/modules_k/kex.html#id2551404
>>>>>>
>>>>>> Cheers,
>>>>>> Daniel
>>>>>>
>>>>>> --
>>>>>> Daniel-Constantin Mierla - http://www.asipto.com
>>>>>> http://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>>>> Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 -
>>>>>> http://asipto.com/u/katu
>>>>>> Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 -
>>>>>> http://asipto.com/u/kpw
>>>>>>
>>>>>>
>>>>>
>>>>
>>>> --
>>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>>> Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
>>>> Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw
>>>>
>>>>
>>>
>>> --
>>> Daniel-Constantin Mierla - http://www.asipto.comhttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>>> Kamailio Advanced Training, Seattle, USA, Sep 23-26, 2012 - http://asipto.com/u/katu
>>> Kamailio Practical Workshop, Netherlands, Sep 10-12, 2012 - http://asipto.com/u/kpw
>>>
>>>
>>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20120817/43e013c7/attachment.htm>


More information about the sr-users mailing list