Hi, I’m stumped…
I have this func_odbc config:
[GSM]
dsn=MySQL-asterisk
readsql = INSERT INTO tt_chiamate_ricevute (Data_chiamata,Telefono) VALUES(’${SQL_ESC(${ARG1})}’, ‘${SQL_ESC(${ARG2})}’)
My extension:
exten => receiver,n,NoOp(${ODBC_GSM(${STRFTIME(${EPOCH},%Y/%m/%d %H:%M:%S)},${SIP_HEADER(From):1:13})})
My question is: if I got this config the record will be inserted but I have this (right warning) "Error -1 in FETCH [INSERT INTO tt_chiamate_ricevute (Data_chiamata,Telefono) VALUES(‘2017/04/04 19:12:13’, ‘+3xxxxxxxx’)]
if I change func_odbc from readsql to writesql I receive this error: “Function ODBC_GSM cannot be read”;
if I change func_odbc from readsql to insertsql I receive this error: “Section ‘GSM’ was found, but there was no SQL to execute. Ignoring.”
uhm, maybe I didn’t change from readsql to writesql…
I tried now but I receive this error:
Set(“SIP/gsm2-000003db”, “ODBC_GSM()=2017/04/05 19:38:43,+3xxx”) in new stack
[Apr 5 19:38:43] WARNING[31007][C-00000175]: func_odbc.c:477 execute: SQL Execute returned an error -1: HY000: [MySQL][ODBC 5.1 Driver][mysqld-5.5.5-10.2.4-MariaDB-log]Incorrect datetime value: ‘’ for column ‘Data_chiamata’ at row 1 (121)
[Apr 5 19:38:43] WARNING[31007][C-00000175]: func_odbc.c:486 execute: SQL Exec Direct failed (-1)![INSERT INTO tt_chiamate_ricevute (Data_chiamata,Telefono) VALUES(’’, ‘’)]
But with app_mysql works:
exten => ins,n,MYSQL(Query resultID ${connID} INSERT INTO tt_chiamate_ricevute(Data_chiamata,Telefono) VALUES("${STRFTIME(${EPOCH},%Y/%m/%d %H:%M:%S)}","${SIP_HEADER(From):1:13}"))