<div dir="ltr">Hi Alex,<br><br>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.<br><br>Thanks for the aclaration !<br></div><div class="gmail_extra">
<br><br><div class="gmail_quote">2013/11/18 Alex Balashov <span dir="ltr"><<a href="mailto:abalashov@evaristesys.com" target="_blank">abalashov@evaristesys.com</a>></span><br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
Hi Victor,<br>
<br>
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.<br>

<br>
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().<br>

<br>
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.<br>

<br>
-- Alex<br>
<br>
[1] <a href="http://kamailio.org/docs/modules/4.0.x/modules/utils.html#idm1336" target="_blank">http://kamailio.org/docs/<u></u>modules/4.0.x/modules/utils.<u></u>html#idm1336</a><br>
<br>
[2] <a href="http://kamailio.org/docs/modules/4.0.x/modules/utils.html#idp2631720" target="_blank">http://kamailio.org/docs/<u></u>modules/4.0.x/modules/utils.<u></u>html#idp2631720</a><br>
<br>
[3] <a href="http://kamailio.org/docs/modules/devel/modules/async.html" target="_blank">http://kamailio.org/docs/<u></u>modules/devel/modules/async.<u></u>html</a><br>
<br>
<a href="http://kamailio.org/docs/modules/4.1.x/modules/tmx.html#idp15326008" target="_blank">http://kamailio.org/docs/<u></u>modules/4.1.x/modules/tmx.<u></u>html#idp15326008</a><div><div class="h5"><br>
<br>
On 11/18/2013 09:39 AM, Victor Torre Antunez wrote:<br>
<br>
</div></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div><div class="h5">
Hi all,<br>
<br>
I´m using EXEC Module to execute a HTTP request via curl, to comunicate<br>
with another app like this:<br>
<br>
     exec_avp("curl --connect-timeout 1 --max-time 2<br>
http://IP_ADDR:PORT/PATH/'$fU'<u></u>/'$tU'/'$hdr(Call-ID)'", "$avp(s:output)");<br>
<br>
Sometimes Kamailio blocks when HTTP server does not response in time,<br>
despite the max-time parameter.<br>
<br>
I found this know issue on EXEC module docs:<br>
     "There is currently no guarantee that scripts ever return and stop<br>
blocking SIP server. (There is kill.c but it is not used along with the<br>
current mechanisms based on popen. Besides that kill.c is ugly)."<br>
<br>
Does anyone know a better way to communicate Kamailio with a HTTP server<br>
without blocks? I will try a python script to send the HTTP request and<br>
call it with APP_PYTHON module. Has anyone had blocks with APP_PYTHON<br>
module?<br>
<br>
<br>
Thanks in advance.<br>
<br>
--<br></div></div>
*Victor*<br>
<br>
<br>
<br>
______________________________<u></u>_________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/<u></u>cgi-bin/mailman/listinfo/sr-<u></u>users</a><br>
<br>
</blockquote>
<br>
<br>
-- <br>
Alex Balashov - Principal<br>
Evariste Systems LLC<br>
235 E Ponce de Leon Ave<br>
Suite 106<br>
Decatur, GA 30030<br>
United States<br>
Tel: +1-678-954-0670<br>
Web: <a href="http://www.evaristesys.com/" target="_blank">http://www.evaristesys.com/</a>, <a href="http://www.alexbalashov.com/" target="_blank">http://www.alexbalashov.com/</a><br>
<br>
______________________________<u></u>_________________<br>
SIP Express Router (SER) and Kamailio (OpenSER) - sr-users mailing list<br>
<a href="mailto:sr-users@lists.sip-router.org" target="_blank">sr-users@lists.sip-router.org</a><br>
<a href="http://lists.sip-router.org/cgi-bin/mailman/listinfo/sr-users" target="_blank">http://lists.sip-router.org/<u></u>cgi-bin/mailman/listinfo/sr-<u></u>users</a><br>
</blockquote></div><br><br clear="all"><br>-- <br><b>Victor Torre Antúnez<br>Ingeniero de Soporte</b><br><br><a href="mailto:victor.torre@stoneworksolutions.net" target="_blank">victor.torre@stoneworksolutions.net</a><br>
0034 925 01 81 06<br><br><br><img src="http://stoneworksolutions.net/es/images/SWLOGO.jpg" height="72" width="200"><br>
</div>