[asterisk-users] php agi and get_data errors.
Luca Gervasi
luca.gervasi at gmail.com
Sun Mar 1 08:37:08 CST 2009
Hallo,
I'm using a self-made script to get the code a user enters on my applications.
Sadly, the code doesn't work, i push the digits, but the result is
always an empty data.
(code=200, result=1, data= '').
Here is the code:
set_time_limit(99999999999999);
require('phpagi.php');
$agi = new AGI();
$agi->answer();
function printdebug($a) {
global $agi;
$agi->conlog(print_r($a, true));
}
// Prendo Badge
$isokbadge = false;
$tries = 1;
do {
$result = array();
$agi->exec('PLAYBACK',$audiofiles['insertbadge']);
$result = $agi->get_data('beep', 60000, 13);
printdebug($result);
$badge = str_replace('*', '.', $result['result']);
$agi->conlog("[$tries] Badge: $badge");
if (strlen($badge) != 13) {
if (($tries++) >= 3){
$agi->exec('PLAYBACK',$audiofiles['maxreached']);
$agi->hangup();
exit();
}
$agi->exec('PLAYBACK',$audiofiles['invalidbadge']);
} else {
$agi->exec('PLAYBACK',$audiofiles['thanks']);
$isokbadge = true;
}
} while ($isokbadge == false);
Another error is that after the first get_data(), it doesn't stops
anymore waiting for user input, it just goes on...
Please help me debug this...
If you know any web site o irc channel full of phpagi users, please,
let me know :(
Thanks
--
GnuPG / PGP Key Available on http://pgp.mit.edu
KeyID: 0xF1824D07 - Key Fingerprint:
4566 FD61 ACC8 76F0 02B4
11E6 0436 5867 F182 4D07
Linux Registered User: #192634
Web: http://www.ashetic.net/wordpress/
More information about the asterisk-users
mailing list