PHPAGI Background like feature

Hi Experts,

I want to achieve the following scenario, When i play audio from MP3Player, I want the input to be capture by the DTMF stroke.

I know this can be done with a simple dialplan, Background Application.

I want this to be done in PHP AGI script, where it plays the MP3 sound and get the user interruption DTMF stroke and store into the variable.

getting DTMF digits in PHP agi achieve by get_data() or wait_for_digits(). what I want to achieve is something like background function. Let me know if you think the same feature can be achieved by python or Perl agi other than PHP

It doesn’t work that way.

'mp3player()' is an Asterisk application, not an AGI command. You execute it via the 'exec' AGI command.

Thus, any ‘status’ that is returned is the status of the 'exec', not 'mp3player().'

It appears that 'mp3player()' does not set any channel variable to indicate the interrupting keystroke.

Why do you want to play MP3s? If you can convert the MP3 to WAV, you can use 'stream file' or something else that will allow you to ‘read’ the interrupting digit in your AGI.

Maybe if you expand on your application we can suggest a solution. Or maybe you could add that feature to 'mp3player().' Although I suspect 'mp3player()' is not a widely used application.

The source language does not change the AGI commands available – unless the command is not implemented in the library you are using.

That’s makes sense, i will use the stream_file for getting the input while playing the recording.

One more thing, is record _file can get the dtmf keystroke input also?

Yes.

agi show commands

will show you a list of AGI commands.

agi show commands topic record file

Weird syntax, but it will show info on a specific command.

It’s usually faster to cobble up a test than wait for a reply.

Thank you @sedwards - It’s working as i expected, it has the escape character to get the DTMF. It store in a ASCII format, i have to convert using chr() function in php.

Thank you again.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.