[OpenSIPS-Users] Join AVPs?

Tolga Tarhan tolga at netbrains.com
Mon Apr 29 00:58:21 CEST 2013


Thanks, Vlad. That's what I ended up doing. Not the most elegant solution;
perhaps there could be a join() function added?

--
Tolga


On Sun, Apr 28, 2013 at 10:35 AM, Vlad Paiu <vladpaiu at opensips.org> wrote:

>  Hello,
>
> The avp_pushto function is kind of limited in functionality, since the 1st
> param ( the destination ) can only be one of the following
>     *destination = '$ru' ['/'('username'|'domain')] | '$du' | '$br'
>
>
> *The script gives you more flexibility. You can do something like :
>         $var(i) = 0;
>         $avp(result) = "";
>         while ($(avp(uuri)[$var(i)]) != NULL) {
>                 $avp(result) = $avp(result) + $(avp(uuri)[$var(i)]) + ",";
>                 $var(i) = $var(i) + 1;
>         }
>
>
> The $avp(result) will now contain all the values of $avp(test), sepparated
> by commas.
> Then, in order to add that info to a Header in the reply, you can call :
>     append_to_reply("P-Associated-URI: $avp(result) \r\n");
>
> Best Regards,
> Vlad
>
> Pe 4/27/2013 7:12 AM, Tolga Tarhan a scris:
>
> I have an AVP with multiple entires which I'd like to add to a header, but
> I can't for the life of me find a way to do this. It looks like once upon a
> time, avp_pushto could do this, but not anymore.
>
>  Basically, I load an AVP like this:
>
>                  avp_db_load("$avp(userid)/uuid", "$avp(uuri)/$uuri",
> "1");
>
>  And I'm trying to do the equivalent of:
>
>                avp_pushto("$P-Associated-URI/reply", "s:uuri/g");
>
>  Which doesn't seem to work anymore (I can only find reference in old
> docs).
>
>  Using this:
>
>                  append_to_reply("P-Associated-URI: $avp(uuri)\r\n");
>
>  Only adds one of the AVP values, not all.
>
>  The way I see it, there are two ways this could work. Either, I need
> some way to "join" all the AVP values into one new string, or I need a way
> to add a header and have it take all the values and auto-join them in the
> usual SIP way (with comas).
>
>  Can anyone point me in the right direction here?
>
>  Thanks,
> Tolga
>
>
> _______________________________________________
> Users mailing listUsers at lists.opensips.orghttp://lists.opensips.org/cgi-bin/mailman/listinfo/users
>
>
>
> _______________________________________________
> Users mailing list
> 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/20130428/2936a108/attachment.htm>


More information about the Users mailing list