Show de bola.

Mas tentando passar um código encontrado na net para que possa usar essa biblioteca do ccesario realizei algumas modificações no código só que não deu muito certo. 

Ficou meio longo, mas é que tentei enviar o máximo de informações para que possam me ajudar.

A intensão é deixar o código ok e repassar a comunidade mastigado um clicktocall.

 

Veja:
 
Aqui parte do código responsável:
---------------------------------------------------------
$con = "\r\n Action: originate\r\n Channel: $strChannel \r\n CallerId: $strCallerId\r\n Exten: $strExten\r\n Context: $strContext\r\n Priority: $strPriority \r\n\r\n";
if ($x->connect()) {
         $x->commandExecute($con);
---------------------------------------------------------
 
A conexão com manager ocorre corretamente:
---------------------------------------------------------
[Feb  5 09:29:31] DEBUG[19705]: manager.c:4719 process_message: Running action 'Login'
  == Manager 'click' logged on from 127.0.0.1
[Feb  5 09:29:32] DEBUG[19705]: manager.c:4719 process_message: Running action 'Command'
[Feb  5 09:29:33] DEBUG[19705]: manager.c:4719 process_message: Running action 'Logoff'
  == Manager 'click' logged off from 127.0.0.1
---------------------------------------------------------
 
Acho que o problema todo esta na execução do script como um command:
Veja parte da biblioteca responsável pelo command:
---------------------------------------------------------
    /**
         * AmiLib::commandExecute()
         *
         * Execute Asterisk CLI Command
         *
         * @param string $command
         * @param string $actionid message matching variable
         * @return array data
         * @access public
        */
        public function commandExecute($command, $actionid=NULL){
                $this->debug("commandExecute","Executing command $command");
                $this->addLog("info","Executing command $command");
                $parameters = array('Command'=>$command);
                if($actionid) {
                        $parameters['ActionID'] = $actionid;
                }
                return $this->sendRequest('Command', $parameters);
        }
}
---------------------------------------------------------
 
Log da biblioteca:
---------------------------------------------------------
======BEGIN
 05-02-2013 09:17:16 info Executing action login
======END
======BEGIN
 05-02-2013 09:17:17 info Connected to 127.0.0.1:5038.
======END
======BEGIN
 05-02-2013 09:17:17 info Executing command
 Action: originate
 Channel: SIP/2306
 CallerId: WebCall de <2306>
 Exten: 02168535353
 Context: web-to-pstn
 Priority: 1
======END
======BEGIN
 05-02-2013 09:17:17 info Executing action Command
======END
======BEGIN
 05-02-2013 09:17:18 info Executing action Logoff
======END
======BEGIN
 05-02-2013 09:17:18 info Disconnected from 127.0.0.1:5038.
======END
---------------------------------------------------------
 
Pensando nisso alterei na biblioteca o campo 'Command' po 'Originate' e agora temos no asterisk o Running action como originate:
 
---------------------------------------------------------
[Feb  5 09:35:37] DEBUG[19746]: manager.c:4719 process_message: Running action 'Login'
  == Manager 'click' logged on from 127.0.0.1
[Feb  5 09:35:38] DEBUG[19746]: manager.c:4719 process_message: Running action 'Originate'
[Feb  5 09:35:39] DEBUG[19746]: manager.c:4719 process_message: Running action 'Logoff'
  == Manager 'click' logged off from 127.0.0.1
---------------------------------------------------------
 
