[asterisk-users] queue command in asterisk 1.4 with macro-argument
Jonas Kellens
jonas.kellens at telenet.be
Wed Jun 30 10:31:43 CDT 2010
Taking my first steps into AGI then :
[root at 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 [123 at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20100630/c56d0442/attachment.htm
More information about the asterisk-users
mailing list