Asterisk cmd DBQuery

Asterisk application DBQuery

With DBQuery you can access your Mysql Database and query it for the needed data, or update data in your Mysql Database. It is also possible to register DBQuery as cdr backend - so you can define your own sql statement for writing cdr data. DBQuery does use the MysqlPool Resource to get a connection handle to a MySQL Database, so you achive load balancing and a fail save environment with it.

Compile it:

For compiling it you do need the mysql client libraries and header files. Asterisk and its header files are also required. If you do not have installed asterisk in the default directories, then you have to edit the Makefile and make changes to the following variables.
ASTERISKINCDIR

Set ASTERISKINCDIR variable to the directory containing the sources of Asterisk PBX.

ASTERISKMODDIR
Set ASTERISKMODDIR variable to the directory where ASTERISK's modules reside. The modules will be installed in this directory.

ASTERISKETCDIR
Set ASTERISKETCDIR variable to the directory where ASTERISK's configuration files reside. The config files will be installed in this directory.


Configure it:

Example config file can be found in the doc subdirectory.

There are two categories, the category [queries] and the category [cdr-backend].

In [queries] you have to configure the queries which should be useable by DBQuery.

callforwarding=SELECT destination FROM callforwarding WHERE extension='%s' AND class='%s'

In [cdr-backend] you can define the sql query which should get used for writing the cdr entry, the server which should get used preferred and with the option enabled you can enable or disable the cdr-backend.



Extensions example:

Example usage for DBQuery:


exten => 12,1,DBQuery(callforwarding,(${EXTEN}|unconditional),(CF_DESTINATION))

This statement will execute the sql query defined in the dbquery.conf file for the key callforwarding. It will substitute each %s with an argument provided. So the statement which will get executed will look like:
SELECT destination FROM callforwarding WHERE extension='12' AND class='unconditional'

The returned value will get placed in the channel variable ${CF_DESTINATION}



For more information just take a look at http://www.yosd.at/


Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Asterisk application DBQuery

With DBQuery you can access your Mysql Database and query it for the needed data, or update data in your Mysql Database. It is also possible to register DBQuery as cdr backend - so you can define your own sql statement for writing cdr data. DBQuery does use the MysqlPool Resource to get a connection handle to a MySQL Database, so you achive load balancing and a fail save environment with it.

Compile it:

For compiling it you do need the mysql client libraries and header files. Asterisk and its header files are also required. If you do not have installed asterisk in the default directories, then you have to edit the Makefile and make changes to the following variables.
ASTERISKINCDIR

Set ASTERISKINCDIR variable to the directory containing the sources of Asterisk PBX.

ASTERISKMODDIR
Set ASTERISKMODDIR variable to the directory where ASTERISK's modules reside. The modules will be installed in this directory.

ASTERISKETCDIR
Set ASTERISKETCDIR variable to the directory where ASTERISK's configuration files reside. The config files will be installed in this directory.


Configure it:

Example config file can be found in the doc subdirectory.

There are two categories, the category [queries] and the category [cdr-backend].

In [queries] you have to configure the queries which should be useable by DBQuery.

callforwarding=SELECT destination FROM callforwarding WHERE extension='%s' AND class='%s'

In [cdr-backend] you can define the sql query which should get used for writing the cdr entry, the server which should get used preferred and with the option enabled you can enable or disable the cdr-backend.



Extensions example:

Example usage for DBQuery:


exten => 12,1,DBQuery(callforwarding,(${EXTEN}|unconditional),(CF_DESTINATION))

This statement will execute the sql query defined in the dbquery.conf file for the key callforwarding. It will substitute each %s with an argument provided. So the statement which will get executed will look like:
SELECT destination FROM callforwarding WHERE extension='12' AND class='unconditional'

The returned value will get placed in the channel variable ${CF_DESTINATION}



For more information just take a look at http://www.yosd.at/


Asterisk | Applications | Functions | Variables | Expressions | Asterisk FAQ

Created by: wuwu, Last modification: Fri 05 of Nov, 2010 (22:41 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+