PHP AGI, issues with setup on Trixbox

Currently I am playing around with Trixbox. In particular I am using version (trixbox CE 2.6.2.3 (Stable)) running on Asterisk 1.4.

I have done a fresh install on a laptop using the ISO file, I have set the extension 200 to be active in extension config I have used the following lines:

exten => 200,1,Answer exten => 200,2,AGI(test.php) exten => 200,3,Hangup

This should then call my script in /var/lib/asterisk/agi-bin/test.php and initialise it. I have CHMOD the file to 777 so permissions are all ok and the PHP file itself is pretty basic.

When I ring the extension 200 I get a pretty much instantaneous hang up and within the CLI of asterisk I have something along the lines of:

[code]
– Launched AGI Script /var/lib/asterisk/agi-bin.test.php

(Some lines of pointless output)

“AGI Tx >> 510 Invalid or unknown command”[/code]

This happens on multiple lines. The problem is I am fairly sure these are valid commands so perhaps this is some issues with PHP?

Would someone be able to give me a hand with this and hopefully allow me to solve this issue?

One of your “pointless lines” should contain what it is objecting to!!!

Well the lines are as follows:

AGI Tx >> agi_request: test.php AGI Tx >> agi_channel: SIP/(Some internal IP) AGI Tx >> agi_language: en AGI Tx >> agi_type: SIP AGI Tx >> agi_uniqueid: (Long number) AGI Tx >> agi_callerdid: root AGI Tx >> agi_calleridname: root AGI Tx >> agi_callingpres: 0 AGI Tx >> agi_callingani2: 0 AGI Tx >> agi_callington: 0 AGI Tx >> agi_callingtns: 0 AGI Tx >> agi_dnid: 200 AGI Tx >> agi_rdnis: unknown AGI Tx >> agi_context: from-did-direct AGI Tx >> agi_extension: 200 AGI Tx >> agi_priority: 2 AGI Tx >> agi_enhanced: 0.0 AGI Tx >> agi_accountcode: AGI Tx >> AGI Rx >> Usage: php [options] [-f] <file> [--] [args...] AGI Tx >> 510 Invalid or Unknown Command (This then repeats with usage and invalid command)

Your #! line is invalid.

[code]#!/usr/bin/php -q

<?php[/code]

Yes. That’s invalid according to my (CentOS 5.3) php man page (no -q option).

So I am assuming I need no -q line? And things should look a little better.

The normal rules for #! lines apply.

faqs.org/faqs/unix-faq/faq/p … on-16.html

Hmm after removing -q seem to have issues with the actual file being found