[SR-Users] Converting JSON string to normal string

Muhammad Shahzad shaheryarkh at gmail.com
Sat Oct 25 08:41:55 CEST 2014


Thanks, i managed to use s.rm to remove quotes in single shot.

Thank you.

On Fri, Oct 24, 2014 at 3:20 PM, Daniel-Constantin Mierla <miconda at gmail.com
> wrote:

>  Hello,
>
> no transformation to "unquote", at this time probably chaining s.strip and
> s.striptail would be an option.
>
> Adding transformations to "quote" and "unquote" can be useful indeed if
> json operation returns the full value.
>
> Cheers,
> Daniel
>
>
> On 23/10/14 21:02, Muhammad Shahzad wrote:
>
>    Hi,
>
>  Using method json_get_field i am able to extract json string. However,
> this string comes with quotes which cause a hurdle in assigning to various
> pseudo variables, for example,
>
> --
>         json_get_field($redis(r=>value), "to_number",
> "$var(wim_to)");
>         json_get_field($redis(r=>value), "domain",
> "$var(wim_domain)");
>
>         $uac_req(ruri)="sip:" + $var(wim_to) + "@" + $var(wim_domain);
> --
>
> This results in $uac_req(ruri) being set as.
>
> sip:"49XXXXXXXX"@"sip.mydomain.com"
>
>  Which is obviously wrong and fails the transaction processing.
>
>  Is there any way to get rid of these quotes from json strings? One
> possible way i can think of is using string transformation "s.substr", but
> there are a lot of json strings i have in config and it is too hectic to
> transform all of them. Is there any easier way out of this?
>
>  Thank you.
>
>
>
>
> _______________________________________________
> SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing listsr-users at lists.sip-router.orghttp://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users
>
>
> --
> Daniel-Constantin Mierlahttp://twitter.com/#!/miconda - http://www.linkedin.com/in/miconda
>
>
> _______________________________________________
> 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
>
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.sip-router.org/pipermail/sr-users/attachments/20141025/b2b18fbe/attachment.html>


More information about the sr-users mailing list