Issues with Agi script?

asterisk
Tags: #<Tag:0x00007f24c244d188>

(Fizgriz) #1

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

(Communication Technologies) #2

Looks like the script is failing? Look at the actual script, send back logs to the dial plan after each step completes if you are unfamiliar, that way you can see what step it fails on.


#3

Failing with

#!/usr/bin/php -q

which seems like it is trying to call another script

please post your agi script, looks like it is badly written


(Lorne Gaetz) #4

AGI scripts MUST have unix style end of line (EOL) characters. Make sure you’re not using windows style EOL.


(system) closed #5

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.