1.      (personal preference) I wouldn't use PHP
2.      that out of the way,  I comment out the AGI stuff and run my AGI's
from bash to make sure the non AGI stuff is happy.
3.      the AGI seems to be ok here, I'd make sure my SQL stuff is good.

 

  _____  

From: asterisk-users-boun...@lists.digium.com
[mailto:asterisk-users-boun...@lists.digium.com] On Behalf Of Jonas Kellens
Sent: Wednesday, June 30, 2010 10:32 AM
To: Asterisk Users Mailing List - Non-Commercial Discussion
Subject: Re: [asterisk-users] queue command in asterisk 1.4with
macro-argument

 

Taking my first steps into AGI then :


[r...@asterisk agi-bin]# cat sample.agi 
#!/usr/bin/php -q
<?php
$MYSQLSERVER2="localhost";
$MYSQLUSER2="user";
$MYSQLPASSWD2="passwd";

set_time_limit(30);
require('phpagi/phpagi.php');
$agi = new AGI();

$db=mysql_connect("$MYSQLSERVER2", "$MYSQLUSER2", "$MYSQLPASSWD2");
mysql_select_db(Asterisk, $db);

$QUERY="SELECT vmcontext FROM AstDB WHERE ID='40'";
$agi->verbose("query is: $QUERY", 3);
$result=mysql_query($QUERY);
$VMCONTEXT=mysql_fetch_array($result);
$agi->verbose("VMCONTEXT is: $VMCONTEXT", 3);
$vmcontext=$VMCONTEXT['vmcontext'];

$exten = $agi->request['agi_extension']; //Dialed extension
// the result is stored in $exten
$agi->verbose("variable exten : $exten", 3);
$agi->verbose("variable vmcontext : $vmcontext", 3);
//
?>


[Jun 30 17:26:04]     -- Executing [...@test:3] AGI("SIP/test-00000054",
"sample.agi") in new stack
[Jun 30 17:26:04]     -- Launched AGI Script
/var/lib/asterisk/agi-bin/sample.agi
[Jun 30 17:26:04]     --  sample.agi: query is: SELECT vmcontext FROM AstDB
WHERE klantID='40'
[Jun 30 17:26:04]     --  sample.agi: VMCONTEXT is: 
[Jun 30 17:26:04]     --  sample.agi: variable exten : 123
[Jun 30 17:26:04]     --  sample.agi: variable vmcontext : 
[Jun 30 17:26:04]     -- AGI Script sample.agi completed, returning 0


Does AGI not interpret my query correctly ? As there is no output for
$vmcontext...



Jonas.


On 06/30/2010 04:54 PM, Jim Dickenson wrote: 

Yes it gets called when the call is connected to a queue member.

 

In version 1.4.x you can execute an AGI instead of a sub or macro.

 

-- 
_____________________________________________________________________
-- Bandwidth and Colocation Provided by http://www.api-digital.com --
New to Asterisk? Join us for a live introductory webinar every Thurs:
               http://www.asterisk.org/hello

asterisk-users mailing list
To UNSUBSCRIBE or update options visit:
   http://lists.digium.com/mailman/listinfo/asterisk-users

Reply via email to