[asterisk-users] Synchronous dialplan execution for feedback while processing speech recognition and voice synth, for example.

Steve Edwards asterisk.org at sedwards.com
Mon Oct 3 17:48:06 CDT 2016

On Mon, 3 Oct 2016, Jonathan H wrote:

> I've googled and I'm probably missing something pretty newbie 101 here, 
> but is there any way, or fiddle, that I can play some audio to let the 
> caller know that their weather forecast is being fetched, which the two 
> agis are first recognising and then synthesizing the speech? I thought 
> "background" might do it, but it doesn't seem to work like that. 

Did something similar a decade ago :)

I had a credit card processing AGI for an adult audiotext line. The owner 
was a real stickler for the 'caller experience' and didn't like the dead 
air waiting for the auth back from the card processor.

My solution was to kick off a thread (the AGI was written in C, so I used 
pthreads) to play 'and get ready for a good time' and then issue the 
request to the card processor and waiting for the response in the mainline 

By the time the prompt finished, I had the response so pthread_join would 
'finish' off the thread cleanly and the dead air magically disappeared.

The only 'warning' is not to do any I/O to STDIN/STDOUT in the mainline -- 
that would violate the AGI protocol and lead to things breaking in weird 

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

More information about the asterisk-users mailing list