[asterisk-users] Forking AGI or GoSub

Michael Munger mj at hph.io
Fri Apr 19 13:03:52 CDT 2019

I am very much a PHP person. PHP doesn't really have an elegant way to handle forking / threading, which can make it non-trivial to implement and can be unreliable if the implementation is not exact. PHP must also be compiled to be thread safe in order to do this properly.

Granted, the last time I looked into this with PHP was under PHP 5.6, and tests at that time did not yield the results we wanted. We ultimately moved to Python when we needed multi-threading, which is extremely elegant and reliable for this application.

[cid:image001.png at 01D4F6B9.8C1499D0]

Michael J. Munger, dCAP, MCPS, MCNPS, MBSS

Microsoft Certified Professional

Microsoft Certified Small Business Specialist

Digium Certified Asterisk Professional

High Powered Help, Inc.




hph.io<https://hph.io>  e: mj at hph.io<mailto:mj at hph.io>

From: asterisk-users <asterisk-users-bounces at lists.digium.com> On Behalf Of Mark Wiater
Sent: Friday, April 19, 2019 2:00 PM
To: asterisk-users at lists.digium.com
Subject: Re: [asterisk-users] Forking AGI or GoSub

On 4/19/2019 1:49 PM, Dovid Bender wrote:


I am using PHP agi and when forking the call does not continue util the forked process is done. Am I doing it wrong?

On Wed, Apr 10, 2019 at 4:27 PM Mark Wiater <mark.wiater at greybeam.com<mailto:mark.wiater at greybeam.com>> wrote:
On 4/10/2019 3:54 PM, Dovid Bender wrote:

I have an AGI that can sometimes take time complete. I don't want the dialplan to be held up by the agi. Is there any way to call it and have Asterisk continue with the dialplan?

Is there a reason you can't fork in the AGI and just return to the dialplan in the parent?


I'm not much of a PHP person, but in perl, i check the process id that's returned from fork() and exit if it's 1 (parent) and keep processing if it's the child (greater than 1).

I think php uses pcntl_fork().

Is that how you're doing it?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20190419/2da95224/attachment.html>
-------------- next part --------------
A non-text attachment was scrubbed...
Name: image001.png
Type: image/png
Size: 738 bytes
Desc: image001.png
URL: <http://lists.digium.com/pipermail/asterisk-users/attachments/20190419/2da95224/attachment.png>

More information about the asterisk-users mailing list