A Smart Telephony Platform

Page tree
Skip to end of metadata
Go to start of metadata

Problem

In some cases, when you enable odbc-dsn in sip-profile and reload Sofia profile, FreeSwitch gives you an error like below: 

2020-06-11 07:30:48.559653 [DEBUG] sofia.c:3158 Creating agent for default
2020-06-11 07:30:48.559653 [ERR] switch_odbc.c:522 ERR: [delete from sip_registrations where sub_host is null and hostname='betelgeuse_web_serice1' and network_ip like '%' and network_port like '%' and sip_username like '%' and mwi_user  like '%' and mwi_host like '%' and orig_server_host like '%' and orig_hostname like '%';delete from sip_registrations where sub_host is null and hostname='betelgeuse_web_serice1' and network_ip like '%' and network_port like '%' and sip_username like '%' and mwi_user  like '%' and mwi_host like '%' and orig_server_host like '%' and orig_hostname like '%']
[STATE: 42000 CODE 1064 ERROR: [MySQL][ODBC 8.0(a) Driver][mysqld-8.0.16]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete from sip_registrations where sub_host is null and hostname='betelgeuse_we' at line 1
]
2020-06-11 07:30:48.559653 [ERR] switch_core_sqldb.c:732 [db="ASTPP";type="odbc"user="astpp_odbc";pass="Iuv4_wuHjU6cqMFXn4Hm"] ODBC SQL ERR [STATE: 42000 CODE 1064 ERROR: [MySQL][ODBC 8.0(a) Driver][mysqld-8.0.16]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete from sip_registrations where sub_host is null and hostname='betelgeuse_we' at line 1
]
delete from sip_registrations where sub_host is null and hostname='betelgeuse_web_serice1' and network_ip like '%' and network_port like '%' and sip_username like '%' and mwi_user  like '%' and mwi_host like '%' and orig_server_host like '%' and orig_hostname like '%';delete from sip_registrations where sub_host is null and hostname='betelgeuse_web_serice1' and network_ip like '%' and network_port like '%' and sip_username like '%' and mwi_user  like '%' and mwi_host like '%' and orig_server_host like '%' and orig_hostname like '%'
2020-06-11 07:30:48.559653 [CRIT] sofia_glue.c:2625 GREAT SCOTT!!! Cannot execute batched statements! [STATE: 42000 CODE 1064 ERROR: [MySQL][ODBC 8.0(a) Driver][mysqld-8.0.16]You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'delete from sip_registrations where sub_host is null and hostname='betelgeuse_we' at line 1
]
If you are using mysql, make sure you are using MYODBC 3.51.18 or higher and enable FLAG_MULTI_STATEMENTS
2020-06-11 07:30:48.559653 [CRIT] sofia.c:3161 Cannot Open SQL Database [default]!

Solution

Add OPTION parameter in /etc/odbc.ini file

  1. Open /etc/odbc.ini file
  2. Add OPTION = 67108864 at the end of file and save it. 
  3. Go to FreeSwitch console and reload mod_sofia