Phpagi stream_file() function returning immediately

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):wink: 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

Hi Friends!

Any tips for this newbie?

Thanks in advance!

I tried your script and it doesn’t work, same result, I think it could be a bug in the phpagi stream_file implementation, seems the dtmfs digited are ignored, you could try ask help on the phpagi forum, sourceforge.net/projects/phpagi/ … rum/366892 .

Cheers.

Marco Bruni
www.marcobruni.net

Thank you very much. Let me try posting there.

Some more findings about this problem.

I set a variable from dial plan and did a $agi->get_variable() from php. AGI debug is showing that data is send to php, but $agi->verbose() is showing no ‘data’.

Could this be a problem of PHP? Like PHP CLI & PHP CGI. If so, how do we check it?

Thanks & Regards