[asterisk-users] AGI and forking

Steve Edwards asterisk.org at sedwards.com
Wed Apr 13 08:46:21 CDT 2011


On Wed, 13 Apr 2011, A J Stiles wrote:

> I want, when a call comes in on someone's DDI number (which the person 
> who dialled it can only possibly have obtained by dialling 1471 after we 
> called them), to be able to look up the caller's details from one of our 
> databases (where the number ought to be stored, because we already 
> dialled it).
>
> Now, this search is going to take some time; so I'd like for the AGI 
> script to fork a clone of itself, so the parent process can exit and the 
> dialplan continue on to ring the person's phone, while the database 
> lookup is done in the background (the script doesn't need to have any 
> further contact with Asterisk -- it will initiate any necessary future 
> communication via other channels).

I solved a similar problem with a multi-threaded AGI.

I created a thread to play 'Please wait while we verify your card details' 
while the main program did the database look ups and sent the auth out to 
our card processor.

By the time the prompt finished, I had the response back from the card 
processor so the 'wait' appeared to the caller to be instantaneous.

-- 
Thanks in advance,
-------------------------------------------------------------------------
Steve Edwards       sedwards at sedwards.com      Voice: +1-760-468-3867 PST
Newline                                              Fax: +1-760-731-3000



More information about the asterisk-users mailing list