[asterisk-users] Asynchronous play music
Steve Edwards
asterisk.org at sedwards.com
Tue Mar 30 14:30:09 CDT 2010
> On Tue, 30 Mar 2010, Pham Quy wrote:
>
>> Is there anyway to catch DTMF keypress while a music file is playing
>> without stop the music?
On Mon, 29 Mar 2010, Steve Edwards wrote:
> Have you tried externivr(). I've never used it, but it looks
> interesting.
I hate it when people post about things they know nothing about...
So I wrote My First ExternalIVR (mfe.c). I'm a 1.2 Luddite, so things may
be a bit different for the Asterisk version you are using. Comparing the
documentation, it looks like a lot of useful commands have been added.
The first question I had was "Where do you put the executable?" The
documentation is silent on this point. ASTAGIDIR seemed a likely guess.
Guess not. It looks like it has to be an absolute path. Inconvenient, but
it works.
The actual protocol is trivial, way "simpler" and limited than AGI.
Here's a snippet that shows how to play a file and then "handle" the key
press events.
// play a file
printf("S,demo-congrats\n");
fflush(stdout);
// read events
while (NULL != fgets(event, sizeof(event), stdin))
{
syslog(LOG_ERR, event);
if ('#' == *event)
{
break;
}
}
(The full source is at http://www.sedwards.com/mfe.c)
--
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