[asterisk-users] Forking AGI or GoSub

Eric Wieling ewieling at nyigc.com
Fri Apr 19 13:15:08 CDT 2019


In PHP something like:

$pid = pcntl_fork();
if ($pid != 0) {
     // we are the parent
     // do parent stuff
     exit;
}

// we are the child, detatch from terminal
$sid = posix_setsid();
if ($sid < 0) {
     die;
}
// do child stuff

On 04/19/2019 02:00 PM, Mark Wiater wrote:
> On 4/19/2019 1:49 PM, Dovid Bender wrote:
>> Mark,
>>
>> 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?
>>
> Dovid,
> 
> 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?
> 
> 
> 

-- 
http://help.nyigc.net/



More information about the asterisk-users mailing list