<span style='font-family:Verdana'><span style='font-size:12px'><div> 
        <span style="font-family:Verdana"><span style="font-size:12px">Roger, agradeço a resposta.<br /> 
        <br /> 
        Estou tentando fazer um teste simples com o AGI mas estou apanhando mesmo.<br /> 
        <br /> 
        Caso eu consiga fazer o AGI me retornar algo, depois com o php posso uzar ezsql e conectar em qualquer banco.<br /> 
        <br /> 
        Estou tentando:<br /> 
        <br /> 
        extensions.conf:</span></span><br /> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">exten =&gt; 134679,1,AGI(teste.php)</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">exten =&gt; 134679,n,Noop( ${retorno} )</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">exten =&gt; 134679,n,Hangup()</span></span></div> 
        <br /> 
        <span style="font-family:Verdana"><span style="font-size:12px">teste.php com chmod 755</span></span><br /> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">&lt;?</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">set_time_limit(30);</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">require('phpagi.php');</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">error_reporting(E_ALL);</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">$agi = new AGI();</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">$agi-&gt;set_variable("retorno","TESTE");</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">?&gt;<br /> 
                <br /> 
                Tenho o phpagi.php na mesma pasta (&nbsp;/var/lib/asterisk/agi-bin )</span></span></div> 
        <br /> 
        <span style="font-family:Verdana"><span style="font-size:12px">Saida CLI:</span></span><br /> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; &nbsp; -- Executing [134679@:1] AGI("SIP/300-00000a84", "teste.php") in new stack</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; &nbsp; -- Launched AGI Script /var/lib/asterisk/agi-bin/teste.php</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_request: teste.php</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_channel: SIP/300-00000a84</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_language: pt_BR</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_type: SIP</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_uniqueid: 1317755792.4063</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_callerid: 300</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_calleridname: Ramal 300</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_callingpres: 0</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_callingani2: 0</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_callington: 0</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_callingtns: 0</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_dnid: 134679</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_rdnis: unknown</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_context: contexto</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_extension: 134679</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_priority: 1</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_enhanced: 0.0</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt; agi_accountcode:</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">AGI Tx &gt;&gt;</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; &nbsp; -- AGI Script teste.php completed, returning 0</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; &nbsp; -- Executing [134679@:2] NoOp("SIP/300-00000a84", "") in new stack</span></span></div> 
        <div> 
                <span style="font-family:Verdana"><span style="font-size:12px">&nbsp; &nbsp; -- Executing [134679@:3] Hangup("SIP/300-00000a84", "") in new stack</span></span></div> 
        <br /> 
        <span style="font-family:Verdana"><span style="font-size:12px">Não alterei nada no phpagi.php, ou tem que alterar ?<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: Roger Pitigliani</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 02:17 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:eassis@linuxmail.org" >eassis@linuxmail.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] 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">Utilize AGI com PHP.. (php-mssql).<br /> 
                                <br /> 
                                <a href="http://wiki.locaweb.com.br/pt-br/Fun%C3%A7%C3%A3o_para_Conex%C3%A3o_ao_MS-SQL_via_Php" target="_blank">http://wiki.locaweb.com.br/pt-br/Fun%C3%A7%C3%A3o_para_Conex%C3%A3o_ao_MS-SQL_via_Php</a><br /> 
                                <br /> 
                                <br /> 
                                &nbsp;</span></span></p> 
                        <div class="gmail_quote"> 
                                <span style="font-family:Verdana"><span style="font-size:12px">Em 3 de outubro de 2011 22:18, <span>&lt;<a href="mailto:eassis@linuxmail.org" >eassis@linuxmail.org</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;"> 
                                        <p style="margin:0px; padding:0px; 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">&nbsp;</span></span></span></span></p> 
                                        <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px"><span><span style="font-family:Verdana;font-size:12px">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></span></span></span></span><br /> 
                                        <br /> 
                                        <div> 
                                                <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px"><span><span style="font-family:Verdana;font-size:12px">exten =&gt; s,1,MYSQL(Connect connid localhost user senha banco)</span></span> </span></span> </span></span></div> 
                                        <div> 
                                                <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px"><span><span style="font-family:Verdana;font-size:12px">exten =&gt; s,n,MYSQL(Query resultid ${connid} SELECT campo from tabela where campo = condicao);</span></span> </span></span> </span></span></div> 
                                        <div> 
                                                <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px"><span><span style="font-family:Verdana;font-size:12px">exten =&gt; s,n,Mysql(Fetch fetchid ${resultid} resultado)</span></span> </span></span> </span></span></div> 
                                        <div> 
                                                <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px"><span><span style="font-family:Verdana;font-size:12px">exten =&gt; s,n,MYSQL(Disconnect ${connid})</span></span> </span></span> </span></span></div> 
                                        <br /> 
                                        <span style="font-family:Verdana"><span style="font-size:12px"><span style="font-family:Verdana"><span style="font-size:12px"><span><span style="font-family:Verdana;font-size:12px">Com esse resultado consigo fazer o necessario, agora queria o mesmo só que em um BD SQL Server.<br /> 
                                        <br /> 
                                        Abraços.</span></span></span></span><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="#">(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="#">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> </span></span></blockquote> 
                        </div> 
                        <br /> 
                        <br clear="all" /> 
                        <br /> 
                        <span style="font-family:Verdana"><span style="font-size:12px">--<br /> 
                        Roger Pitigliani<br /> 
                        ibGRAVA - Soluções em Telefonia e Informática<br /> 
                        (51) 3216.0107 / 3216.0111<br /> 
                        <a href="http://www.ibgrava.com.br" target="_blank">www.ibgrava.com.br</a><br /> 
                        ---<br /> 
                        SKYPE: roger.pitigliani<br /> 
                        MSN: <a href="mailto:roger@ibgrava.com.br" target="">roger@ibgrava.com.br</a><br /> 
                        <br /> 
                        <br /> 
                        &nbsp;</span></span></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>