[AsteriskBrasil] RES: RES: Iniciante com exten, alguem da uma dica?

João Claudio F. Andrade ppro em terra.com.br
Sexta Agosto 21 00:08:33 BRT 2009


**SOLUÇÂO**


Amigo MrXeom,

obrigado pelo post.  Da forma abaixo fiquei com o mesmo problema... hangup
qdo o canal esta offline.

No entanto *ACHEI* oque faltava.


Lendo a documentação do asterisk 1.2 vi o seguinte:

*If the s (state) option is given, Asterisk will treat the channel as
unavailable if it is in use, even if it is capable of taking another call.
Option j sets priority jumping to n+101 if the channel is unavailable.
*

Entao pra eu dar um comando se o canal estiver offline, eu tenho q setar a
flag *J* e setando ela, caso offline ele vai pular para o numero *101* na
extenção...

sendo assim, pra funcionar ela tem que ficar da seguinte forma:

[custom-amfa]
exten => 123,1,ChanIsAvail(SIP/350,j)
exten => 123,2,NoOp(${AVAILORIGCHAN} is available)
exten => 123,3,Playback(custom/amfa_online)
exten => 123,4,Dial(SIP/350,60)
exten => 123,102,Playback(custom/amfa_offline)
exten => 123,103,Congestion(3)
exten => 123,104,Hangup()


*Obrigado a todos que participaram.*



-
João Claudio




2009/8/20 MrXeom <mrxeom em gmail.com>

