Как использовать $agi-›get_data с несколькими аудиофайлами

В Playback, Background, Read мы можем комбинировать аудиофайлы с &, например file1&file2.
В PHPAgi вместо Read я использую $agi->get_data, но похоже, что он принимает только один файл!

Я также пытался воспроизвести звук с помощью Background перед вызовом get_data:

$multipleAudioPath = 'file1&file2';
$agi->exec('Background', $multipleAudioPath);
$rawInput = $agi->get_data('blankAudioFile', $timeout, $digits);

Но первый символ идет на прерывание фонового звука и не попадает в get_data.

Что я могу сделать? Могу я сделать это один с $agi->get_data ? Или есть какое-то другое решение?


person MeTe-30    schedule 15.05.2019    source источник


Ответы (1)


Вы можете использовать несколько файлов, используя команду «Прочитать звездочку».

$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()

Другой вариант - смешать его вместе с помощью SOX или через libsox.

person arheops    schedule 15.05.2019