Dialing from AGI script

I’d like to originate a call from my PHP script.

Is there any Dial command for that purpose? I don’t see any such command in the list of AGI commands.

OK! I found the EXEC command that could serve the purpose.

However, I am unable to execute my AGI script. Here is the CLI output

AGI Tx >> agi_request: test.php
AGI Tx >> agi_channel: SIP/71.172.253.68-b7b08908
AGI Tx >> agi_language: en
AGI Tx >> agi_type: SIP
AGI Tx >> agi_uniqueid: 1308418873.614
AGI Tx >> agi_callerid: 18479873465
AGI Tx >> agi_calleridname: unknown
AGI Tx >> agi_callingpres: 0
AGI Tx >> agi_callingani2: 0
AGI Tx >> agi_callington: 0
AGI Tx >> agi_callingtns: 0
AGI Tx >> agi_dnid: 18479049212
AGI Tx >> agi_rdnis: unknown
AGI Tx >> agi_context: from-trunk
AGI Tx >> agi_extension: 18479049212
AGI Tx >> agi_priority: 7
AGI Tx >> agi_enhanced: 0.0
AGI Tx >> agi_accountcode:
AGI Tx >>
AGI Rx << verbose “Failed to execute ‘/var/lib/asterisk/agi-bin/test.php’: Exec format error” 2
== test.php: Failed to execute ‘/var/lib/asterisk/agi-bin/test.php’: Exec format error
AGI Tx >> 200 result=1
== Auto fallthrough, channel ‘SIP/71.172.253.68-b7b08908’ status is ‘UNKNOWN’
– Executing [h@from-trunk:1] Hangup(“SIP/71.172.253.68-b7b08908”, “”) in new stack
== Spawn extension (from-trunk, h, 1) exited non-zero on ‘SIP/71.172.253.68-b7b08908’

  1. If there are any leading spaces before the first two lines of the script make sure you remove them.

  2. make sure you use the correct php version (php or php5) in the first line of your script.