logo

func_odbc

Created 1 Jun 2006 - 4:21am
Published on Asterisk :: The Open Source PBX & Telephony Platform
One of the new features that will be available in Asterisk 1.4 will be a template-driven SQL function, whose name is func_odbc. This new tool will allow an administrator to create an SQL template, to be filled in with variables from the dialplan. Given popular demand, this module has been backported to 1.2, so it may be used with that earlier version. The svn repository where this backport is kept is at SVN Community [1]. This backport will be kept up to date at least until 1.4 is released.

The simplest case which might show the utility of this new module is a replacement for the DB command:

func_odbc.conf:
[ASTDB]
dsn=mysql1
read=SELECT astvalue FROM astdb WHERE astfamily='${ARG1}' AND astkey='${ARG2}'
write=REPLACE INTO astdb (astfamily, astkey, astvalue) VALUES ('${ARG1}','${ARG2}','${VALUE}')

extensions.conf:
exten => _XXX,1,Set(open=${ODBC_ASTDB(office,open)})
...
; 600 turns the system off, 601 turns the system on
exten => _60[01],1,Set(ODBC_ASTDB(office,open)=${EXTEN:2})


Source URL: http://www.asterisk.org/func_odbc