Removi o \r\n Action: originate do meu código:
---------------------------------------------------------
$con = "\r\n Channel: $strChannel \r\n CallerId: $strCallerId\r\n Exten: $strExten\r\n Context: $strContext\r\n Priority: $strPriority ";
if ($x->connect()) {
         $x->commandExecute($con);
---------------------------------------------------------
 
E tenho no debug da biblioteca no browser:
---------------------------------------------------------
===DEBUG: sendRequest requests===
Action: login Username: click Secret: zolclick Events: off ===DEBUG: commandExecute===
Executing command Channel: SIP/2306 CallerId: WebCall de <2306> Exten: 02168535353 Context: web-to-pstn Priority: 1 ===DEBUG: sendRequest requests===
Action: Originate Originate: Channel: SIP/2306 CallerId: WebCall de <2306> Exten: 02168535353 Context: web-to-pstn Priority: 1 ===DEBUG: sendRequest requests===
Action: Logoff Channel: SIP/2306 CallerId: WebCall de <2306> Exten: 02168535353  Context: web-to-pstn Priority: 1    
---------------------------------------------------------
 
E no log da biblioteca:
---------------------------------------------------------
======BEGIN
 05-02-2013 09:35:16 info Executing action login
======END
======BEGIN
 05-02-2013 09:35:17 info Connected to 127.0.0.1:5038.
======END
======BEGIN
 05-02-2013 09:35:17 info Executing command
 Channel: SIP/2306
 CallerId: WebCall de <2306>
 Exten: 02168535353
 Context: web-to-pstn
 Priority: 1
======END
======BEGIN
 05-02-2013 09:35:17 info Executing action Originate
======END
======BEGIN
 05-02-2013 09:35:18 info Executing action Logoff
======END
======BEGIN
 05-02-2013 09:35:18 info Disconnected from 127.0.0.1:5038.
======END
---------------------------------------------------------
 
Lembrando que a conexão ocorre corretamente.
Se mudo para command e ponho por exemplo no php sip show peers consigo trazer na tela as informações corretamente, ou seja, a biblioteca tb funciona corretamente.
 
Pergunto, alguem consegue apontar onde delirei?
Agradeco a todos por ter lido ate aqui.
 
Obg
Felippe
 

Em 01/02/2013 17:48, Sylvio Jollenbeck < sylvio.jollenb...@gmail.com > escreveu:
Felippe,

substitui os parametros do Channel:
Channel: Local/fila@context\r\n;

supondo q a sua fila se chame "SUPORTE" e esteja dentro do contexto chamado "FILAS", logo:

Channel: Local/suporte@filas\r\n;

Abs,


Em 1 de fevereiro de 2013 17:17, Felippe <alcaponefeli...@bol.com.br> escreveu:
Pegando carona no assunto, como faço para ele chamar uma fila ao inves de um canal sip?

fputs($socket, "Channel: SIP/5001\r\n" );  --> aqui ao inves de dar um dial no canal faça um qeueu(minhafila)
?
 
Obg
Felippe
 
 

Em 01/02/2013 16:06, Sylvio Jollenbeck < sylvio.jollenb...@gmail.com > escreveu:
Pessoal,

O pulo do gato foi o sleep de 1 segundo, ou seja você se autenticou e depois de 1 segundo enviou a instrução para o asterisk. Em termos de processamento 1 segundo é uma eternidade para o processador e se você possuir uma grande fila de comandos imagine o tempo que vai levar para processar todos, ou seja, haverá gargalo.
Minha sugestão é manter o sleep, mas em 200 milisegundos (já é suficiente).

Abs,
 

_______________________________________________
EBS MODULAR: 3 slots para combinação entre E1, GSM, FXS ou FXO;
Linha de PORTEIROS IP, abrem até 2 dispositivos com acesso IP remoto;
Conheça esses e outros LANÇAMENTOS KHOMP em www.Khomp.com 
_______________________________________________
DIGIVOICE  Fabricante de Placas de Voz e Channel Bank
20 anos de experiência com E1(R2/ISDN), FXS, FXO e GSM
Centro Treinamento - Curso de PABX IP -  Asterisk  - Site  www.digivoice.com.br
_______________________________________________
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-unsubscr...@listas.asteriskbrasil.org



--
Sylvio Jollenbeck
www.hosannatecnologia.com.br

 
_______________________________________________
EBS MODULAR: 3 slots para combinação entre E1, GSM, FXS ou FXO;
Linha de PORTEIROS IP, abrem até 2 dispositivos com acesso IP remoto;
Conheça esses e outros LANÇAMENTOS KHOMP em www.Khomp.com 
_______________________________________________
DIGIVOICE  Fabricante de Placas de Voz e Channel Bank
20 anos de experiência com E1(R2/ISDN), FXS, FXO e GSM
Centro Treinamento - Curso de PABX IP -  Asterisk  - Site  www.digivoice.com.br
_______________________________________________
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-unsubscr...@listas.asteriskbrasil.org

Responder a