I am building an interface on the Manager API, and I need to be able to play back an audio file on command, on an existing conversation between 2 channels. Also I need to be able to stop playback on command.
Is there any way to invoke Playback on a certain channel using the Manager API? Or are there any other solutions?
This is from the top of my head, So not tested, But The only way I can see this being possible is to use conferencing and play the file into the conference.
There is a modified version of app_conference which does pass the dtmf tones out, So should do what you want.
[macro-quiztest]
exten => s,1,Playback(have-u-heard-this)
exten => s,2,Read(Answer,${ARG1},1,2) ; reads a single digit to ${Answer},plays the file in ${ARG1} first, allows one digit only, retries two times if they enter nothing
so you’d call it with
exten => whatever,1,Macro(quiztest,name-of-file-with-music)
and when it finishes you’d have whatever digit they dialed in ${Answer}.
You might want to sanity check ${Answer}, IE if it’s only supposed to be 1 or 2, send them back to do it again if it’s not 1 or 2.