[OpenSIPS-Users] string from avp transformation

Liviu Chircu liviu at opensips.org
Wed Jan 23 06:19:57 EST 2019


Hi Alexey,

The first syntax is good, however, notice the following code:

     $avp(in) = "Shop-0 73522222222 3522";
     $avp(in2) = "Office-0  73522222222 3522";
     xlog("XXXX: '$(avp(in){s.select,1, })'\n");
     xlog("XXXX: '$(avp(in2){s.select,1, })'\n");

... and its effect:

Jan 23 13:15:32 [20385] XXXX: '73522222222'
Jan 23 13:15:32 [20385] XXXX: ''

So, in short, there isn't a transformation which is equipped to quickly 
deal with this input.  It looks like you have to implement a "while 
result not empty, select the next index" logic in order to obtain 
parameter number X.  (maybe there's a better solution, but I can't come 
up with it now)

Best regards,

Liviu Chircu
OpenSIPS Developer
http://www.opensips-solutions.com

On 23.01.2019 11:15, Alexey Kazantsev via Users wrote:
> This seems to be what I need, but I can not define a separator
> when it is a whitespace.
>
> https://www.opensips.org/Documentation/Script-Tran-2-4#toc6
>
> I tried:
> $avp(clid){s.substr,1, }
> $avp(clid){s.substr,1,\ }
> $avp(clid){s.substr,1,\\ }
>
> -----------------------------------------------
> BR, Alexey
> http://alexeyka.zantsev.com/
> _______________________________________________
> Users mailing list
> Users at lists.opensips.org
> http://lists.opensips.org/cgi-bin/mailman/listinfo/users



More information about the Users mailing list