<span style='font-family:Verdana'><span style='font-size:12px'><div> 
        <span style="font-family:Verdana"><span style="font-size:12px">Leandro, agradeço sua resposta.<br /> 
        <br /> 
        Mas no caso de ser em perl, me complicaria pois depois não conseguiria dar continuidade, pois entendo e pouco de php mas conseguiria me virar.<br /> 
        <br /> 
        Estou procurando como fazer uma consulta e pegar a variavel pelo set_variable no qual ainda não consegui.<br /> 
        <br /> 
        Abraços.</span></span><br /> 
        <br /> 
        <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></p> 
        <blockquote style="border-left: 1px solid #CCC; padding-left: 5px; margin-left: 5px; margin-bottom: 0px; margin-top: 0px; margin-right: 0px;" type="cite"> 
                <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                        <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">----- Original Message -----</span></span></span></span></p> 
                <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                        <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">From: Leandro Alves</span></span></span></span></p> 
                <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                        <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">Sent: 10/04/11 04:37 PM</span></span></span></span></p> 
                <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                        <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">To: <a href="mailto:asteriskbrasil@listas.asteriskbrasil.org" >asteriskbrasil@listas.asteriskbrasil.org</a></span></span></span></span></p> 
                <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                        <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px">Subject: Re: [AsteriskBrasil] RES: AGI no extencions.conf consulta SQL Server</span></span></span></span></p> 
                <br /> 
                <div> 
                        <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                                <span style="font-family:Verdana"><span style="font-size:12px">Aqui tem exemplos de utilização no asterisk:</span></span></p> 
                        <div> 
                                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                        <div> 
                                <span style="font-family:Verdana"><span style="font-size:12px"><a href="http://www.asterikast.com/show_notes/sn_3.txt" target="_blank">http://www.asterikast.com/show_notes/sn_3.txt</a></span></span><br /> 
                                <br /> 
                                <div class="gmail_quote"> 
                                        <span style="font-family:Verdana"><span style="font-size:12px">Em 4 de outubro de 2011 16:35, Leandro Alves <span>&lt;<a href="mailto:thc.leandro@gmail.com" >thc.leandro@gmail.com</a>&gt;</span> escreveu:</span></span><br /> 
                                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;"> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">Exemplo de consulta AGI com Perl:</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">#!/usr/bin/perl</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">print "Content-type:text/html\n\n";</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">use DBI;</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">$username = '';$password = '';$database = '';$hostname = '';</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">$dbh = DBI-&gt;connect("dbi:mysql:database=$database;" .</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;"host=$hostname;port=3306", $username, $password);</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">$SQL= "select * from user";</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">$Select = $dbh-&gt;prepare($SQL);</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">$Select-&gt;execute();</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">while($Row=$Select-&gt;fetchrow_hashref)</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">{</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; print "$Row-&gt;{username}</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">$Row-&gt;{email}";</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">}</span></span></div> 
                                                <br /> 
                                                <div class="gmail_quote"> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">Em 4 de outubro de 2011 14:32, Sylvio Carlos Jollenbeck <span>&lt;<a href="mailto:sylvio.sdr@gmail.com" target="">sylvio.sdr@gmail.com</a>&gt;</span> escreveu: </span></span> 
                                                        <div> 
                                                                <div> 
                                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                                <div class="h5"> 
                                                                        <br /> 
                                                                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> 
                                                                                <span style="font-family:Verdana"><span style="font-size:12px">freetds<br /> 
                                                                                <br /> 
                                                                                <br clear="all" /> 
                                                                                # ---------------------------------------------------------------<br /> 
                                                                                <b>Sylvio Carlos Jollenbeck Borin</b><br /> 
                                                                                Gerente de Desenvolvimento<br /> 
                                                                                Akiva Software<br /> 
                                                                                <a href="http://www.akivasoftware.com.br" target="_blank">www.akivasoftware.com.br</a><br /> 
                                                                                # ----------------------------------------------------------------</span></span><br /> 
                                                                                <br /> 
                                                                                <br /> 
                                                                                <div class="gmail_quote"> 
                                                                                        <span style="font-family:Verdana"><span style="font-size:12px">Em 4 de outubro de 2011 13:45, Tetra Informatica <span>&lt;<a href="mailto:tetra@tetra.srv.br" target="">tetra@tetra.srv.br</a>&gt;</span> escreveu:</span></span><br /> 
                                                                                        <blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"> 
                                                                                                <div> 
                                                                                                        <div> 
                                                                                                                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                                                                        <div> 
                                                                                                                <div> 
                                                                                                                        <div> 
                                                                                                                                <p class="MsoNormal"> 
                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font color="navy" face="Arial" size="2"><span style="font-size:10.0pt;font-family:Arial;color:navy">Eu já usei bastante o AGI com acesso ao MySQL e Postgres e prefiro usar ODBC ao invés de código nativo.</span></font></span></span></p> 
                                                                                                                                <p class="MsoNormal"> 
                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font color="navy" face="Arial" size="2"><span style="font-size:10.0pt;font-family:Arial;color:navy">Quanto ao seu problema, acho que fica bem mais simples com o AGI. Só não sei se tem um driver ODBC do SQL Server que rode no Linux.</span></font></span></span></p> 
                                                                                                                                <p class="MsoNormal"> 
                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font color="navy" face="Arial" size="2"><span style="font-size:10.0pt;font-family:Arial;color:navy">abç</span></font></span></span></p> 
                                                                                                                                <p class="MsoNormal"> 
                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font color="navy" face="Arial" size="2"><span style="font-size:10.0pt;font-family:Arial;color:navy">&nbsp;</span></font></span></span></p> 
                                                                                                                                <div> 
                                                                                                                                        <div align="center" class="MsoNormal" style="text-align:center"> 
                                                                                                                                                <hr align="center" size="2" width="100%" /> 
                                                                                                                                        </div> 
                                                                                                                                        <p class="MsoNormal"> 
                                                                                                                                                <span style="font-family:Verdana"><span style="font-size:12px"><b><font face="Tahoma" size="2"><span style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">De:</span></font></b><font face="Tahoma" size="2"><span style="font-size:10.0pt;font-family:Tahoma"> <a href="mailto:eassis@linuxmail.org" target="">eassis@linuxmail.org</a> [mailto:<a href="mailto:eassis@linuxmail.org" target="">eassis@linuxmail.org</a>]<br /> 
                                                                                                                                                <b><span style="font-weight:bold">Enviada em:</span></b> segunda-feira, 3 de outubro de 2011 22:18<br /> 
                                                                                                                                                <b><span style="font-weight:bold">Para:</span></b> <a href="mailto:asteriskbrasil@listas.asteriskbrasil.org" target="">asteriskbrasil@listas.asteriskbrasil.org</a><br /> 
                                                                                                                                                <b><span style="font-weight:bold">Assunto:</span></b> [AsteriskBrasil] AGI no extencions.conf consulta SQL Server</span></font></span></span></p> 
                                                                                                                                </div> 
                                                                                                                                <div> 
                                                                                                                                        <div> 
                                                                                                                                                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                                                                                                        <div> 
                                                                                                                                                <p class="MsoNormal"> 
                                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font face="Times New Roman" size="3"><span style="font-size:12.0pt">&nbsp;</span></font></span></span></p> 
                                                                                                                                                <p style="margin:0px; padding:0px; margin:0px; padding:0px; margin:0cm;margin-bottom:.0001pt"> 
                                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font face="Verdana" size="1"><span style="font-size:9.0pt;font-family:Verdana">&nbsp;</span></font></span></span></p> 
                                                                                                                                                <p class="MsoNormal" style="margin-bottom:12.0pt"> 
                                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font face="Verdana" size="1"><span style="font-size:9.0pt;font-family:Verdana"><span>Alguem ja fez esse tipo de consulta ?<br /> 
                                                                                                                                                        <br /> 
                                                                                                                                                        Tenho uma necessidade em conectar um AGI pelo extensions.conf em um banco SQL Server, passando um valor e retornando outro valor.<br /> 
                                                                                                                                                        <br /> 
                                                                                                                                                        Alguem poderia me mostrar como proceder, pois o que acho no google não me atendeu.<br /> 
                                                                                                                                                        <br /> 
                                                                                                                                                        Pensei em usar o ODBC mas falaram que o AGI seria mais simples para essa minha necessidade.<br /> 
                                                                                                                                                        <br /> 
                                                                                                                                                        Atualmente tenho esse tipo de conexão com o Mysql usando:</span></span></font></span></span></p> 
                                                                                                                                                <div> 
                                                                                                                                                        <p class="MsoNormal"> 
                                                                                                                                                                <span style="font-family:Verdana"><span style="font-size:12px"><span><font face="Verdana" size="1"><span style="font-size:9.0pt;font-family:Verdana">exten =&gt; s,1,MYSQL(Connect connid localhost user senha banco)</span></font></span></span></span></p> 
                                                                                                                                                </div> 
                                                                                                                                                <div> 
                                                                                                                                                        <p class="MsoNormal"> 
                                                                                                                                                                <span style="font-family:Verdana"><span style="font-size:12px"><span><font face="Verdana" size="1"><span style="font-size:9.0pt;font-family:Verdana">exten =&gt; s,n,MYSQL(Query resultid ${connid} SELECT campo from tabela where campo = condicao);</span></font></span></span></span></p> 
                                                                                                                                                </div> 
                                                                                                                                                <div> 
                                                                                                                                                        <p class="MsoNormal"> 
                                                                                                                                                                <span style="font-family:Verdana"><span style="font-size:12px"><span><font face="Verdana" size="1"><span style="font-size:9.0pt;font-family:Verdana">exten =&gt; s,n,Mysql(Fetch fetchid ${resultid} resultado)</span></font></span></span></span></p> 
                                                                                                                                                </div> 
                                                                                                                                                <div> 
                                                                                                                                                        <p class="MsoNormal"> 
                                                                                                                                                                <span style="font-family:Verdana"><span style="font-size:12px"><span><font face="Verdana" size="1"><span style="font-size:9.0pt;font-family:Verdana">exten =&gt; s,n,MYSQL(Disconnect ${connid})</span></font></span></span></span></p> 
                                                                                                                                                </div> 
                                                                                                                                                <p class="MsoNormal"> 
                                                                                                                                                        <br /> 
                                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font face="Verdana" size="1"><span style="font-size:9.0pt;font-family:Verdana"><span>Com esse resultado consigo fazer o necessario, agora queria o mesmo só que em um BD SQL Server.<br /> 
                                                                                                                                                        <br /> 
                                                                                                                                                        Abraços.</span></span></font></span></span></p> 
                                                                                                                                        </div> 
                                                                                                                                </div> 
                                                                                                                        </div> 
                                                                                                                </div> 
                                                                                                        </div> 
                                                                                                </div> 
                                                                                                <span style="font-family:Verdana"><span style="font-size:12px">_______________________________________________<br /> 
                                                                                                KHOMP: qualidade em placas de E1, GSM, FXS e FXO para Asterisk.<br /> 
                                                                                                - Hardware com alta disponibilidade de recursos e qualidade KHOMP<br /> 
                                                                                                - Suporte técnico local qualificado e gratuito<br /> 
                                                                                                Conheça a linha completa de produtos KHOMP em <a href="http://www.khomp.com.br" target="_blank">www.khomp.com.br</a><br /> 
                                                                                                _______________________________________________<br /> 
                                                                                                DIGIVOICE: Lider no mercado de placas para Asterisk<br /> 
                                                                                                Único fabricante com Centro de Treinamento especializado.<br /> 
                                                                                                LANÇAMENTO: Channel Bank TDMoE, até 64 canais FXS / FXO.<br /> 
                                                                                                <a href="http://www.digivoice.com.br" target="_blank">www.digivoice.com.br</a> ou <a href="#" target="">(11)3016-5200</a>.<br /> 
                                                                                                ________<br /> 
                                                                                                GATEWAY GSM-SIP, gateway Lyric VoIP com 2,4 e 6 canais GSM vía tronco SIP<br /> 
                                                                                                Escalável até 240 canáis, Portabilidade Numérica, &nbsp;Balanceamento de Carga, Bilhetagem<br /> 
                                                                                                Confira em <a href="http://www.yx.cl/landing/brasil/lyric_voip_asterisk.org" target="_blank">http://www.yx.cl/landing/brasil/lyric_voip_asterisk.org</a><br /> 
                                                                                                Shop Voip, representante exclusivo: <a href="http://www.shopvoip.com.br" target="_blank">www.shopvoip.com.br</a> ou <a href="#" target="">0800-6021244</a><br /> 
                                                                                                ______________________________________________<br /> 
                                                                                                Para remover seu email desta lista, basta enviar um email em branco para <a href="mailto:asteriskbrasil-unsubscribe@listas.asteriskbrasil.org" target="">asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</a> </span></span></blockquote> 
                                                                                </div> 
                                                                                <br /> 
                                                                                <br /> 
                                                                                <span style="font-family:Verdana"><span style="font-size:12px">_______________________________________________<br /> 
                                                                                KHOMP: qualidade em placas de E1, GSM, FXS e FXO para Asterisk.<br /> 
                                                                                - Hardware com alta disponibilidade de recursos e qualidade KHOMP<br /> 
                                                                                - Suporte técnico local qualificado e gratuito<br /> 
                                                                                Conheça a linha completa de produtos KHOMP em <a href="http://www.khomp.com.br" target="_blank">www.khomp.com.br</a><br /> 
                                                                                _______________________________________________<br /> 
                                                                                DIGIVOICE: Lider no mercado de placas para Asterisk<br /> 
                                                                                Único fabricante com Centro de Treinamento especializado.<br /> 
                                                                                LANÇAMENTO: Channel Bank TDMoE, até 64 canais FXS / FXO.<br /> 
                                                                                <a href="http://www.digivoice.com.br" target="_blank">www.digivoice.com.br</a> ou <a href="#" target="">(11)3016-5200</a>.<br /> 
                                                                                ________<br /> 
                                                                                GATEWAY GSM-SIP, gateway Lyric VoIP com 2,4 e 6 canais GSM vía tronco SIP<br /> 
                                                                                Escalável até 240 canáis, Portabilidade Numérica, &nbsp;Balanceamento de Carga, Bilhetagem<br /> 
                                                                                Confira em <a href="http://www.yx.cl/landing/brasil/lyric_voip_asterisk.org" target="_blank">http://www.yx.cl/landing/brasil/lyric_voip_asterisk.org</a><br /> 
                                                                                Shop Voip, representante exclusivo: <a href="http://www.shopvoip.com.br" target="_blank">www.shopvoip.com.br</a> ou <a href="#" target="">0800-6021244</a><br /> 
                                                                                ______________________________________________<br /> 
                                                                                Para remover seu email desta lista, basta enviar um email em branco para <a href="mailto:asteriskbrasil-unsubscribe@listas.asteriskbrasil.org" target="">asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</a> </span></span></blockquote> 
                                                                </div> 
                                                        </div> 
                                                </div> 
                                                <br /> 
                                                <br clear="all" /> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                <span style="font-family:Verdana"><span style="font-size:12px"><font color="#888888">--<br /> 
                                                Att.,&nbsp;</font> </span></span> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font color="#888888">Leandro Alves</font><br /> 
                                                        </span></span></div> 
                                        </blockquote> 
                                </div> 
                                <br /> 
                                <br clear="all" /> 
                                <div> 
                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                <span style="font-family:Verdana"><span style="font-size:12px">--<br /> 
                                Att.,&nbsp; </span></span> 
                                <div> 
                                        <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></div> 
                                <div> 
                                        <span style="font-family:Verdana"><span style="font-size:12px">Leandro Alves</span></span></div> 
                        </div> 
                </div> 
        </blockquote> 
        <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></p> 
        <p style="margin:0px; padding:0px; margin:0px; padding:0px;"> 
                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp;</span></span></p> 
        <br /> 
        <br /> 
        <span style="font-family:Verdana"><span style="font-size:12px"><span id="editor_signature"><span style="font-family:Verdana; font-size:12px">&nbsp;</span></span></span></span></div> 
</span></span>