FreeBBX 12 Asterisk 11 PHPAGI.php Script Executes but Does Nothing

I wrote a very simple AGI script:

#!/usr/bin/php -q

<?php require('phpagi.php'); $agi = new AGI(); $agi->set_variable('CALLERID(num)','230144808'); $agi->verbose("mwi.php: callerid set to 230144808"); $agi->exec_dial("SIP", "[email protected]"); $agi->hangup(); ?>

It runs when called, but does nothing.

-- Executing [[email protected]:1] AGI("Local/[email protected];2", "mwi.php,0") in new stack
-- Launched AGI Script /var/lib/asterisk/agi-bin/mwi.php

<Local/[email protected];2>AGI Tx >> agi_request: mwi.php
<Local/[email protected];2>AGI Tx >> agi_channel: Local/[email protected];2
<Local/[email protected];2>AGI Tx >> agi_language: en
<Local/[email protected];2>AGI Tx >> agi_type: Local
<Local/[email protected];2>AGI Tx >> agi_uniqueid: 1445130347.71
<Local/[email protected];2>AGI Tx >> agi_version: 11.18.0
<Local/[email protected];2>AGI Tx >> agi_callerid: unknown
<Local/[email protected];2>AGI Tx >> agi_calleridname: unknown
<Local/[email protected];2>AGI Tx >> agi_callingpres: 67
<Local/[email protected];2>AGI Tx >> agi_callingani2: 0
<Local/[email protected];2>AGI Tx >> agi_callington: 0
<Local/[email protected];2>AGI Tx >> agi_callingtns: 0
<Local/[email protected];2>AGI Tx >> agi_dnid: unknown
<Local/[email protected];2>AGI Tx >> agi_rdnis: unknown
<Local/[email protected];2>AGI Tx >> agi_context: mwi-custom
<Local/[email protected];2>AGI Tx >> agi_extension: 777770
<Local/[email protected];2>AGI Tx >> agi_priority: 1
<Local/[email protected];2>AGI Tx >> agi_enhanced: 0.0
<Local/[email protected];2>AGI Tx >> agi_accountcode:
<Local/[email protected];2>AGI Tx >> agi_threadid: 140030139971328
<Local/[email protected];2>AGI Tx >> agi_arg_1: 0
<Local/[email protected];2>AGI Tx >>
> [INSERT INTO cel (eventtype,eventtime,cid_name,cid_num,cid_ani,cid_rdnis,cid_dnid,exten,context,channame,appname,appdata,amaflags,accountcode,uniqueid,linkedid,peer,userdeftype,userfield) VALUES (‘CHAN_START’,{ts ‘2015-10-17 21:05:47.190058’},’’,’’,’’,’’,’’,‘777770’,‘mwi-custom’,‘Local/[email protected];2’,’’,’’,3,’’,‘1445130347.71’,‘1445130347.70’,’’,’’,’’)]
– <Local/[email protected];2>AGI Script mwi.php completed, returning 0

I know I must be doing something wierd, but I don’t know what it is.

(Also I can’t figure out how to add a relevant tag :frowning: )

Is your script in the same folder as phpagi.php? If you are editing with windows, make sure your script has unix EOL (end of line).

Hi, Igaetz. Thanks for your response.

My script,mwi.php is in /var/lib/asterisk/agi-bin along with phpagi.php.

-rwxrwxr-x 1 asterisk asterisk 244 Oct 18 12:30 /var/lib/asterisk/agi-bin/mwi.php
-rwxrwxr-x 1 asterisk asterisk 65400 Oct 12 15:21 /var/lib/asterisk/agi-bin/phpagi.php

I wish it would produce an error someplace. It just silently doesn’t do anything. Any other ideas?

Thanks

Sounds a bit basic, but have you tried opening a logging file on line 1 and then writing to it every line to check which lines are actually executing?