Hey All, I’m having some issues running custom agi scripts.
Here is the details:
- Version: freepbx distro
- php file is here: /var/lib/asterisk/agi-bin/hb000.php
- extension_custom added this:
** [hb]
** exten => 1,1,Answer
** exten => 1,2,AGI(hb000.php)
** exten => 1,3,Hangup
*Custom destinations:
** Target: hb,1,1
*Inbound routes has number pointed at custom destination.
*The file is chmod 755, and owned by asterisk:asterisk
**-rwxr-xr-x 1 asterisk asterisk 780 May 3 17:51 /var/lib/asterisk/agi-bin/hb000.php
When i call in it hits the script, but hangs up immediately. With invalid command. Saying the “#!” is invalid??
Launched AGI Script /var/lib/asterisk/agi-bin/hb000.php
<SIP/twilio4-00000003>AGI Tx >> agi_request: hb000.php
<SIP/twilio4-00000003>AGI Tx >> agi_channel: SIP/twilio4-00000003
<SIP/twilio4-00000003>AGI Tx >> agi_language: en
<SIP/twilio4-00000003>AGI Tx >> agi_type: SIP
<SIP/twilio4-00000003>AGI Tx >> agi_uniqueid: XXXXXXXXXXXXX
<SIP/twilio4-00000003>AGI Tx >> agi_version: 16.16.2
<SIP/twilio4-00000003>AGI Tx >> agi_callerid: XXXXXXXXXXXX
<SIP/twilio4-00000003>AGI Tx >> agi_calleridname: XXXXXXXXXXX
<SIP/twilio4-00000003>AGI Tx >> agi_callingpres: 0
<SIP/twilio4-00000003>AGI Tx >> agi_callingani2: 0
<SIP/twilio4-00000003>AGI Tx >> agi_callington: 0
<SIP/twilio4-00000003>AGI Tx >> agi_callingtns: 0
<SIP/twilio4-00000003>AGI Tx >> agi_dnid: +XXXXXXXXXXX
<SIP/twilio4-00000003>AGI Tx >> agi_rdnis: +XXXXXXXXXXX
<SIP/twilio4-00000003>AGI Tx >> agi_context: hb
<SIP/twilio4-00000003>AGI Tx >> agi_extension: 1
<SIP/twilio4-00000003>AGI Tx >> agi_priority: 2
<SIP/twilio4-00000003>AGI Tx >> agi_enhanced: 0.0
<SIP/twilio4-00000003>AGI Tx >> agi_accountcode:
<SIP/twilio4-00000003>AGI Tx >> agi_threadid: 140477311543040
<SIP/twilio4-00000003>AGI Tx >>
<SIP/twilio4-00000003>AGI Rx << #!/usr/bin/php -q
<SIP/twilio4-00000003>AGI Tx >> 510 Invalid or unknown command
<SIP/twilio4-00000003>AGI Rx <<
<SIP/twilio4-00000003>AGI Tx >> 510 Invalid or unknown command
-- <SIP/twilio4-00000003>AGI Script hb000.php completed, returning 0