[SR-Users] How to define variable as string explicitly

Alex Balashov abalashov at evaristesys.com
Wed Jun 12 15:53:17 CEST 2013


Hi Mino,

There is no explicit transformation for forcing a value like this to string:

    $var(x) = "1234";

However, I have found this to work:

   $var(x) = "" + "1234";

Also, note that request routes are not functions per se, and do not have 
return values, or local variable scope, or other things that functions 
have.  So, you can't do this:

    $var(matched_prefix) = route(INCOMING_AUTH);

-- Alex

On 06/12/2013 06:10 AM, Mino Haluz wrote:

> Hi,
>
> I need to define variables as string explicitly.
>
> What I have in the code:
>
> in prefix_list is 123,456,789
> $var(matched_prefix) = $(var(prefix_list){s.select,$var(i),,});
>
> then in MAIN route:
>
> $var(matched_prefix) = route(INCOMING_AUTH);
>
> and this check
>
> if ($var(matched_prefix) != "nullprefix")
>
> returns:
>
> WARNING: <core> [rvalue.c:1012]: automatic string to int conversion for
> "nullprefix" failed
> WARNING: <core> [rvalue.c:1916]: rval expression conversion to int
> failed (153,32-153,43)
>
> I would like to have all values as string to avoid these errors.
>
> Thanks,
> Mino
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list
> sr-users at lists.sip-router.org
> http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>


-- 
Alex Balashov - Principal
Evariste Systems LLC
235 E Ponce de Leon Ave
Suite 106
Decatur, GA 30030
United States
Tel: +1-678-954-0670
Web: http://www.evaristesys.com/, http://www.alexbalashov.com/



More information about the sr-users mailing list