[asterisk-users] Asterisk 1.4 func_odbc frustrations

Doug Lytle support at drdos.info
Wed Jun 29 12:23:44 CDT 2011


Maybe somebody can help me here.

I've finally got another server together, so I can test and upgrade a 
couple of my older 1.4.x installations.

I figured that while I'm at it, I'll give func_odbc a try (have been 
using the mysql addon), knowing full well that when I finally move over 
to 1.8.x, it's what I'm planning on using.

I've installed all the requisites listed for ODBC, compiled and install 
the current 1.4.41.1 (Was current a couple days ago) and set out 
Googling how-tos and digging into voip-info.org

After an hour, I had what seemed to be a good test case, so did a copy 
of my dialplan and started making changes.

On querying my database, everything is working as expected, but for the 
life of me, I cannot get entries in my database to update the master 
mysql server

I've seen lots of conflicting data on how it should be written out in 
the func_odbc.conf and a lot of the info is for 1.6.

My setup:

1 master mysql server
1 test slave

The test Asterisk system reads from the local mysql database and writes 
back to the master.

My /etc/odbc.ini

[MySQL-Conferencing]
Description     = Conferencing MySQL ODBC
Driver          = MySQL
Socket          = /var/lib/mysql/mysql.sock
Server          = 127.0.0.1
User            = username
Password        = password
Database        = Conferencing
Option          = 3

[MySQL-Corporate]
Description     = Conferencing MySQL ODBC
Driver          = MySQL
Server          = 192.168.104.142
User            = username
Password        = password
Database        = Conferencing
Option          = 3

My /etc/asterisk/res_odbc.conf

[MySQL-Conferencing]
enabled => yes
dsn => MySQL-Conferencing
username => username
password => password
preconnect => yes

[MySQL-Corporate]
enabled => yes
dsn => MySQL-Corporate
username => username
password => password
preconnect => yes

My /etc/asterisk/func_odbc.conf

[CONFERENCE]
dsn=MySQL-Conferencing
read=SELECT room, password, admin, scheduled, owner, comments FROM 
${ARG1} WHERE ${ARG2}=${SQL_ESC(${ARG3})}

[CONFERENCE_WRITE]
dsn=MySQL-Corporate
write=UPDATE Corporate SET room=${VAL1}, password=${VAL2}, 
admin=${VAL3}, scheduled=${VAL4}, owner=${VAL5}, comments=${VAL6} WHERE 
admin=${VAL3}


The reading from ODBC works fine:

exten => 
s-verify,n,Set(ARRAY(conference.room,conference.password,conference.admin,conference.scheduled,conference.owner,conference.comments)=${ODBC_CONFERENCE_WRITE(Corporate,admin,${get-admin-password})})

The Writing does not work.

exten => 
s-setup,n,Set(ODBC_CONFERENCE_WRITE(room=${conference.room}\,password=${put-new-password}\,admin=${conference.admin}\,scheduled=${TODAY}\,owner=${conference.owner}\,comments=${conference.comments})

Any suggestions would be appreciated,

Doug


-- 

Ben Franklin quote:

"Those who would give up Essential Liberty to purchase a little Temporary Safety, deserve neither Liberty nor Safety."




More information about the asterisk-users mailing list