[Asterisk-Users] AGI to read MySQL

Lewis Agosta voipstreet at gmail.com
Thu Jun 15 07:45:39 MST 2006


We user mySQL in certain instances of AGI and it works great.  This
information has helped us quite a bit.  If you are using php - make sure you
are using the CLI version.

http://phpagi.sourceforge.net/

Here is a code snip of how we are doing it.

#!/usr/local/bin/php -q
<?php
/**
* @package phpAGI_examples
* @version 2.0
*/
#
set_time_limit(60);
require('phpagi.php');
$agi = new AGI();
$agi->verbose("Launching AGI...");
#
$link = mysql_connect("0.0.0.0", "dbname", "dbpass")
or die("Could not connect: " . mysql_error());
#
mysql_select_db("dbname")
or die ('The database specified in database_name must exist and must be
accessible by the user specified in mysql_connect');
#
$query = "SELECT * FROM yourtable";
$agi->verbose($query);
$result = mysql_query ($query)
or die('could not select yourtable file!');
$arow = mysql_fetch_array($result);
...and so on...


On 6/15/06, Frederic Jean <fjean at sunnetgroup.net> wrote:
>
>  Walid,
>
> Check the ASTCC agi script ; it just does exactly that:
>
> http://www.voip-info.org/wiki-ASTCC
>
> Cheers,
> Fred
>
>  ----- Original Message -----
> *From:* Walid Azab <wazab at noor.net>
> *To:* asterisk-users at lists.digium.com
> *Sent:* Thursday, June 15, 2006 11:14
> *Subject:* [Asterisk-Users] AGI to read MySQL
>
>
>
> Hello everyone,
>
> I am not an expert in Asterisk programming yet. So, can someone help me
> put my first steps on how to use AGI to access MySQL tables and do queries.
> Any reference or help is appreciated. My target is to get Festival to read
> TTS from data stored in MySQL table based on the ID that the caller will
> input after his call is answered.
>
> Thanks
>
>
>
> ------------------------------
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com <http://easynews.com/>--
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>    http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
> _______________________________________________
> --Bandwidth and Colocation provided by Easynews.com <http://easynews.com/>--
>
> Asterisk-Users mailing list
> To UNSUBSCRIBE or update options visit:
>   http://lists.digium.com/mailman/listinfo/asterisk-users
>
>
>


-- 
Origination that includes real support!
http://www.VoIPStreet.com
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20060615/998f1706/attachment.htm


More information about the asterisk-users mailing list