I am a beginner studying asterisk.
Call agi in dianplan extensions.conf and query mysql
I’d like to bring that back. agi is written in C.
The contents of a2.c are
#include “/usr/include/mysql/mysql.h”
#include <stdio.h>
#include <stdlib.h>
int main(int argc, char **argv)
{
MYSQL con = mysql_init(NULL);
MYSQL_RES result;
MYSQL_ROW row;
int stat;
if (con == NULL)
{
fprintf(stderr, “%s\n”, mysql_error(con));
exit(1);
}
if (mysql_real_connect(con, “localhost”, “root”, “summitP3101!”, “parkgolf”, 0, NULL, 0) == NULL)
{
fprintf(stderr, “%s\n”, mysql_error(con));
mysql_close(con);
exit(1);
}
if (mysql_query(con, “select * from attread”))
{
fprintf(stderr, “%s\n”, mysql_error(con));
mysql_close(con);
exit(1);
}
result = mysql_store_result(con);
while( (row = mysql_fetch_row(result)) != NULL)
{
printf(“%s %s %s\n”,row[0],row[1],row[2]);
}
mysql_free_result(result);
mysql_close(con);
return 0;
}
Here, row[0], row[1]… I want to read the values from extension.conf.
I’m asking for help because I don’t know how.