Hi Alex,

I don't mind blocks SIP execution script, but I need to block only certain seconds. I´m going to test http_query() function and let you know.

Thanks for the aclaration !


2013/11/18 Alex Balashov <abalashov@evaristesys.com>
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 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/'$fU'/'$tU'/'$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



--
Victor Torre Antúnez
Ingeniero de Soporte


victor.torre@stoneworksolutions.net
0034 925 01 81 06