[Serusers] avp_subst for SER + some general rantings about av pairs and lingo...

Greger V. Teigre greger at teigre.com
Tue Jul 18 17:39:15 CEST 2006


Thanks a lot, Michal! :-)
g-)

Michal Matyska wrote:
> Ok, I'll add few words of mine understanding.
>
> There is one major difference between select (@) and AVP($). The select
> is READ-ONLY "function", the AVP could be used as variable ('coz is
> read/write).
>
> The select helps to get direct access to some parts of request within
> the script (like @to, @cseg.method, @msg.["P-anyheader-youwant"]), but
> generally could be seen as function returning a string with certain
> number of parameters.
>
> Each module can extend the syntax the select framework understands
> registering it's own select table. Look on TLS module or db_ops as good
> samples.
>
> The AVPs are sorted into classes and tracks:
> GENERAL class (same for both FROM and TO track)
> DOMAIN class
> USER class
> with one interesting feature, that the AVP accesse by the track prefix
> only is searched in the USER class, if not found in DOMAIN class and
> then in GLOBAL class, so you can define GLOBAL value, which is overrided
> by DOMAIN (if desired) and by USER AVPs.
>
> Small example could make it more understandable:
> # idea in script syntax
> lookup_domain("$td","@ruri"); #load domain attrs with to track based on R-URI
> lookup_user("$tu","@ruri");   #load user attrs with to track based on R-URI
> if (!registerd("$t.uid") && ($t.voicemail)) {t_forward_to("","$voicemail"; drop;}
>
> You can set (admin in domain_attrs and user_attrs) when forwarding to the
> voicemail is desired or not. 
>
> if (... ($t.voicemail)) checks if the AVP exists (in user, domain or
> global class) and if yes, it's value is used as destination for
> forwarded request.
>
> The user and domain classes are hold together with other data in tm
> module, so they are set the same way it were within the on_failure,
> on_reply route blocks. All changes done in onbranch route are disposed.
>
> Michal
>
> On Mon, Jul 17, 2006 at 11:41:18AM +0200, Greger V. Teigre wrote:
>   
>> Note that this is true for SER HEAD (0.10.x). 0.9.x does not have avp_subst.
>> In SER HEAD, a lot of new (and very powerful) avp manipulation functions 
>> were added.  They are created for utilizing the new selector 
>> (@something.part[x]) and the extension of $avp adressing of av pairs.
>>
>> BTW, the lingo is quite technical, I feel...  The @ selectors are 
>> basically pre-defined variables that can be used to address (pretty much 
>> any) parts of the SIP message and manipulate them. Avpairs 
>> (attribute-value pairs) are basically variables (string or integer) that 
>> have a variable name and a variable content.  By using $variable_name 
>> you are referring to a variable with a value. This value can be 
>> collected from the SIP message, it can be manipulated and it can be put 
>> into the reply (or the message to forward).
>> The tricky part is to understand the scope of these variables (main 
>> route, onbranch, onreply, onfailure) and what you can actually do with a 
>> message in each.
>> g-)
>>
>> Luis Silva wrote:
>>     
>>> Hi, avp_subst exists in ser (avp module).
>>>
>>> BTW, is there another better solution for doing the same? tks
>>>
>>>       
>>>> From: "Nuno Ribeiro" <nribeiro82 at gmail.com>
>>>> To: "serusers at iptel.org" <serusers at iptel.org>
>>>> Subject: [Serusers] avp_subst for SER
>>>> Date: Tue, 11 Jul 2006 17:17:52 +0100
>>>>
>>>> Hi all!!
>>>> I notest that openser has a function avp_subst(). Does ser has a 
>>>> function
>>>> with the same purpose?
>>>> I saw the function subst() in the textops but you can only substitute
>>>> something directly in the message,right?.
>>>>
>>>>
>>>> Regards,
>>>>
>>>> -- 
>>>> Nuno Ribeiro
>>>>         
>>>       
> _______________________________________________
> Serusers mailing list
> Serusers at lists.iptel.org
> http://lists.iptel.org/mailman/listinfo/serusers
>
>
>   
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20060718/b8c54a06/attachment.htm>


More information about the sr-users mailing list