[OpenSIPS-Users] rest_append_hf

Liviu Chircu liviu at opensips.org
Thu Feb 15 12:07:24 EST 2018


Hi Pasan,

Thank you for the report - I have spotted and fixed [1] a bug in 
rest_append_hf() that could definitely lead to a world of problems. Can 
you try to pull the latest version of 2.3 and try again? If you're 
running off packages, the only option is to wait until tomorrow and 
deploy the nightly built ones.

Cheers,

[1]: https://github.com/OpenSIPS/opensips/commit/888d5e9b3f9

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

On 15.02.2018 11:53, Pasan Meemaduma via Users wrote:
> Hi List,
>
> I'm trying to use rest_append_hf function to append an extra header 
> for my rest call. But it doesn't set it unless I call the same 
> function twice.
>
> How do I get around this ? I tried async() statement as well as per 
> docs but it didn't work either.
>
> I'm using opensips 2.3.3
>
> route(xxxx);
>
> route[xxxx] {
>     rest_append_hf("Accept: application/vnd.xxx.vapi+json; version=2");
>     $var(rc) = rest_post("http://{{ API_USER }}:{{ API_SECRET }}@{{ 
> API_HOST }}/xx/xx/xx", "{ \"xx\": { \"xx\": [ \"$var(auth_user)\" ] 
> }}", "application/json", "$var(body)", "$var(ct)", "$var(rcode)");
>     $json(res) := $var(body);
>     if($json(res/success) != 1 ) {
>         xlog("L_ERR", "API: Failed to Blocked call request - M=$rm 
> RURI=$ru F=$fu T=$tu IP=$si ID=$ci\n");
>     } else {
>         xlog("L_WARN", "API: Blocked call request - M=$rm RURI=$ru 
> F=$fu T=$tu IP=$si ID=$ci\n");
>     }
> }
>
> Accept header will only send if I call route(xxxx) twice :/.
>
>
>
>
> _______________________________________________
> 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/20180215/f632c146/attachment.html>


More information about the Users mailing list