<html>
<head>
<style><!--
.hmmessage P
{
margin:0px;
padding:0px
}
body.hmmessage
{
font-size: 12pt;
font-family:Calibri
}
--></style></head>
<body class='hmmessage'><div dir='ltr'><font face="Arial" size="3" style="font-size:12pt;">Acionar um DB, não seria mais facil ?<br id="FontBreak"></font><br><br><pre style="line-height:17px;white-space:normal;color:rgb(42, 42, 42);background-color:rgb(255, 255, 255)">Hudson&nbsp;<br>(048) 8413-7000<br>Para quem nao cre, nenhuma prova converte,Para aquele que cre, nenhuma prova precisa.&nbsp;</pre><br><br><div><hr id="stopSpelling">Date: Thu, 5 Dec 2013 16:17:47 -0200<br>From: jefaokpta@hotmail.com<br>To: asteriskbrasil@listas.asteriskbrasil.org<br>Subject: Re: [AsteriskBrasil] Transferir a variável de um context para outro context<br><br>
  
    
  
  
    <div class="ecxmoz-cite-prefix">Em algum momento vc vai apagar essa
      variavel global?<br>
      Ou vai ficar alterando ela?<br>
      <br>
      <br>
      Flws<br>
      <br>
      Em 05-12-2013 16:03, Renata Dias escreveu:<br>
    </div>
    <blockquote cite="mid:CACM-paBZgRJXzcKrsaeHRSA1aJBQGEELdduu8u8N++QOzaUnTQ@mail.gmail.com">
      <div dir="ltr">
        <div>Carlos, tentei fazer via Macro, mas depois de muito
          pesquisar, entendi que a macro serve para que eu leve uma
          variável do contexto para dentro da macro e faça uso dela na
          macro. Não era bem isso que eu precisava.</div>
        <div>De qualquer forma, escontrei a solução no site&nbsp;<a href="http://the-asterisk-book.com/1.6/variablen.html" target="_blank">http://the-asterisk-book.com/1.6/variablen.html</a></div>
        <div><br>
        </div>
        <div><span style="color:inherit;font-family:inherit;font-size:24px;line-height:40px;">Defining
            variables with Set()</span><br>
        </div>
        <div>
          <div style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;">
            <code style="padding:2px 4px;font-family:Monaco,Menlo,Consolas,'Courier New',monospace;font-size:12px;color:rgb(221,17,68);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(247,247,249);border:1px solid rgb(225,225,232);"><code style="padding:2px 4px;font-family:Monaco,Menlo,Consolas,'Courier New',monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:1px solid rgb(225,225,232);">Set()</code>&nbsp;</code>is used to
            define a variable inside an extension.<span style="font-size:11px;line-height:0;vertical-align:baseline;">[<a id="ecxidp59570112" href="http://the-asterisk-book.com/1.6/variablen.html#ftn.idp59570112" style="color:rgb(0,136,204);text-decoration:none;" target="_blank">11</a>]</span></div>
          <div title="Syntax" id="ecxset-syntax">
            <div style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;">
              <h4 id="ecxset-syntax" style="font-family:inherit;color:inherit;font-size:18px;">
                Syntax</h4>
            </div>
            <div style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;"><code style="padding:2px 4px;font-family:Monaco,Menlo,Consolas,'Courier New',monospace;font-size:12px;color:rgb(221,17,68);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(247,247,249);border:1px solid rgb(225,225,232);">Set(&lt;variable1&gt;=&lt;value1&gt;[,&lt;variable2&gt;=&lt;value2&gt;][,&lt;option&gt;])</code></div>
            <div style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;">Setting
              option&nbsp;<em><code style="padding:2px 4px;font-family:Monaco,Menlo,Consolas,'Courier New',monospace;font-size:12px;color:rgb(221,17,68);border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;background-color:rgb(247,247,249);border:1px solid rgb(225,225,232);"><code style="padding:2px 4px;font-family:Monaco,Menlo,Consolas,'Courier New',monospace;border-top-left-radius:3px;border-top-right-radius:3px;border-bottom-right-radius:3px;border-bottom-left-radius:3px;border:1px solid rgb(225,225,232);">g</code>&nbsp;</code></em>makes
              the variable global; without it, the variable is treated
              as a local channel variable.</div>
            <div style="color:rgb(51,51,51);font-family:'Helvetica Neue',Helvetica,Arial,sans-serif;font-size:14px;line-height:20px;"><br>
            </div>
            <div title="Syntax" id="ecxset-syntax"><br>
            </div>
            Só o que fiz foi definir a variável em um contexto com essa
            opção "g" e depois pude usá-la normalmente no resto do
            DialPlan, mesmo após o hungup.<br>
            <br>
            Obrigada.</div>
        </div>
      </div>
      <div class="ecxgmail_extra"><br>
        <br>
        <div class="ecxgmail_quote">Em 4 de dezembro de 2013 13:26, Carlos
          Toguchi <span dir="ltr">&lt;<a href="mailto:carlos.toguchi@gmail.com" target="_blank">carlos.toguchi@gmail.com</a>&gt;</span>
          escreveu:<br>
          <blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
            <div dir="ltr">Renata,
              <div>Pelo qeu eu li neste link&nbsp;<a href="https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Application_Queue" target="_blank">https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Application_Queue</a></div>
              <div>Você pode chamar a Queue passando como argumento uma
                marco ou um agi que será executado depois que estive
                conectado aum membro da queue, logo voce tem neste
                momento o numero do ramal, use esta marco para armazenar
                o numero do ramal e do chamador.</div>
              <div>Quando retornar da pesquisa com a nota, recupere o
                ramal armazenado pela macro.</div>
              <div><br>
              </div>
              <div>Saudações</div>
              <span class="ecxHOEnZb"><font color="#888888">
                  <div>Carlos</div>
                </font></span></div>
            <div class="ecxHOEnZb">
              <div class="h5">
                <div class="ecxgmail_extra"><br>
                  <br>
                  <div class="ecxgmail_quote">
                    2013/12/4 Renata Dias <span dir="ltr">&lt;<a href="mailto:renatchinha@gmail.com" target="_blank">renatchinha@gmail.com</a>&gt;</span><br>
                    <blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
                      <div dir="ltr"><br>
                        <div>No meu caso não consegui, pois envio a
                          chamada para a fila (queue) através do Dial
                          com a opção "g".</div>
                        <div>Sendo assim, quando o atendente desliga a
                          ligação, a fila (queue) devolve para o Dial e
                          o sistema continua lendo as prioridades
                          abaixo.</div>
                        <div>Ocorre que por este motivo, não consigo
                          pegar o ramal do atendente e armazenar em
                          alguma variável.</div>
                        <div><br>
                        </div>
                        <div>Fiz um teste conforme DialPlan abaixo e
                          percebi que na linha 10 o Dial (com a opção
                          "g") envia a chamada para o context [pesquisa]
                          na prioridade 1, e entra na fila.</div>
                        <div>Após o atendimento, quando o atendente
                          desliga a ligação, a perna do cliente é
                          encaminhada de volta para o context
                          [principal] dando continuidade na prioridade
                          abaixo do Dial.</div>
                        <div>Dessa forma, as linhas 3 e 4 não foram
                          lidas. Consequentemente a linha 11 não exibiu
                          o conteúdo da variável X de teste.&nbsp;</div>
                        <div><br>
                        </div>
                        <div>
                          <div style="font-size:13px;font-family:arial,sans-serif;">
                            <div>1 [pesquisa]</div>
                            <div>2 exten =&gt; 2,1,queue(suporte,tT)</div>
                            <div>3 exten =&gt; 2,2,NoOp(${CALLERID(num)}
                              - ${EXTEN} - ${X})</div>
                            <div>
                              <div>4 exten =&gt; 2,2,Set(X=111)</div>
                            </div>
                            <div>5</div>
                          </div>
                          <div style="font-size:13px;font-family:arial,sans-serif;">6
                            [principal]<br>
                          </div>
                          <div style="font-size:13px;font-family:arial,sans-serif;">
                            <div><font color="#000000" face="arial,                                  sans-serif">7 exten =&gt;
                                00,n,background(provale/8_SUPORTE_TECNICO)</font></div>
                            <div>8&nbsp;<br>
                            </div>
                          </div>
                          <div style="font-size:13px;font-family:arial,sans-serif;">
                            <div>
                              9 exten =&gt; 8,1,Answer()</div>
                            <div><font color="#000000" face="arial,                                  sans-serif">10 exten =&gt;
                                8,n,Dial(Local/2@pesquisa,</font>,gtT)<br>
                            </div>
                            <div>11 exten =&gt; 8,n,NoOp(${X})</div>
                            <div>12 exten =&gt; 8,n,hangup()<br>
                            </div>
                          </div>
                        </div>
                        <div><br>
                        </div>
                        <div><br>
                        </div>
                        <div>Alguma idéia?</div>
                      </div>
                      <div class="ecxgmail_extra"><br>
                        <br>
                        <div class="ecxgmail_quote">Em 3 de dezembro de
                          2013 13:10, Mike Tesliuk <span dir="ltr">&lt;<a href="mailto:mike@tesliuk.com" target="_blank">mike@tesliuk.com</a>&gt;</span>
                          escreveu:<br>
                          <blockquote class="ecxgmail_quote" style="border-left:1px #ccc solid;padding-left:1ex;">
                            <div>
                              <div><br>
                                voce pode executar uma macro no momento
                                que o agente atende a ligação, e então
                                la definir os valores que você precisa.<br>
                                <br>
                                exemplo:<br>
                                <br>
                                exten =&gt; 2,1,NoOp(Opcao escolhida 2 -
                                fila 4001)<br>
                                exten =&gt; 2,n,Set(QNAME="4001")<br>
                                exten =&gt;
                                2,n,Queue(4001,tik,,,300,,records-queues-4001)<br>
                                exten =&gt; 2,n,Goto(s,1)<br>
                                <br>
                                <br>
                                [macro-records-queues-4001]<br>
                                exten =&gt;
                                s,1,Agi(gravacoes-queues.agi,${CALLERID(num)},4001)<br>
                                exten =&gt; s,n,GotoIf($["${DORECORD}"
                                == "0"]?ngrava)<br>
                                exten =&gt;
                                s,n(grava),MixMonitor(${MIXMONITOR_FILENAME})<br>
                                exten =&gt; s,n(ngrava),NoOp(Gravacoes
                                nao executadas)<br>
                                <br>
                                No meu caso, a macro chama um AGI<br>
                                <br>
                                Dentro deste eu pego as variaveis<br>
                                <br>
                                $AGI-&gt;exec("NoOp", "QNAME: $queue");<br>
                                $AGI-&gt;exec("NoOp", "CALLERID:
                                $callerid");<br>
                                $AGI-&gt;exec("NoOp", "EXTEN:
                                $destination");<br>
                                <br>
                                E seto a variavel para o nome do
                                arquivo.<br>
                                <br>
                                &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
                                $AGI-&gt;set_variable("MIXMONITOR_FILENAME","/var/spool/asterisk/monitor-tmp/$year/$mon/$mday/QUEUE-$queue-ATENDIDO-$callerid"

                                . "-" . "$hour$min$sec" . ".gsm");<br>
                                <br>
                                Que no caso gera o seguinte nome de
                                arquivo.<br>
                                <br>
                                QUEUE-4001-ATENDIDO-136-124936.gsm<br>
                                <br>
                                onde 136 é o meu ramal da fila<br>
                                <br>
                                ou seja, dentro da macro o callerid é
                                quem recebeu a chamada<br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                <br>
                                Em 03/12/13 09:29, Renata Dias escreveu:<br>
                              </div>
                              <blockquote>
                                <div>
                                  <div>
                                    <div dir="ltr">
                                      <div><br>
                                      </div>
                                      Caros,
                                      <div><br>
                                      </div>
                                      <div>Gostaria de saber se é
                                        possível uma ou mais variáveis
                                        de um context para outro
                                        context.</div>
                                      <div><br>
                                      </div>
                                      <div>Para explicar melhor a minha
                                        necessidade, vou colocar como
                                        está a minha URA:</div>
                                      <div><br>
                                      </div>
                                      <div>
                                        <div style="font-size:13px;font-family:arial,sans-serif;">
                                          <div>1 [pesquisa]</div>
                                          <div>2 exten =&gt;
                                            8,1,queue(suporte,tT)</div>
                                        </div>
                                        <div style="font-size:13px;font-family:arial,sans-serif;">
                                          3&nbsp;</div>
                                        <div style="font-size:13px;font-family:arial,sans-serif;">4
                                          [principal]</div>
                                        <div>
                                          <div><font color="#000000" face="arial, sans-serif">5
                                              exten =&gt;
                                              00,n,background(provale/8_SUPORTE_TECNICO)</font></div>
                                          <div><span style="font-size:13px;font-family:arial,sans-serif;">6&nbsp;</span><br>
                                          </div>
                                        </div>
                                        <div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">7
                                            exten =&gt; 8,1,Answer()</div>
                                          <div> <font color="#000000" face="arial, sans-serif">8
                                              exten =&gt;
                                              8,n,Dial(Local/8@pesquisa,</font>5,gtT)<br>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">9
                                            exten =&gt;
8,n,Playback(provale/pesquisa/RESPONDA&amp;silence/1&amp;provale/pesquisa/ATENDIDA&amp;silence/1)<br>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">
                                            <div>10 exten =&gt;
                                              8,n,Read(ATENDIDA,,1)</div>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">
                                            <div>11exten =&gt;
                                              8,n,Playback(provale/pesquisa/NOTA&amp;silence/1)</div>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">
                                            <div>12 exten =&gt;
                                              8,n,Read(NOTA,,1)</div>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">
                                            <div>13 exten =&gt;
                                              8,n,playback(provale/pesquisa/OBRIGADA&amp;provale/pesquisa/AGRADECEMOS)</div>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">
                                            <div>14 exten =&gt;
                                              8,n,Set(ODBC_consulta()=${CALLERID(num)}\,<span style="background-color:rgb(255,255,0);">${EXTEN}</span>\,${ATENDIDA}\,${NOTA})</div>
                                            <div>15 exten =&gt;
                                              8,n,hangup()</div>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;"><br>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">O
                                            que preciso é que o ramal do
                                            atendente seja gravado no
                                            banco de dados, conforme a
                                            linha 14.</div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">Estou

                                            utilizando o ${EXTEN}, porém
                                            o conteúdo dessa variável é
                                            o número que o cliente
                                            digitou quando escolheu a
                                            opção de atendimento na URA,
                                            conforme linha 5.</div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;"><br>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">Qual

                                            a variável que vai me trazer
                                            o ramal do atendente que fez
                                            o atendimento na fila
                                            (queue) suporte?</div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">Como

                                            faço pra transferir esta
                                            variavem do context
                                            "pesquisa" para o conext
                                            "provale" ?</div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">
                                            <br>
                                          </div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;">Obrigada.</div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;"><span style="font-family:arial;font-size:small;color:rgb(34,34,34);"><br>
                                            </span></div>
                                          <div style="font-size:13px;font-family:arial,sans-serif;"><span style="font-family:arial;font-size:small;color:rgb(34,34,34);">--&nbsp;</span><br>
                                          </div>
                                        </div>
                                      </div>
                                      <div>
                                        <div>Renata Dias<br>
                                        </div>
                                      </div>
                                    </div>
                                    <br>
                                    <fieldset></fieldset>
                                    <br>
                                  </div>
                                </div>
                                <pre>_______________________________________________
KHOMP: completa linha de placas externas FXO, FXS, GSM e E1;
Media Gateways de 1 a 64 E1s para SIP com R2, ISDN e SS7;
Intercomunicadores para acesso remoto via rede IP. Conheça em <a href="http://www.Khomp.com" target="_blank">www.Khomp.com</a>.
_______________________________________________
ALIGERA – Fabricante nacional de Gateways SIP-E1 para R2, ISDN e SS7.
Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI Express.
Channel Bank – Appliance Asterisk - Acesse <a href="http://www.aligera.com.br" target="_blank">www.aligera.com.br</a>.
_______________________________________________
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></pre>
                              </blockquote>
                              <br>
                            </div>
                            <br>
_______________________________________________<br>
                            KHOMP: completa linha de placas externas
                            FXO, FXS, GSM e E1;<br>
                            Media Gateways de 1 a 64 E1s para SIP com
                            R2, ISDN e SS7;<br>
                            Intercomunicadores para acesso remoto via
                            rede IP. Conheça em <a href="http://www.Khomp.com" target="_blank">www.Khomp.com</a>.<br>
_______________________________________________<br>
                            ALIGERA – Fabricante nacional de Gateways
                            SIP-E1 para R2, ISDN e SS7.<br>
                            Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou
                            PCI Express.<br>
                            Channel Bank – Appliance Asterisk - Acesse <a href="http://www.aligera.com.br" target="_blank">www.aligera.com.br</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><font color="#888888"><br>
                              </font></span></blockquote>
                        </div>
                        <span><font color="#888888">
                            <br>
                            <br clear="all">
                            <div><br>
                            </div>
                            -- <br>
                            <div>Renata Dias<br>
                            </div>
                          </font></span></div>
                      <br>
                      _______________________________________________<br>
                      KHOMP: completa linha de placas externas FXO, FXS,
                      GSM e E1;<br>
                      Media Gateways de 1 a 64 E1s para SIP com R2, ISDN
                      e SS7;<br>
                      Intercomunicadores para acesso remoto via rede IP.
                      Conheça em <a href="http://www.Khomp.com" target="_blank">www.Khomp.com</a>.<br>
                      _______________________________________________<br>
                      ALIGERA – Fabricante nacional de Gateways SIP-E1
                      para R2, ISDN e SS7.<br>
                      Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI
                      Express.<br>
                      Channel Bank – Appliance Asterisk - Acesse <a href="http://www.aligera.com.br" target="_blank">www.aligera.com.br</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><br>
                    </blockquote>
                  </div>
                  <br>
                </div>
              </div>
            </div>
            <br>
            _______________________________________________<br>
            KHOMP: completa linha de placas externas FXO, FXS, GSM e E1;<br>
            Media Gateways de 1 a 64 E1s para SIP com R2, ISDN e SS7;<br>
            Intercomunicadores para acesso remoto via rede IP. Conheça
            em <a href="http://www.Khomp.com" target="_blank">www.Khomp.com</a>.<br>
            _______________________________________________<br>
            ALIGERA – Fabricante nacional de Gateways SIP-E1 para R2,
            ISDN e SS7.<br>
            Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI Express.<br>
            Channel Bank – Appliance Asterisk - Acesse <a href="http://www.aligera.com.br" target="_blank">www.aligera.com.br</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">
        <div><br>
        </div>
        -- <br>
        <div>Renata Dias<br>
        </div>
      </div>
      <br>
      <fieldset class="ecxmimeAttachmentHeader"></fieldset>
      <br>
      <pre>_______________________________________________
KHOMP: completa linha de placas externas FXO, FXS, GSM e E1;
Media Gateways de 1 a 64 E1s para SIP com R2, ISDN e SS7;
Intercomunicadores para acesso remoto via rede IP. Conheça em <a class="ecxmoz-txt-link-abbreviated" href="http://www.Khomp.com" target="_blank">www.Khomp.com</a>.
_______________________________________________
ALIGERA – Fabricante nacional de Gateways SIP-E1 para R2, ISDN e SS7.
Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI Express.
Channel Bank – Appliance Asterisk - Acesse <a class="ecxmoz-txt-link-abbreviated" href="http://www.aligera.com.br" target="_blank">www.aligera.com.br</a>.
_______________________________________________
Para remover seu email desta lista, basta enviar um email em branco para <a class="ecxmoz-txt-link-abbreviated" href="mailto:asteriskbrasil-unsubscribe@listas.asteriskbrasil.org">asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</a></pre>
    </blockquote>
    <br>
  

<br>_______________________________________________
KHOMP: completa linha de placas externas FXO, FXS, GSM e E1;
Media Gateways de 1 a 64 E1s para SIP com R2, ISDN e SS7;
Intercomunicadores para acesso remoto via rede IP. Conhe�a em www.Khomp.com.
_______________________________________________
ALIGERA � Fabricante nacional de Gateways SIP-E1 para R2, ISDN e SS7.
Placas de 1E1, 2E1, 4E1 e 8E1 para PCI ou PCI Express.
Channel Bank � Appliance Asterisk - Acesse www.aligera.com.br.
_______________________________________________
Para remover seu email desta lista, basta enviar um email em branco para asteriskbrasil-unsubscribe@listas.asteriskbrasil.org</div>                                               </div></body>
</html>