[OpenSIPS-Users] Parsing response from rest_client

Liviu Chircu liviu at opensips.org
Thu May 11 08:48:12 EDT 2017


Typical OpenSIPS scripting mistake #37: "mixing up $var and $avp".

Regards,

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

On 11.05.2017 15:35, Andreas Bøckmann wrote:
> Hello
>
> I am running OpenSIPS 2.3 and using something along these lines:
>
>   async(rest_get("$var(push_url)", "$var(push_response)"), 
> handle_push_response);
>   ..
>   xlog("L_NOTICE","L16.02, PUSHRESPONSE cid=$ci, 
> RESPONSE=$var(push_response)\n");
>   ..
>   if (pcre_match("$avp(push_response)","OK")) {
>   ..
>   }
> The xlog entry shows /usr/local/sbin/opensips[415]: L16.02, 
> PUSHRESPONSE cid=9ad0Ads0duSAUdj0asd39, RESPONSE={"response":"OK"}
>
> I observe the following errors in logs (see below).
> Wouldn't make sense to cast it to int I guess and I see no s.string?
>
> : ERROR:core:fixup_get_svalue: no valid PV value found (error in scripts)
> : ERROR:regex:w_pcre_match: cannot print the format for string
>
> The pcre_match does not seem to be able to match "OK".
>
> Any suggestions as to what I am doing wrong here or how I should do it?
>
> The same script seems to work with 2.1/2.2.
>
> Thanks!
>
>
> Kind regards,
>
> Andy Thompson
>
>
>
>
>
>
>
> _______________________________________________
> 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/20170511/34b61ac8/attachment.html>


More information about the Users mailing list