Asterisk 操作mysql数据库的应用
来源:互联网 发布:怎么上淘宝精品推荐 编辑:程序博客网 时间:2024/04/29 20:43
文章分类:行业应用
It is necessary in many application with the dialplan that we need to qurey from the database and pass the result to the aserisk dialplan command.Previously we had to use to use AGI (Asterisk Gateway Interface) for accomplish this task.This is we need some programming part to be done.Non programmers don’t worry now an application called MYSQL() is avilable with asterisk 1.4 and above.We can use this application as normal asterisk application and can give the MSQL qurey inside it. For this to work we have to install asterisk-addon first.
syntax :
MYSQL(Connect connid dhhost dbuser dbpass dbname)
Connects to a database. Arguments contain standard MySQL parameters passed to function mysql_real_connect. Connection identifer returned in ${connid}. If the connection wasn’t possible, then ${connid} == “”.
MYSQL(Query resultid ${connid} query-string)
Executes standard MySQL query contained in query-string using established connection identified by ${connid}. Result of query is stored in ${resultid}.
MYSQL(Fetch fetchid ${resultid} var1/ var2/ …/ varN)
If any rows are available to select, ${fetchid} is set to 1 and a single row is fetched from a result set contained in ${resultid}. The return fields are assigned to ${var1}, ${var2} … ${varN} respectively. If no rows are left to select, ${fetchid} is set to 0 and ${var1}, ${var2} … ${varN} remain unchanged.
MYSQL(Clear ${resultid})
Frees memory and data structures associated with result set.
MYSQL(Disconnect ${connid})
Disconnects from named connection to MySQL.
Example
syntax :
MYSQL(Connect connid dhhost dbuser dbpass dbname)
Connects to a database. Arguments contain standard MySQL parameters passed to function mysql_real_connect. Connection identifer returned in ${connid}. If the connection wasn’t possible, then ${connid} == “”.
MYSQL(Query resultid ${connid} query-string)
Executes standard MySQL query contained in query-string using established connection identified by ${connid}. Result of query is stored in ${resultid}.
MYSQL(Fetch fetchid ${resultid} var1/ var2/ …/ varN)
If any rows are available to select, ${fetchid} is set to 1 and a single row is fetched from a result set contained in ${resultid}. The return fields are assigned to ${var1}, ${var2} … ${varN} respectively. If no rows are left to select, ${fetchid} is set to 0 and ${var1}, ${var2} … ${varN} remain unchanged.
MYSQL(Clear ${resultid})
Frees memory and data structures associated with result set.
MYSQL(Disconnect ${connid})
Disconnects from named connection to MySQL.
Example
[mysqlcal] exten => 555,1,Answer exten => 555,n,MYSQL(Connect connid localhost bipin bipin voice_alerts) exten => 555,n,NoOp(${cnum}) exten => 555,n,NoOp(${jid}) exten => 555,n,MYSQL(Query resultid ${connid} INSERT INTO `callerinfo` (`number`) VALUES ('${CALLERID(num)}')) exten => 555,n,MYSQL(Query resultid ${connid} UPDATE `callerinfo` SET `status` = /'ANSWERED/' WHERE `job`=${jid} AND `number`=${cnum})
转自:http://hwzyyx.javaeye.com/blog/576741
- Asterisk 操作mysql数据库的应用
- Asterisk链接MySQL数据库
- mysql数据库的基础操作sql应用
- PHP操作MySQL数据库--PHP的应用
- asterisk 数据库(AstDB)操作
- mysql数据库应用(二)----数据库的基本操作
- asterisk主要的应用函数
- mysql数据库应用(六)----操作表的约束
- mysql数据库的应用
- mysql的数据库操作
- MySQL数据库的操作
- MySQL数据库的操作
- mysql数据库的操作
- MySql数据库的操作
- mysql 数据库的操作
- php mysql 应用操作数据库实例
- vs2010操作本地access数据库和远程操作Mysql数据的应用实例
- 基于MySQL的高性能数据库应用研发(使用C++操作MYSQL)
- 测试驱动开发简介
- Hibernate commit() 和flush() 的区别
- ora-00600 [1236] & ora-00600 [16365] & ora-04031
- feof多输出的原因 多出FF
- 堆排序的实现
- Asterisk 操作mysql数据库的应用
- 检验CC++free和delete
- Local System/Network Service/Local Service权限详解
- BLAS+BLACS+LAPACK+SCALAPACK安装
- 数组元素交叉排列的算法题(a1 a2 a3 .. an b1 b2 b3 .. bn -->a 1 b1, a2 b2, a3 b3, .. an bn )
- 内核对象
- hdu 2112 HDU Today(map hash)
- 数组元素交叉排列的算法题(a1 a2 a3 .. an b1 b2 b3 .. bn -->a 1 b1, a2 b2, a3 b3, .. an bn ) 概论思想(perfect shuffle 算法)
- 正则表达式实战