In Playback, Background, Read we can combine audio files with &
, like file1&file2
.
In PHPAgi instead of Read, I use $agi->get_data
, but its look like accept only one file!
I also tried to play audio with Background before calling get_data:
$multipleAudioPath = 'file1&file2';
$agi->exec('Background', $multipleAudioPath);
$rawInput = $agi->get_data('blankAudioFile', $timeout, $digits);
But first character goes for breaking Background audio and didn't catch in get_data.
What can I do? Can I do it alone with $agi->get_data
? Or is there any other solution ?
You can use multiple files using Read asterisk command.
$agi->exec("Read","variable,filename&filename2")
[Syntax]
Read(variable[,filename[&filename2[&...]][,maxdigits[,options[,attempts[,timeout]]]]])
[Arguments]
variable
The input digits will be stored in the given <variable> name.
filename
file(s) to play before reading digits or tone with option i
maxdigits
Maximum acceptable number of digits. Stops reading after <maxdigits> have
been entered (without requiring the user to press the '#' key).
Defaults to '0' - no limit - wait for the user press the '#' key. Any value
below '0' means the same. Max accepted value is '255'.
options
s: to return immediately if the line is not up.
i: to play filename as an indication tone from your "indications.conf".
n: to read digits even if the line is not up.
attempts
If greater than '1', that many <attempts> will be made in the event no data
is entered.
timeout
The number of seconds to wait for a digit response. If greater than '0',
that value will override the default timeout. Can be floating point.
[See Also]
SendDTMF()
Other option is mix it together by SOX or via libsox.
you can use below code
$input = '';
$agi->fastpass_get_data($input,"file1", null, 1);
$agi->fastpass_get_data($input,"file2", null, 1);
$agi->fastpass_get_data($input,'beep', 5000, 1);
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.