<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
</head>
<body bgcolor="#ffffff" text="#000000">
Hello there!<br>
<br>
In order to create a new realtime driver, I thought it would be
important to analyse its behavior using an existent driver.<br>
So, I configured an Asterisk instance to get SIP peers/users, voicemail
boxes and extensions from a mysql database (no "global"/"general"
configuration of any king by now), and put a monitor to map the queries
executed on normal operation.<br>
<br>
SIP peer/users and voicemail boxes operation was clear as water to me
(the database queries are quite straighforward), but some queries
regarding dialplan extensions are getting me lost.<br>
<br>
1- Same query is performed more than once:<br>
<br>
For example: the query below regarding the priority "3" from extension
"102" of context "sip" gets performed 3 times... and the same happens
with prior steps(priorities).<br>
<br>
<tt>SELECT * FROM extensions WHERE exten = '102' AND context = 'sip'
AND priority = '3'<br>
</tt><br>
2- After getting the final step to voicemail, some weird extension
queries are performed like shown below:<br>
<br>
<tt>SELECT * FROM extensions WHERE exten = 'a' AND context = 'sip' AND
priority = '1'<br>
SELECT * FROM extensions WHERE exten LIKE '\\_%' AND context = 'sip'
AND priority = '1' ORDER BY exten<br>
SELECT * FROM extensions WHERE exten = 'h' AND context = 'sip' AND
priority = '1'<br>
SELECT * FROM extensions WHERE exten LIKE '\\_%' AND context = 'sip'
AND priority = '1' ORDER BY exten<br>
</tt><br>
Right after these 4 unexpected queries (at least, unexpected for me
:-)), the final steps of storing the CDR (on mysql too) and update of
SIP peer/user are performed normally.<br>
<br>
I have another situation here where the query for priority "1",
extension "102" and context "sip" was performed 4 times. Right after a
new query on which the priority was "-1" was perfomed and this priority
was used on second query of (4 strange queries above), followed by the
final 2 strange queries above (the query with "<tt>exten = 'a'</tt>"
was not performed on this case.<br>
<br>
I have the same configuration present below to all five extensions
(101, 102, 103, 104 and 105) on this "sip" context stored on mysql
database:<br>
<br>
<table x:str="" style="border-collapse: collapse; width: 48pt;"
 border="0" cellpadding="0" cellspacing="0" width="64">
  <col style="width: 48pt;" width="64"> <tbody>
    <tr style="height: 12.75pt;" height="17">
      <td style="height: 12.75pt; width: 48pt;" height="17" width="64">7,"sip","102",1,"Dial","SIP/${EXTEN}|20|RtT"</td>
    </tr>
    <tr style="height: 12.75pt;" height="17">
      <td style="height: 12.75pt;" height="17">8,"sip","102",2,"GotoIf","$[${DIALSTATUS}
= BUSY]?5"</td>
    </tr>
    <tr style="height: 12.75pt;" height="17">
      <td style="height: 12.75pt;" height="17">9,"sip","102",3,"VoiceMail","${EXTEN}@${VOICEMAILSRV}|u"</td>
    </tr>
    <tr style="height: 12.75pt;" height="17">
      <td style="height: 12.75pt;" height="17">10,"sip","102",4,"Hangup",""</td>
    </tr>
    <tr style="height: 12.75pt;" height="17">
      <td style="height: 12.75pt;" height="17">11,"sip","102",5,"VoiceMail","${EXTEN}@${VOICEMAILSRV}|b"</td>
    </tr>
    <tr style="height: 12.75pt;" height="17">
      <td style="height: 12.75pt;" height="17">12,"sip","102",6,"Hangup",""</td>
    </tr>
  </tbody>
</table>
<br>
Am I missing something here?<br>
<br>
Thanks and best regards,<br>
<br>
<div class="moz-signature">-- <br>
<meta http-equiv="Content-Language" content="pt-br">
<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
<meta name="ProgId" content="FrontPage.Editor.Document">
<meta http-equiv="Content-Type" content="text/html; ">
<title>TQI - Technology and Quality on Information</title>
<table style="border-width: 0pt; border-collapse: collapse;"
 id="AutoNumber1" border="1" bordercolor="#111111" cellpadding="0"
 cellspacing="0" height="151" width="46%">
  <tbody>
    <tr>
      <td style="border-style: none; border-width: medium;" height="17"
 width="96%"> <sub><u>At.,&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;&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;&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;&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; </u></sub></td>
    </tr>
    <tr>
      <td style="border-style: none; border-width: medium;" height="32"
 width="16%"> <img src="cid:part1.04070101.09060907@tqi.com.br"
 border="0" height="23" width="150">&nbsp; </td>
    </tr>
    <tr>
      <td style="border-style: none; border-width: medium;" height="12"
 width="100%"><b><font face="Verdana" size="1">Technology and Quality
on Information</font></b></td>
    </tr>
    <tr>
      <td style="border-style: none; border-width: medium;" height="13"
 width="100%"><font face="Verdana" size="1">Mauro S&eacute;rgio Ferreira Brasil</font></td>
    </tr>
    <tr>
      <td style="border-style: none; border-width: medium;" height="14"
 width="100%"> <font face="Verdana" size="1">Coordenador de Projetos e
Analista de Sistemas</font></td>
    </tr>
    <tr>
      <td style="border-style: none; border-width: medium;" height="14"
 width="100%"><font color="#0000ff" face="Wingdings" size="2">+</font><font
 face="Courier New" size="2"> </font> <font style="font-size: 9pt;"
 face="Courier New"> <a href="mailto:@tqi.com.br">mauro.brasil@tqi.com.br</a></font></td>
    </tr>
    <tr>
      <td style="border-style: none; border-width: medium;" height="14"
 width="100%"><font color="#0000ff" face="Wingdings" size="2">:</font><font
 face="Courier New" size="2"> </font>
      <font style="font-size: 9pt;" face="Courier New"> <a
 href="http://www.tqi.com.br">www.tqi.com.br</a></font></td>
    </tr>
    <tr>
      <td style="border-style: none; border-width: medium;" height="14"
 width="100%"><font color="#0000ff"><font face="Wingdings" size="2">(</font><font
 face="Courier New" size="2"> + 55 </font>
      <font style="font-size: 9pt;" face="Courier New">(34)3291-1700</font></font></td>
    </tr>
    <tr>
      <td style="border-style: none; border-width: medium;" height="14"
 width="100%"><font color="#0000ff"><font face="Wingdings" size="2">(</font><font
 face="Courier New" size="2"> + 55 </font>
      <font style="font-size: 9pt;" face="Courier New">(34)9971-2572</font></font></td>
    </tr>
  </tbody>
</table>
</div>
</body>
</html>