<div dir="ltr"><div>Hello Everyone,</div><div><br></div><div>I have some questions regarding msilo module usage for MS SQL DB integration using db_unixodbc module.</div><div><br></div><div>Following instructions found in OpenSips documentation, I&#39;ve installed UnixODBC (v2.2.14) and FreeTDS (v0.82) and configured it properly. I&#39;m currently using some other modules which store information persistently in DB as dispatcher, usrloc or subscriber. Those modules are working properly, but I&#39;m having some troubles with msilo module.</div><div>Since sql scripts are not included for MS MSQL DB, I&#39;ve created tables manually. The problem I&#39;m facing with msilo module is related to body column in msilo table. Since this column must be binary, I&#39;ve defined it as &#39;varbinary(500)&#39; MS SQL data type.</div><div><br></div><div>The following error is shown in OpenSips log file when msilo tries to store messages to DB:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>Feb 29 16:06:05 deservoz2 /opt/opensips-1.11.5/sbin/opensips[21623]: ERROR:db_unixodbc:db_unixodbc_submit_query: rv=-1. Query= insert into silo (username,domain,dst_addr,src_addr,body,ctype,exp_time,inc_time,snd_time ) values (&#39;300100&#39;,&#39;<a href="http://mediafusion.es">mediafusion.es</a>&#39;,&#39;<a href="mailto:sip%3A300100@mediafusion.es">sip:300100@mediafusion.es</a>&#39;,&#39;<a href="mailto:sip%3A300900@mediafusion.es">sip:300900@mediafusion.es</a>&#39;,&#39;test message for offline user&#39;,&#39;text/plain;charset=UTF-8&#39;,1456758965,1456758365,0)</div><div>Feb 29 16:06:05 deservoz2 /opt/opensips-1.11.5/sbin/opensips[21623]: ERROR:db_unixodbc:db_unixodbc_extract_error: <b><i>unixodbc:SQLExecDirect=22018:1:257:[FreeTDS][SQL Server]Implicit conversion from data type varchar to varbinary is not allowed. Use the CONVERT function to run this query.</i></b></div><div>Feb 29 16:06:05 deservoz2 /opt/opensips-1.11.5/sbin/opensips[21623]: ERROR:core:db_do_insert: error while submitting query</div><div>Feb 29 16:06:05 deservoz2 /opt/opensips-1.11.5/sbin/opensips[21623]: ERROR:msilo:m_store: failed to store message</div></blockquote><div><br></div><div><br></div><div>Same error occurs when the query is executed using osql tool provided by FreeTDS. As error suggests, I&#39;ve tried to execute insert query using CONVERT function for a explicit varchar to varbinary conversion and it works:</div><div><br></div><blockquote style="margin:0 0 0 40px;border:none;padding:0px"><div>insert into silo (username,domain,dst_addr,src_addr,body,ctype,exp_time,inc_time,snd_time ) values (&#39;300100&#39;,&#39;<a href="http://mediafusion.es">mediafusion.es</a>&#39;,&#39;<a href="mailto:sip%3A300100@mediafusion.es">sip:300100@mediafusion.es</a>&#39;,&#39;<a href="mailto:sip%3A300900@mediafusion.es">sip:300900@mediafusion.es</a>&#39;, CONVERT(varbinary(500),&#39;test message for offline  user&#39;,&#39;text/plain;charset=UTF-8&#39;,1456758965,1456758365,0)</div></blockquote><div><br></div><div>Although data is correctly inserted using CONVERT function, when OpenSips retrieves it for message dumping, the body of the message is being sent as binary so it is not readable. For the body to be readable, a CONVERT function must be used for explicit conversion from varbinary to varchar in select statement.</div><div>Not sure whether this issue is on Opensips side or UnixODBC + FreeTDS. I can provide entire debug traces, network traces, OpenSips script, UnixODBC/FreeTDS configuration if it helps.</div><div><br></div><div>Using MySQL instead of MS SQL, both data storage and retrieval are working properly.</div><div>Is it an OpenSips limitation or a UnixODBC + FreeTDS misbehavior? Does anyone suffer this problem before?</div><div>Any help will be appreciated.</div><div><br></div><div>Thanks &amp; Regards,</div><div>Mila</div><div><br></div></div>