[asterisk-users] AGI and forking
A J Stiles
asterisk_list at earthshod.co.uk
Thu Apr 14 02:59:02 CDT 2011
On Wednesday 13 Apr 2011, Thorsten Göllner wrote:
> It should work - I think. BUT I am not really sure what will happen, if
> the child process exits. The child works with a copy of all asterisk
> ressources given to it, when forking. So when the child dies, perhaps
> asterisk will do a hangup or continues in the dialplan for this process.
> I think, that could cause some unwanted results.
The parent exits immediately after the fork. The child begins by closing
STDIN, STDOUT and STDERR; so once those handles are dropped, it ought to be
completely separate from Asterisk.
> You should try to write a daemon process which handles the database
> lookups or whataver while being totally independent of the atserisk
> process.
I hadn't actually thought of doing it that way, but it makes sense. Still,
the forking method seemed to work (i.e., the dialplan continues straight
away) when I tested it with just a sleep in the child process (once I
remembered to close STDIN, STDOUT and STDERR!) and I could not get a zombie
when I thoroughly tested forking on my own desktop, so I'll give it a go and
see what happens .....
--
AJS
Answers come *after* questions.
More information about the asterisk-users
mailing list