[OpenSIPS-Users] Can't use rest_post from event_route

Liviu Chircu liviu at opensips.org
Tue May 24 14:53:48 CEST 2016


Hi Igor!

Pro tip: _any_ "Command cannot be used in the block" error can be 
circumvented with the following mechanism:

route [msilo_event] {
   xlog("L_INFO","messages was deleted by msilo");
   rest_post("http://192.168.101.4/handler.php", "status_code=408", 
"application/x-www-form-urlencoded", "$var(body)", , "$var(code)");
}

event_route [E_MSILO_MESSAGE_DELETE] {
   route(msilo_event);
}

Note: While we have nothing against using this kind of script magic, 
please note that, unlike other parts of the code which have
received some community testing, this one has likely not received much! 
In your specific case though (msilo events), it looks quite safe.

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

On 24.05.2016 14:45, Igor Pavlov wrote:
>
> Hi all. I have opensips 1.11.6-tls (x86_64/linux). I'm trying to 
> execute rest_post() from event_route, but geting error:
>
>> CRITICAL:core:yyerror: parse error in config file 
>> /etc/opensips/opensips.cfg, line 718, column 35-36: Command cannot be 
>> used in the block
> event route section:
>> event_route[E_MSILO_MESSAGE_DELETE] {
>>     xlog("L_INFO","messages was deleted by msilo");
>>     rest_post("http://192.168.101.4/handler.php", "status_code=408", 
>> "application/x-www-form-urlencoded", "$var(body)", , "$var(code)");
>> }
>
> -- 
> ____________
> Best regards,
> Igor Pavlov
>
>
> _______________________________________________
> 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/20160524/25843c46/attachment.htm>


More information about the Users mailing list