[SR-Users] [EXTERNAL] Re: Dispatcher attributes
Jason.Park
Jason.Park at target.com
Thu Jan 10 17:37:21 CET 2019
Joel:
Thanks for the assist. Works just the way I was looking for.
Thanks!
Jason Park | Lead Engineer | Voice Services | • Target<http://www.target.com/> | TNC | 816-273-8336
From: sr-users <sr-users-bounces at lists.kamailio.org> on behalf of Joel Serrano <joel at textplus.com>
Reply-To: "Kamailio (SER) - Users Mailing List" <sr-users at lists.kamailio.org>
Date: Wednesday, January 9, 2019 at 9:55 PM
To: "Kamailio (SER) - Users Mailing List" <sr-users at lists.kamailio.org>
Subject: [EXTERNAL] Re: [SR-Users] Dispatcher attributes
Jason,
My answer applies to the XAVP of the xavp_dst modparam, sorry!
If you are accessing the PV of the attrs_pvname modparam, then you don't need to select the attributes, just directly use the transformation. Also, not sure if you can use XAVPs there, AFAIR it only accepted AVPs/VARs. Maybe someone else can confirm that...
Anyway, to make it clear:
Say you have the following modparams:
...
modparam("dispatcher", "xavp_dst", "_dsdst_")
modparam("dispatcher", "attrs_pvname", "$var(attrs)")
...
Depending on what ds_* function you call, one or the other will be set.
For the "attr1" from your example, you would need to use (again, depending on the dispatcher function called):
$(var(attrs){param.value,attr1})
or
$(xavp(_dsdst_=>attrs){param.value,attr1})
Sorry for the confusion!
Joel.
On Wed, Jan 9, 2019 at 7:45 PM Joel Serrano <joel at textplus.com<mailto:joel at textplus.com>> wrote:
On Wed, Jan 9, 2019 at 7:12 PM Joel Serrano <joel at textplus.com<mailto:joel at textplus.com>> wrote:
Hi Jason,
When you access the XAVP you are getting all the parameters defined. You can make use of the transformations [1] to select an individual value of an attribute.
In your example, it would be something along:
$(xavp(ds_attrs=>attrs){param.value,attr1})
Where you are making use of transformations, specifically the "param.value" [2] to select the value of attribute "attr1".
[1] https://www.kamailio.org/wiki/cookbooks/5.2.x/transformations
[2] https://www.kamailio.org/wiki/cookbooks/5.2.x/transformations#paramvalue_name_delimiter
Hope it helps!
Joel.
On Wed, Jan 9, 2019 at 6:56 PM Joel Serrano <joel at textplus.com<mailto:joel at textplus.com>> wrote:
Hi Jason,
We are doing that and it works. I’ll send you a snippet when I get home..
On Wed, Jan 9, 2019 at 13:32 Jason.Park <Jason.Park at target.com<mailto:Jason.Park at target.com>> wrote:
Hi.
When using the attributes feature of the dispatcher module, is it possible to directly access/address an individual attribute directly?
For example, if I use the following dispatcher text file:
--
# line format
# setid(int) destination(sip uri) flags(int,opt) priority(int,opt) attributes(str,opt)
1234 sip:10.10.10.10:5060;transport=tcp 0 0 attr1=red;attr2=blue
--
And this config snippet, I was hoping to be able to access the attribute with a variable.
--
modparam("dispatcher", "attrs_pvname", "$vxavp(ds_attrs)")
if(ds_is_from_list(1234,1)) {
x_log(“L_NOTICE”,”attr1: $xavp(ds_attrs=>attr1)\n”);
}
--
Jason Park | Lead Engineer | Voice Services | • Target<http://www.target.com/> | TNC | 816-273-8336
_______________________________________________
Kamailio (SER) - Users Mailing List
sr-users at lists.kamailio.org<mailto:sr-users at lists.kamailio.org>
https://lists.kamailio.org/cgi-bin/mailman/listinfo/sr-users
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.kamailio.org/pipermail/sr-users/attachments/20190110/01ca5125/attachment.html>
More information about the sr-users
mailing list