<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<meta content="text/html; charset=ISO-8859-1"
http-equiv="Content-Type">
</head>
<body text="#000000" bgcolor="#ffffff">
<font face="Helvetica, Arial, sans-serif">Taking my first steps into
AGI then :<br>
<br>
<br>
[root@asterisk agi-bin]# cat sample.agi <br>
#!/usr/bin/php -q<br>
<?php<br>
$MYSQLSERVER2="localhost";<br>
$MYSQLUSER2="user";<br>
$MYSQLPASSWD2="passwd";<br>
<br>
set_time_limit(30);<br>
require('phpagi/phpagi.php');<br>
$agi = new AGI();<br>
<br>
$db=mysql_connect("$MYSQLSERVER2", "$MYSQLUSER2", "$MYSQLPASSWD2");<br>
mysql_select_db(Asterisk, $db);<br>
<br>
$QUERY="SELECT vmcontext FROM AstDB WHERE ID='40'";<br>
$agi->verbose("query is: $QUERY", 3);<br>
$result=mysql_query($QUERY);<br>
$VMCONTEXT=mysql_fetch_array($result);<br>
$agi->verbose("VMCONTEXT is: $VMCONTEXT", 3);<br>
$vmcontext=$VMCONTEXT['vmcontext'];<br>
<br>
$exten = $agi->request['agi_extension']; //Dialed extension<br>
// the result is stored in $exten<br>
$agi->verbose("variable exten : $exten", 3);<br>
$agi->verbose("variable vmcontext : $vmcontext", 3);<br>
//<br>
?><br>
<br>
<br>
[Jun 30 17:26:04] -- Executing [123@test:3]
AGI("SIP/test-00000054", "sample.agi") in new stack<br>
[Jun 30 17:26:04] -- Launched AGI Script
/var/lib/asterisk/agi-bin/sample.agi<br>
[Jun 30 17:26:04] -- sample.agi: query is: SELECT vmcontext FROM
AstDB WHERE klantID='40'<br>
[Jun 30 17:26:04] -- sample.agi: VMCONTEXT is: <br>
[Jun 30 17:26:04] -- sample.agi: variable exten : 123<br>
[Jun 30 17:26:04] -- sample.agi: variable vmcontext : <br>
[Jun 30 17:26:04] -- AGI Script sample.agi completed, returning 0<br>
<br>
<br>
Does AGI not interpret my query correctly ? As there is no output for
$vmcontext...<br>
<br>
<br>
<br>
Jonas.<br>
<br>
</font><br>
On 06/30/2010 04:54 PM, Jim Dickenson wrote:
<blockquote cite="mid:AEFA434A-8F06-4E6E-8EBE-93B733915090@cfmc.com"
type="cite">
<div>Yes it gets called when the call is connected to a queue member.</div>
<div><br>
</div>
In version 1.4.x you can execute an AGI instead of a sub or macro.<br>
</blockquote>
<br>
</body>
</html>