MeTe-30
MeTe-30

Reputation: 2542

How to use $agi->get_data with multiple audio files

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 ?

Upvotes: 1

Views: 1604

Answers (1)

arheops
arheops

Reputation: 15247

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.

Upvotes: 1

Related Questions