Hello…
I have a very strange problem, at least for me…
Im using Asterisk 13.20.
I will present two example. Inserting the txt in mysql database over odbc connector with asterisk.
In first, ifI do not use the comma caracter then inserting is normal and the txt stay in same coloumn. In both case dialplan is same only in one line is different:
[test-mysql-input]
exten => 8888,1,Verbose(Lets set the MESSAGE) with some message);
;same => n,Set(MESSAGE=Hello,this example, will divide, totally, the message, because of comma, caracter.);
same => n,Set(MESSAGE=Hello this example and it wont divide the message couse I didnt use comma caracter.);
same => n,Set(NOW=${STRFTIME(${EPOCH},,%d.%m.%Y %H:%M:%S)})
same => n,Set(CDR(TYPE_OF_CALL)=OUTGOING);
same => n,Set(CDR(start_)=${CDR(start)})
same => n,Set(CALLERID(num)=12345)
same => n,Set(MESSAGE_SEND_STATUS=SENT)
same => n,Set(USER_1=Me)
same => n,Set(DONGLE_NAME=Dongle_0)
same => n,Set(CDR(phone_ip)=192.168.1.2)
same => n,Set(DONGLE_MANUF_MODEL=blabla)
same => n,Set(DONGLE_CARRIER=again bla bla)
same => n,Set(CDR(useragent_)=CSipSimple_sagit-26/r2457)
same => n(ok),Set(ODBC_D1_SMSHISTORY()=${CDR(TYPE_OF_CALL)},${CDR(start_)},${MESSAGE},${MESSAGE_SEND_STATUS},${USER_1},${DONGLE_NAME},${CALLERID(num)},${CDR(phone_ip)},${DONGLE_MANUF_MODEL},${DONGLE_CARRIER},${CDR(useragent_)})
same => n,Hangup();
The result looks like this from CLI:
orangepipc*CLI> console dial 8888@test-mysql-input
== Console is full duplex
[Jun 29 14:22:25] NOTICE[17328]: console_video.c:137 console_video_start: voice only, console video support not present
-- Executing [8888@test-mysql-input:1] Verbose("Console/dsp", "Lets set the MESSAGE) with some message") in new stack
Lets set the MESSAGE) with some message
-- Executing [8888@test-mysql-input:2] Set("Console/dsp", "MESSAGE=Hello this example and it wont divide the message couse I didnt use comma caracter.") in new stack
-- Executing [8888@test-mysql-input:3] Set("Console/dsp", "NOW=29.06.2018 14:22:25") in new stack
-- Executing [8888@test-mysql-input:4] Set("Console/dsp", "CDR(TYPE_OF_CALL)=OUTGOING") in new stack
-- Executing [8888@test-mysql-input:5] Set("Console/dsp", "CDR(start_)=2018-06-29 14:22:25") in new stack
-- Executing [8888@test-mysql-input:6] Set("Console/dsp", "CALLERID(num)=12345") in new stack
-- Executing [8888@test-mysql-input:7] Set("Console/dsp", "MESSAGE_SEND_STATUS=SENT") in new stack
-- Executing [8888@test-mysql-input:8] Set("Console/dsp", "USER_1=Me") in new stack
-- Executing [8888@test-mysql-input:9] Set("Console/dsp", "DONGLE_NAME=Dongle_0") in new stack
-- Executing [8888@test-mysql-input:10] Set("Console/dsp", "CDR(phone_ip)=192.168.1.2") in new stack
-- Executing [8888@test-mysql-input:11] Set("Console/dsp", "DONGLE_MANUF_MODEL=blabla") in new stack
-- Executing [8888@test-mysql-input:12] Set("Console/dsp", "DONGLE_CARRIER=again bla bla") in new stack
-- Executing [8888@test-mysql-input:13] Set("Console/dsp", "CDR(useragent_)=CSipSimple_sagit-26/r2457") in new stack
-- Executing [8888@test-mysql-input:14] Set("Console/dsp", "ODBC_D1_SMSHISTORY()=OUTGOING,2018-06-29 14:22:25,Hello this example and it wont divide the message couse I didnt use comma caracter.,SENT,Me,Dongle_0,12345,192.168.1.2,blabla,again bla bla,CSipSimple_sagit-26/r2457") in new stack
-- Executing [8888@test-mysql-input:15] Hangup("Console/dsp", "") in new stack
== Spawn extension (test-mysql-input, 8888, 15) exited non-zero on 'Console/dsp'
<< Hangup on console >>
orangepipc*CLI>
and the database:
In second example if I use the comma caracter text is entering in different coloumn:
[test-mysql-input]
exten => 8888,1,Verbose(Lets set the MESSAGE) with some message);
same => n,Set(MESSAGE=Hello,this example, will divide, totally, the message, because of comma, caracter.);
;same => n,Set(MESSAGE=Hello this example and it wont divide the message couse I didnt use comma caracter.);
same => n,Set(NOW=${STRFTIME(${EPOCH},,%d.%m.%Y %H:%M:%S)})
same => n,Set(CDR(TYPE_OF_CALL)=OUTGOING);
same => n,Set(CDR(start_)=${CDR(start)})
same => n,Set(CALLERID(num)=12345)
same => n,Set(MESSAGE_SEND_STATUS=SENT)
same => n,Set(USER_1=Me)
same => n,Set(DONGLE_NAME=Dongle_0)
same => n,Set(CDR(phone_ip)=192.168.1.2)
same => n,Set(DONGLE_MANUF_MODEL=blabla)
same => n,Set(DONGLE_CARRIER=again bla bla)
same => n,Set(CDR(useragent_)=CSipSimple_sagit-26/r2457)
same => n(ok),Set(ODBC_D1_SMSHISTORY()=${CDR(TYPE_OF_CALL)},${CDR(start_)},${MESSAGE},${MESSAGE_SEND_STATUS},${USER_1},${DONGLE_NAME},${CALLERID(num)},${CDR(phone_ip)},${DONGLE_MANUF_MODEL},${DONGLE_CARRIER},${CDR(useragent_)})
same => n,Hangup();
and the output in CLI is:
orangepipc*CLI> console dial 8888@test-mysql-input
== Console is full duplex
[Jun 30 08:19:38] NOTICE[9606]: console_video.c:137 console_video_start: voice only, console video support not present
-- Executing [8888@test-mysql-input:1] Verbose("Console/dsp", "Lets set the MESSAGE) with some message") in new stack
Lets set the MESSAGE) with some message
-- Executing [8888@test-mysql-input:2] Set("Console/dsp", "MESSAGE=Hello,this example, will divide, totally, the message, because of comma, caracter.") in new stack
-- Executing [8888@test-mysql-input:3] Set("Console/dsp", "NOW=30.06.2018 08:19:38") in new stack
-- Executing [8888@test-mysql-input:4] Set("Console/dsp", "CDR(TYPE_OF_CALL)=OUTGOING") in new stack
-- Executing [8888@test-mysql-input:5] Set("Console/dsp", "CDR(start_)=2018-06-30 08:19:38") in new stack
-- Executing [8888@test-mysql-input:6] Set("Console/dsp", "CALLERID(num)=12345") in new stack
-- Executing [8888@test-mysql-input:7] Set("Console/dsp", "MESSAGE_SEND_STATUS=SENT") in new stack
-- Executing [8888@test-mysql-input:8] Set("Console/dsp", "USER_1=Me") in new stack
-- Executing [8888@test-mysql-input:9] Set("Console/dsp", "DONGLE_NAME=Dongle_0") in new stack
-- Executing [8888@test-mysql-input:10] Set("Console/dsp", "CDR(phone_ip)=192.168.1.2") in new stack
-- Executing [8888@test-mysql-input:11] Set("Console/dsp", "DONGLE_MANUF_MODEL=blabla") in new stack
-- Executing [8888@test-mysql-input:12] Set("Console/dsp", "DONGLE_CARRIER=again bla bla") in new stack
-- Executing [8888@test-mysql-input:13] Set("Console/dsp", "CDR(useragent_)=CSipSimple_sagit-26/r2457") in new stack
-- Executing [8888@test-mysql-input:14] Set("Console/dsp", "ODBC_D1_SMSHISTORY()=OUTGOING,2018-06-30 08:19:38,Hello,this example, will divide, totally, the message, because of comma, caracter.,SENT,Me,Dongle_0,12345,192.168.1.2,blabla,again bla bla,CSipSimple_sagit-26/r2457") in new stack
-- Executing [8888@test-mysql-input:15] Hangup("Console/dsp", "") in new stack
== Spawn extension (test-mysql-input, 8888, 15) exited non-zero on 'Console/dsp'
<< Hangup on console >>
orangepipc*CLI>
and in database looks like:
In both case Im using in func_odbc.conf:
....
....
[D1_SMSHISTORY]
prefix=ODBC
dsn=asterisk
writesql=INSERT INTO D1_SMS_HISTORY (sms_type,time_date,message,msg_send_stat,username,dongle_name,sms_from,phone_ip,dongle_model,provider,user_agent) VALUES('${VAL1}','${VAL2}','${VAL3}','${VAL4}','${VAL5}','${VAL6}','${VAL7}','${VAL8}','${VAL9}','${VAL10}','${VAL11}')
...
...
and in odbc.ini:
[asterisk-connector]
Description = MySQL connection to 'asterisk' database
Driver = MySQL
Database = asterisk
Server = 192.168.1.224
Port = 3306
Socket = /var/lib/mysql/mysql.sock
Why this happening? Im try to souround with quote, with {}, but result is same.
Can someone suggest me how?