On 18 Nov 2013, at 15:45, Alex Balashov abalashov@evaristesys.com wrote:
Hi Victor,
Pretty much all HTTP calls, no matter how you architect them, block Kamailio SIP worker threads. There is a low practical limit to the number of of SIP worker threads you can have, so this can lead to SIP messages being dropped and sluggish response time very quickly.
The json-rpc module has what I believe is an asynch http call, returning in another route block. I've mailed earlier about all our HTTP clients. There's a mess that needs someone to clean out.
/O
The exec_avp() function has this liability, as does the http_query()[1] function in the 'utils' module, although the http_query() function does have a timeout parameter[2] that works, so if a short timeout satisfies you, this is a superior alternative to exec_avp().
However, to architect this in a truly asynchronous way, you're either going to have to query the thing you want via SIP (i.e. to a SIP redirect server) itself, or use some of the newer asynchronous/deferred processing features that are already in place[3], or being pushed into the 4.1 branch nowadays. Both options certainly incur greater complexity than using http_query(), so if the fact that it has a working timeout setting satisfies you, just use that.
-- Alex
[1] http://kamailio.org/docs/modules/4.0.x/modules/utils.html#idm1336
[2] http://kamailio.org/docs/modules/4.0.x/modules/utils.html#idp2631720
[3] http://kamailio.org/docs/modules/devel/modules/async.html
http://kamailio.org/docs/modules/4.1.x/modules/tmx.html#idp15326008
On 11/18/2013 09:39 AM, Victor Torre Antunez wrote:
Hi all,
I´m using EXEC Module to execute a HTTP request via curl, to comunicate with another app like this:
exec_avp("curl --connect-timeout 1 --max-time 2
http://IP_ADDR:PORT/PATH/%27$fU%27/%27$tU%27/%27$hdr(Call-ID)'", "$avp(s:output)");
Sometimes Kamailio blocks when HTTP server does not response in time, despite the max-time parameter.
I found this know issue on EXEC module docs: "There is currently no guarantee that scripts ever return and stop blocking SIP server. (There is kill.c but it is not used along with the current mechanisms based on popen. Besides that kill.c is ugly)."
Does anyone know a better way to communicate Kamailio with a HTTP server without blocks? I will try a python script to send the HTTP request and call it with APP_PYTHON module. Has anyone had blocks with APP_PYTHON module?
Thanks in advance.
-- *Victor*
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@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/
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list sr-users@lists.sip-router.org http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users