'$agi->get_data causes php script to return immediately
when test.php script runs from asterisk dial plan everything works fine until execution reaches
$agi->get_data('xxx', 1000, 1); statement.
asterisk cli shows this log:
AGI Script test.php completed, returning 0
and script finish its execution without playing requested sound or getting any DTMF digit.
ive tested stream_file function with similar sound file and it worked fine. so the file exists and sound playback module is ok
#!/usr/bin/php -q
<?
require('phpagi.php');
$agi = new AGI();
$ch = $agi->request["agi_channel"];
$callerid = $agi->request["agi_callerid"];
$agi->answer();
$agi->verbose($callerid);
$menu = $agi->get_data('welcome', 1000, 1);
$menu = $agi->get_data('MainMenu', 5000, 1);
Solution 1:[1]
Likly you have error.
Unfortanly not way say what it is.
People just forgot to mention(and in book too), that asterisk do NOT sending agi error to CLI.
To get error you should check primary console(need know which one, in most case tty9) or just start asterisk with console in current session.
asterisk -rx "core stop now"
asterisk -vvvgc
agi set debug on
After that you will see scripts error.
Solution 2:[2]
phpagi.php library "get_data" method had some problem, i downloaded the library, replaced current files with new ones and everything worked fine.
Solution 3:[3]
The problem was phpagi.php, get_data function was manipulated by someone! i downloaded the library and replaced it with the old one and everything worked fine
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
Solution | Source |
---|---|
Solution 1 | arheops |
Solution 2 | DAkbariSE |
Solution 3 | DAkbariSE |