[sr-dev] variable as avp index?

Daniel-Constantin Mierla miconda at gmail.com
Wed Sep 8 09:56:28 CEST 2010


  Hello,

if that is an integer id for avp, then use:

$var(tmp) = 10;

As you wrote is taken as avp with a string name represented by "i:10".

Daniel

On 9/8/10 8:13 AM, Juha Heinanen wrote:
> looks like it is not currently possible to use a variable as avp index.
> for example, statements
>
>      $var(tmp) = "i:10";
>      $avp($var(tmp)) = "value";
>      xlog("L_INFO", "Avp has value $avp(i:10)\n");
>
> produce to syslog
>
> INFO: Avp has value<null>
>
> but if i write xlog like this
>
> xlog("L_INFO", "Avp has value $avp($var(tmp))\n");
>
> i get
>
> INFO: Avp has value value
>
> does this mean that avp name is "$var(tmp)" or what?
>
> anyway, i want to be able to assign values to avps using dynamically
> calculated avp names.  if that is not currently possible, would be it ok
> as a first aid, if i add to some utils module a function that takes a
> param list (p1=v2;p2=v2;...) as argument and assigns avps based on it?
>
> -- juha
>
> _______________________________________________
> sr-dev mailing list
> sr-dev at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-dev

-- 
Daniel-Constantin Mierla
http://www.asipto.com




More information about the sr-dev mailing list