[asterisk-users] [1.4] Still can't get it to call back

Tony Mountifield tony at mountifield.org
Fri Feb 25 06:20:34 CST 2011


In article <a92fm65o07976iomfhr1k0t3sunmogdfph at 4ax.com>,
Gilles <codecomplete at free.fr> wrote:
> On Thu, 24 Feb 2011 13:11:02 +0000 (UTC), tony at mountifield.org (Tony
> Mountifield) wrote:
> >Yes, that is the reason. The easiest thing is probably to put in a delay
> >if os.execute allows full shell syntax:
> 
> Thanks for the idea.
> 
> While reading samples, I happened upon the "system()" application,
> which means I can call a script directly from extensions.conf instead
> of through AGI.
> 
> However, system() seems to launch script synchronously, which means
> that using "sleep 10" in the script doesn't solve the issue: Upon
> return, the channel is still not available:

Yes, look carefully at the line I gave you with the sleep:

os.execute("(sleep 2;mv /var/tmp/callback.call /var/tmp/asterisk/outgoing)&")

The important parts are the ( before the sleep and the )& at the end. The
brackets create a subshell to do the sleep and move, and the & puts that
subshell in the background, so the os.execute will return immediately
without waiting for the sleep to execute. By the time the mv is executed,
the channel should have been hung up properly.

Cheers
Tony
-- 
Tony Mountifield
Work: tony at softins.co.uk - http://www.softins.co.uk
Play: tony at mountifield.org - http://tony.mountifield.org



More information about the asterisk-users mailing list