Hi Nicholas,
On Fri, Jul 21, 2017 at 09:39:35AM +0000, Nicolas Breuer wrote:
Hello,
I'm trying to do a sleep in the request route but seems it's not working
if (src_ip == $sel(cfg_get.kamalio2.gw) ){
xlog("L_NOTICE","Sleep 5 seconds");
usleep("5000");
}
xlog("L_NOTICE","End of sleeping");
Result :
Jul 21 11:38:02 proxy2 /usr/sbin/kamailio[31442]: NOTICE: <script>: Sleep 5
seconds
Jul 21 11:38:02 proxy2 /usr/sbin/kamailio[31442]: NOTICE: <script>: End of sleeping
usleep() takes an argument in microseconds (millionths of a second), so
you should try a value of 5000000.
But aside from that, embedding sleep commands in request routes is a
very bad idea, since it ties up that worker thread during the time it
sleeps and prevents it from processing other SIP messages. :-)
-- Alex
--
Alex Balashov | Principal | Evariste Systems LLC
Tel: +1-706-510-6800 / +1-800-250-5920 (toll-free)
Web:
http://www.evaristesys.com/,
http://www.csrpswitch.com/