Freepbx 17.I am using ODBC to write some data to a Database(US_CIS2QUE and table is US_Customer )
freepbx user has the grant to insert to this database.
GRANT SELECT, INSERT, UPDATE ON US_CIS2QUE.* TO freepbxuser@localhost
func_odbc.conf :
[US_ADDCUSTOMER]
prefix=ODBC
dsn=US_CIS2QUE
mode=write
writehandle=US_CIS2QUE
readsql=SELECT cust_name,queue_no,queue_name FROM US_Customer WHERE cust_no=‘${SQL_ESC(${ARG1})}’
writesql=INSERT INTO US_Customer SET cust_no=‘${SQL_ESC(${ARG1})}’, cust_name=‘${SQL_ESC(${VAL1})}’, queue_no=‘${SQL_ESC(${VAL2})}’, queue_name=‘${SQL_ESC(${VAL3})}’, caller_id=‘${SQL_ESC(${ARG5})}’;
readsql = SELECT ‘OK’
odbc.ini
[US_CISCustInfo]
Description=Connect to US CISCustInfo US_CIS2QUE
driver=MySQL
server=localhost
database=US_CIS2QUE
Port=3306
Socket=
option=3
res_odbc_custom.conf
[US_CIS2QUE]
enabled => yes
dsn => US_CISCustInfo
username=> freepbxuser
password=> xxxxxxxxxx
pooling => yes
limit => 1
pre-connect => yes
autocommit => yes
And I call it from custom dial plan :
same => n,Set(RESULT=${ODBC_US_ADDCUSTOMER(${Cust_no},${Cust_name},${Queue_no},${Queue_name},${CALLERID(num)})})
In asterisk log I see RESULT is OK but data is not added to the database.
If I add it manually I can see data and if I update func_odbc to :
writesql = INSERT INTO US_Customer SET cust_no=‘100401’, cust_name=‘TEST CUSTOMER’, queue_no=‘99900001’, queue_name=‘Test Queue’, caller_id='764764
Same result. I dont see it in DB. Read is working. Write is not. Any idea why?
And this is odbc show
ODBC DSN Settings
Name: US_CIS2QUE
DSN: US_CISCustInfo
Number of active connections: 1 (out of 1)
Logging: Disabled