Com &quot;<span style="font-family:Verdana"><span style="font-size:12px">set_variable&quot; vc não vai &quot;pegar&quot; um resultado,  e sim definir... use: &quot;get_variable&quot;</span></span><br><br><div class="gmail_quote">
Em 4 de outubro de 2011 17:07, Eduardo Assis - Pro Redes <span dir="ltr">&lt;<a href="mailto:eassis@linuxmail.org">eassis@linuxmail.org</a>&gt;</span> escreveu:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div><div></div><div class="h5"><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"> </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" target="_blank">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"> </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" target="_blank">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"> </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 &quot;Content-type:text/html\n\n&quot;;</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">use DBI;</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">$username = &#39;&#39;;$password = &#39;&#39;;$database = &#39;&#39;;$hostname = &#39;&#39;;</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">$dbh = DBI-&gt;connect(&quot;dbi:mysql:database=$database;&quot; .</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px"> &quot;host=$hostname;port=3306&quot;, $username, $password);</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">$SQL= &quot;select * from user&quot;;</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">$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"> </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">  print &quot;$Row-&gt;{username}</span></span></div> 
                                                <div> 
                                                        <span style="font-family:Verdana"><span style="font-size:12px">$Row-&gt;{email}&quot;;</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="_blank">sylvio.sdr@gmail.com</a>&gt;</span> escreveu: </span></span> 
                                                        <div> 
                                                                <div> 
                                                                        <span style="font-family:Verdana"><span style="font-size:12px"> </span></span></div> 
                                                                <div> 
                                                                        <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="_blank">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"> </span></span></div> 
                                                                                                        <div> 
                                                                                                                <div> 
                                                                                                                        <div> 
                                                                                                                                <p class="MsoNormal"> 
                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font size="2" color="navy" face="Arial"><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 size="2" color="navy" face="Arial"><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 size="2" color="navy" face="Arial"><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 size="2" color="navy" face="Arial"><span style="font-size:10.0pt;font-family:Arial;color:navy"> </span></font></span></span></p> 
                                                                                                                                <div> 
                                                                                                                                        <div class="MsoNormal" style="text-align:center" align="center"> 
                                                                                                                                                <hr size="2" width="100%" align="center"> 
                                                                                                                                        </div> 
                                                                                                                                        <p class="MsoNormal"> 
                                                                                                                                                <span style="font-family:Verdana"><span style="font-size:12px"><b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma;font-weight:bold">De:</span></font></b><font size="2" face="Tahoma"><span style="font-size:10.0pt;font-family:Tahoma"> <a href="mailto:eassis@linuxmail.org" target="_blank">eassis@linuxmail.org</a> [mailto:<a href="mailto:eassis@linuxmail.org" target="_blank">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="_blank">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"> </span></span></div> 
                                                                                                                                        <div> 
                                                                                                                                                <p class="MsoNormal"> 
                                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font size="3" face="Times New Roman"><span style="font-size:12.0pt"> </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 size="1" face="Verdana"><span style="font-size:9.0pt;font-family:Verdana"> </span></font></span></span></p> 
                                                                                                                                                <p class="MsoNormal" style="margin-bottom:12.0pt"> 
                                                                                                                                                        <span style="font-family:Verdana"><span style="font-size:12px"><font size="1" face="Verdana"><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 size="1" face="Verdana"><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 size="1" face="Verdana"><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 size="1" face="Verdana"><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 size="1" face="Verdana"><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 size="1" face="Verdana"><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="#132d09e8943f5f5e_">(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,  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="#132d09e8943f5f5e_">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="_blank">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="#132d09e8943f5f5e_">(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,  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="#132d09e8943f5f5e_">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="_blank">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"> </span></span></div> 
                                                <span style="font-family:Verdana"><span style="font-size:12px"><font color="#888888">--<br> 
                                                Att., </font> </span></span> 
                                                <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"><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"> </span></span></div> 
                                <span style="font-family:Verdana"><span style="font-size:12px">--<br> 
                                Att.,  </span></span> 
                                <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">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"> </span></span></p> 
        <p style="margin:0px;padding:0px;margin:0px;padding:0px"> 
                <span style="font-family:Verdana"><span style="font-size:12px"> </span></span></p> 
        <br> 
        <br> 
        <span style="font-family:Verdana"><span style="font-size:12px"><span><span style="font-family:Verdana;font-size:12px"> </span></span></span></span></div> 
</span></span>
</div></div><br>_______________________________________________<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="tel:%2811%293016-5200" value="+551130165200">(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,  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="tel:0800-6021244" value="+558006021244">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">asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</a><br></blockquote></div>
<br><br clear="all"><br>-- <br>Att., <div><br></div><div>Leandro Alves<br></div><br>