phpAGI help

Hi i need help figuring out why my phpAGI dialplan is not working, I will provide you debug details and server info. Thanks in advance.


Launched AGI Script /var/lib/asterisk/agi-bin/lotwagi.php

AGI Tx >> agi_request: lotwagi.php AGI Tx >> agi_channel: SIP/*****-006b0f80 AGI Tx >> agi_language: en AGI Tx >> agi_type: SIP AGI Tx >> agi_uniqueid: 1210156921.24 AGI Tx >> agi_callerid: 5034308619 AGI Tx >> agi_calleridname: 5034308619 AGI Tx >> agi_callingpres: 0 AGI Tx >> agi_callingani2: 0 AGI Tx >> agi_callington: 0 AGI Tx >> agi_callingtns: 0 AGI Tx >> agi_dnid: 9713279797 AGI Tx >> agi_rdnis: unknown AGI Tx >> agi_context: inbound AGI Tx >> agi_extension: ****** AGI Tx >> agi_priority: 2 AGI Tx >> agi_enhanced: 0.0 AGI Tx >> agi_accountcode: AGI Tx >> exit AGI Rx << Extension '/var/lib/asterisk/agi-bin/lotwagi.php' not present. AGI Tx >> 510 Invalid or unknown command -- AGI Script lotwagi.php completed, returning 0

Im running PHP 5.2.5, Mysql 5 and asterisk

AGI Rx << Extension '/var/lib/asterisk/agi-bin/lotwagi.php' not present.
AGI Tx >> 510 Invalid or unknown command

Here is the problem, please post the relevant extensions.conf context if you want help.


Marco Bruni

heres my extensions.conf

exten => _1NXXNXXXXXX,1,Dial(SIP/${EXTEN}@vitel-outbound)
exten => _011.,2,Dial(SIP/${EXTEN}@vitel-outbound)

; e911 must be enabled. see DIDs > NPANXXNXXX > Action > e911
exten => _911,3,Dial(SIP/911@vitel-outbound)

exten => 9713279797,1,AGI(lotwagi.php)
exten => 9713279797,n,Hangup

Extensions.conf seems ok, please post lotwagi.php.


Marco Bruni

heres my script and im sure theres no syntax error cause i have use it in the previous asterisk server.

Ok, so if the script worked before the problem isn’t in the script.
Which are the differences between this server and the others ? Php version ? Asterisk version ?


Marco Bruni

Yea, in the previous server its using PHP4 and asterisk My initial suspect is the shebang line at the top of my script is not correct, this one.

#!/usr/local/bin/php -q

Its FIXED!!. the problem is in the shebang line and some sort of php warning that cant read by asterisk so I added error_reporting(0) in the code and it works. Thanks mbruni for helping me out :wink: .

You’re welcome :smile: