I am new to Asterisk & Linux and would like to explore the possibilities of it.I have made a small dial plan to call a php file that is using phpAGI.
$agi->stream_file(“enter-password”,"#"); is not playing the file. from the agi debug window it is found that this function is returning immediately and my next command ($result = $agi->get_data(“beep”,3000,20) is getting executed soon. So i can hear only the sound “beep”.
Instead of stream_file(), i tried $agi->exec(“playback”,“enter-password”); and it is working fine.
Please help me!
;extensions_custom.conf
[from-ivr]
exten => 1235,1,Playback(beep);
exten => 1235,n,agi(dtmf.php); extensions can dial 1235
exten => 1235,n,Hangup();
//dtmf.php
#!/usr/bin/php -q
<?php
set_time_limit(30);
require('phpagi.php');
error_reporting(E_ALL);
$agi = new AGI();
$agi->answer();
$agi->stream_file("enter-password","#");
$result = $agi->get_data("beep",3000,20);
$keys = $result['result'];
$agi->say_digits($keys);
$agi->hangup();
?>
AGI DEBUG
AGI Rx << ANSWER
AGI Tx >> 200 result=0
AGI Rx << STREAM FILE enter-password "#" 0
-- Playing 'enter-password' (escape_digits=#) (sample_offset 0)
AGI Rx << GET DATA beep 3000 20
-- <SIP/571-08d7d630> Playing 'beep' (language 'en')
AGI Tx >> 200 result= (timeout)
AGI Rx << SAY DIGITS ""
AGI Tx >> 520-Invalid command syntax. Proper usage follows:
AGI Tx >> Usage: SAY DIGITS <number> <escape digits>
Say a given digit string, returning early if any of the given DTMF digits
are received on the channel. Returns 0 if playback completes without a digit
being pressed, or the ASCII numerical value of the digit if one was pressed or
-1 on error/hangup.
AGI Tx >> 520 End of proper usage.
AGI Rx << HANGUP
AGI Tx >> 200 result=1