<HTML xmlns="http://www.w3.org/TR/REC-html40" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:st1="urn:schemas-microsoft-com:office:smarttags" xmlns:w="urn:schemas-microsoft-com:office:word"><head><META content="text/html; charset=utf-8" http-equiv="Content-Type">

<meta content="text/html; charset=utf-8" http-equiv=Content-Type>
<meta content="Microsoft Word 11 (filtered medium)" name=Generator>
<o:SmartTagType name="country-region" namespaceuri="urn:schemas-microsoft-com:office:smarttags">
<o:SmartTagType name="place" namespaceuri="urn:schemas-microsoft-com:office:smarttags">
<!--[if !mso]>
<style>
st1\:*{behavior:url(#default#ieooui) }
</style>
<![endif]-->
<style>
<!--
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-compose;
        font-family:Arial;
        color:windowtext;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
-->
</style>

</head><BODY>
<DIV>

<div class=Section1>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>Hello,<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>I&#8217;m using the sqlops module for some custom queries
against mysql. Sometimes during a cluster failure the mysqld nodes will hang
there waiting for the backend to finish up whatever it&#8217;s doing, it still
accepts the connection and the query but doesn&#8217;t return results. I have a
pair of F5 load balancers in front of the two sql nodes, so there is redundancy
as long as the cluster is operational. I&#8217;d prefer to keep the cross-site
failover in kamailio. <o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>I looked through the docs on sqlops and I can&#8217;t find
any reference to a timeout value. I&#8217;d like to implement a failover in the
script to my other database cluster but if kam waits for a long time before
returning a negative it may not work very well. Consider this code in my script
for 911 services in my <st1:country><st1:place w:st="on">US</st1:place></st1:country>
offices: (I rewrite the rpid/pai and ruri based on IP address then send it to
my provider(s))<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>modparam(&quot;sqlops&quot;,&quot;sqlcon&quot;,&quot;gokam=&gt;mysql://*****:*****@172.20.180.21/sip_gokam&quot;)<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
(!sql_query(&quot;gokam&quot;, &quot;select
location,cidname,cidnum,ciddomain,e911number,inet_ntoa(network) as
network,inet_ntoa(netmask) \<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
as netmask from e911 where (inet_aton('$si') &amp; netmask) = network&quot;,
&quot;result&quot;)) {<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
sl_send_reply(&quot;500&quot;, &quot;Database error&quot;);<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
exit;<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>What I&#8217;d like to do is:<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>modparam(&quot;sqlops&quot;,&quot;sqlcon&quot;,&quot;gokam=&gt;mysql://****:****@172.20.180.21/sip_gokam&quot;)<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>modparam(&quot;sqlops&quot;,&quot;sqlcon&quot;,&quot;gokam_site2=&gt;mysql://*****:*****@172.23.180.21/sip_gokam&quot;)<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>if (!sql_query(&quot;gokam&quot;, &quot;select
location,cidname,cidnum,ciddomain,e911number,inet_ntoa(network) as
network,inet_ntoa(netmask) \<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
as netmask from e911 where (inet_aton('$si') &amp; netmask) = network&quot;,
&quot;result&quot;)) {<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
xlog(&#8220;L_CRIT&#8221;, &#8220;Primary database failure, using alternate\n&#8221;);<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; if
(!sql_query(&#8220;gokam_site2&#8221;, &#8220;select
location,cidname,cidnum,ciddomain,e911number,inet_ntoa(network) as
network,inet_ntoa(netmask) \<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
as netmask from e911 where (inet_aton('$si') &amp; netmask) = network&quot;,
&quot;result&quot;)) {<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; sl_send_reply(&#8220;500&#8221;,
Database error&#8221;);<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; exit;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>What is the default timeout for sql_query before it returns
a negative, is it configurable?<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>Thanks!<o:p></o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font face=Arial size=2><span style='font-size:10.0pt;
font-family:Arial'>Bob</span></font>&nbsp;<font face=Arial size=2><span style='font-size:10.0pt;font-family:Arial'><o:p></o:p></span></font></p>

<p class=MsoNormal><font face="Times New Roman" size=3><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

</div>

</DIV>
<DIV>
<HR>
</DIV>
<DIV STYLE="FONT-SIZE: 9pt; FONT-FAMILY: Courier New">This email with all information contained herein or attached hereto may contain confidential and/or privileged information intended for the addressee(s) only. If you have received this email in error, please contact the sender and immediately delete this email in its entirety and any attachments thereto.</DIV></BODY></HTML>