Asterisk 操作mysql数据库的应用

Asterisk 操作mysql数据库的应用

 

文章分类:行业应用

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

[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

版权声明:本文内容由互联网用户自发贡献,该文观点仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请联系我们举报,一经查实,本站将立刻删除。

发布者:全栈程序员-站长,转载请注明出处:https://javaforall.net/100512.html原文链接:https://javaforall.net

(0)
全栈程序员-站长的头像全栈程序员-站长


相关推荐

  • kafka 集群运维和使用「建议收藏」

    kafka 集群运维和使用「建议收藏」最近在维护kafka集群,遇到了很多问题都需要记录下,1. kafka的topic级别的配置修改

    2022年5月29日
    27
  • VMware14密钥_vmware密钥14

    VMware14密钥_vmware密钥14VMware虚拟机已升级至14版本,之前的12版本的秘钥已经无法使用,在此分享一下VMwareWorkstation14永久激活密钥:CG54H-D8D0H-H8DHY-C6X7X-N2KG6ZC3WK-AFXEK-488JP-A7MQX-XL8YFAC5XK-0ZD4H-088HP-9NQZV-ZG2R4ZC5XK-A6E0M-080XQ-04ZZG-YF08DZY5H0-D3Y8…

    2022年9月14日
    1
  • CNN卷积神经网络框架_fpga 神经网络

    CNN卷积神经网络框架_fpga 神经网络理论建立与效果展示正在写。。。环境:Vivado2019.2。Part:xcku040-ffva1156-2-i,内嵌DSP个数1920个,BRAM600个也就是21.1Mb。说明:通过识别加高斯白噪声的正弦波、余弦波、三角波较简单的实例来利用FPGA实现一维CNN网络,主要是实现CNN网络的搭建。也就是将下列数据传输至FPGA,识别出下面哪些是正弦波、余弦波、三角波,通过简单实例实践,在融会贯通。实现流程:训练参数:通过pytorch对10000个训练集进行训练获得训练参数,反向计算不

    2022年9月22日
    1
  • 在Debian上安装SVN。

    在Debian上安装SVN。

    2021年8月12日
    40
  • nested_initialization error sql*net

    nested_initialization error sql*net1.报错:###Cause:java.sql.SQLSyntaxErrorException:ORA-00911:无效字符;badSQLgrammar[];nestedexceptionisjava.sql.SQLSyntaxErrorException:ORA-00911:无效字符2.出错原因:1)sql在数据库执行都是OK的。真…

    2022年8月20日
    5
  • 给Android程序猿的六个建议

    给Android程序猿的六个建议

    2022年2月1日
    39

发表回复

您的邮箱地址不会被公开。 必填项已用 * 标注

关注全栈程序员社区公众号