>  João eu testei por aqui e funcionou certinho, só que eu defino um
> extensão para isso, no seu caso esta vindo de outro contexto.
>
>
>
> Tenta assim.
>
>
>
> [custom-amfa]
> exten => s,1,Answer()
>
> exten => s,2,Set(LANGUAGE()=pt_BR)
> exten => s,3,NoOp(351)
> exten => s,4,ChanIsAvail(SIP/351)
> exten => s,5,NoOP(AVAILSTATUS IS ${AVAILSTATUS})
> exten => s,6,GotoIf($["${AVAILSTATUS}" = "0"]?6:9)
> exten => s,7,Playback(custom/amfa_online)
> exten => s,8,Congestion(3)
> exten => s,9,Hangup()
> exten => s,10,Playback(custom/amfa_offline)
> exten => s,11,Congestion(3)
> exten => s,12,Hangup()
>
>
>
>
>
>
>
> *De:* asteriskbrasil-bounces em listas.asteriskbrasil.org [mailto:
> asteriskbrasil-bounces em listas.asteriskbrasil.org] *Em nome de *João
> Claudio F. Andrade
> *Enviada em:* quinta-feira, 20 de agosto de 2009 00:39
> *Para:* asteriskbrasil em listas.asteriskbrasil.org
> *Assunto:* Re: [AsteriskBrasil] RES: Iniciante com exten, alguem da uma
> dica?
>
>
>
> Fabio!  Segue o teste...  oque voce acha???
>
> *eu montei em cima da sua logica assim:*
>
> [custom-amfa]
> exten => s,1,Set(LANGUAGE()=pt_BR)
> exten => s,2,NoOp(351)
> exten => s,3,ChanIsAvail(SIP/351)
> exten => s,4,NoOP(AVAILSTATUS IS ${AVAILSTATUS})
> exten => s,5,GotoIf($["${AVAILSTATUS}" = "0"]?6:9)
> exten => s,6,Playback(custom/amfa_online)
> exten => s,7,Congestion(3)
> exten => s,8,Hangup()
> exten => s,9,Playback(custom/amfa_offline)
> exten => s,10,Congestion(3)
> exten => s,11,Hangup()
>
>
>
> * e funcionou bem avisando qdo o ramal está online veja o log:*
>
>     -- Executing DBdel("DGV/5", "") in new stack
>     -- Executing Set("DGV/5", "__NODEST=") in new stack
>     -- Executing Goto("DGV/5", "custom-amfa|s|1") in new stack
>     -- Goto (custom-amfa,s,1)
>     -- Executing Set("DGV/5", "LANGUAGE()=pt_BR") in new stack
>     -- Executing NoOp("DGV/5", "351") in new stack
>     -- Executing ChanIsAvail("DGV/5", "SIP/350") in new stack
>     -- Executing NoOp("DGV/5", "AVAILSTATUS IS 0") in new stack
>     -- Executing GotoIf("DGV/5", "1?6:9") in new stack
>     -- Goto (custom-amfa,s,6)
>     -- Executing Playback("DGV/5", "custom/amfa_online") in new stack
>     -- Playing 'custom/amfa_online' (language 'pt_BR')
>     -- Executing Congestion("DGV/5", "3") in new stack
>   == Spawn extension (custom-amfa, s, 7) exited non-zero on 'DGV/5'
>
>
>
> *Mas qdo ele está offline, ele da hangup sem nem chegar no NoOp e sem
> fazer o playback, veja:*
>
>     -- Executing DBdel("DGV/5", "") in new stack
>     -- Executing Set("DGV/5", "__NODEST=") in new stack
>     -- Executing Goto("DGV/5", "custom-amfa|s|1") in new stack
>     -- Goto (custom-amfa,s,1)
>     -- Executing Set("DGV/5", "LANGUAGE()=pt_BR") in new stack
>     -- Executing NoOp("DGV/5", "351") in new stack
>     -- Executing ChanIsAvail("DGV/5", "SIP/351") in new stack
>   == Spawn extension (custom-amfa, s, 3) exited non-zero on 'DGV/5'
>
>
>  2009/8/19 Fabio Guilherme <fabioguilhermed em gmail.com>
>
> Ola João tudo bem??
>
> Se fosse eu faria assim..
>
> Caso não de para sua aplicação segue a lógica, abraços e boa sorte.
>
>
>
> exten => _99,1,Set(LANGUAGE()=pt_BR)
>
> exten => _99,2,Background(digiteoramal)
>
> exten => _99,3,Read(ramal)
>
> exten => _99,4,NoOp(${ramal})
>
> exten => _99,5,ChanIsAvail(SIP/${ramal})
>
> exten => _99,6,NoOP(AVAILSTATUS IS ${AVAILSTATUS})
>
> exten => _99,7,GotoIf($["${AVAILSTATUS}" = "0"]?8:11)
>
> exten => _99,8,Playback(ramalconectado)
>
> exten => _99,9,Congestion(3)
>
> exten => _99,10,Hangup()
>
> exten => _99,11,Playback(ramaldesconectado)
>
> exten => _99,12,Congestion(3)
>
> exten => _99,13,Hangup()
>
>
>
>
>
> *De:* asteriskbrasil-bounces em listas.asteriskbrasil.org [mailto:
> asteriskbrasil-bounces em listas.asteriskbrasil.org] *Em nome de *João
> Claudio F. Andrade
> *Enviada em:* quarta-feira, 19 de agosto de 2009 01:35
> *Para:* asteriskbrasil em listas.asteriskbrasil.org
> *Assunto:* [AsteriskBrasil] Iniciante com exten, alguem da uma dica?
>
>
>
> Mestres, com a extenção a seguir eu consigo saber se o ramal esta online...
> (ele executa o playback)
> mas se ele esta offline ele nao executa o playback... fiz algo errado?
>
>
> [custom-amfa]
> include => macro-dialout-trunk
> exten => s,1,Answer
> exten => s,n,Wait,1
> exten => s,n,ChanIsAvail(SIP/350)
> exten => s,n,GotoIf($["${AVAILSTATUS}" != "0"]?offline)
> exten => s,n,GotoIf($["${AVAILSTATUS}" = "0"]?online)
> exten => s,n(offline),Playback(custom/
>
> amfa_offline)
> exten => s,n,HangUp
> exten => s,n(online),Playback(custom/amfa_online)
> exten => s,n,HangUp
>
>
>
> _______________________________________________
> Participe do IV Encontro VoIPCenter, 16 a 18 de setembro - São Paulo.
> VoIP, Asterisk e Convergência de Redes.
> http://www.encontrovoipcenter.com.br
>
> Compre uma camiseta da AsteriskBrasil.org!
> http://www.voipmania.com.br
>
> Acesse o canal IRC de discussão sobre Asterisk em Português Brasileiro na
> rede Freenode.net: #asterisk-br
> _______________________________________________
> Lista de discussões AsteriskBrasil.org
> AsteriskBrasil em listas.asteriskbrasil.org
> http://listas.asteriskbrasil.org/mailman/listinfo/asteriskbrasil
>
>
>
>
> _______________________________________________
> Participe do IV Encontro VoIPCenter, 16 a 18 de setembro - São Paulo.
> VoIP, Asterisk e Convergência de Redes.
> http://www.encontrovoipcenter.com.br
>
> Compre uma camiseta da AsteriskBrasil.org!
> http://www.voipmania.com.br
>
> Acesse o canal IRC de discussão sobre Asterisk em Português Brasileiro na
> rede Freenode.net: #asterisk-br
> _______________________________________________
> Lista de discussões AsteriskBrasil.org
> AsteriskBrasil em listas.asteriskbrasil.org
> http://listas.asteriskbrasil.org/mailman/listinfo/asteriskbrasil
>
-------------- Próxima Parte ----------
Um anexo em HTML foi limpo...
URL: http://listas.asteriskbrasil.org/pipermail/asteriskbrasil/attachments/20090821/19386a0f/attachment-0001.htm 


Mais detalhes sobre a lista de discussão AsteriskBrasil