1,播放语音,按键终止:
$AGI->get_data($filename, $timeout, $maxdigits)
Executes AGI Command "GET DATA $filename $timeout $maxdigits"
Streams $filename and returns when $maxdigits have been received or when $timeout has been reached. Timeout is specified in ms
Example: $AGI->get_data('demo-welcome', 15000, 5);
2,播放语音,按键终止:
$AGI->stream_file($filename, $digits)
Executes AGI Command "STREAM FILE $filename $digits"
This command instructs Asterisk to play the given sound file and listen for the given dtmf digits. The fileextension must not be used in the filename because Asterisk
will find the most appropriate file type.
Example: $AGI->stream_file('demo-echotest', '0123');
Returns: -1 on error or hangup, 0 if playback completes without a digit being pressed, or the ASCII numerical value of the digit if a digit was pressed