Vamos por partes, o ChanIsAvail seta três variavaies: AVAILCHAN, AVAILORIGCHAN e AVAILSTATUS, então vc deve checar o valor do AVAILSTATUS conforme a documentação da aplicação. No seu dialplan vc está checando: <font face="Arial">exten => s,4,GotoIf($[${AVAILCHAN} =
0]?5:7), esta´variável irá retornar a identificação do canal de comunicação disponível.<br><br>Espero ter ajudado. Boa sorte<br></font><p><code class="code"><span><strong class="command">ChanIsAvail()</strong></span></code> sets the following
channel variables: </p>
<div class="variablelist">
<dl><dt>
<span class="term">
<code class="code">${AVAILCHAN}</code>
</span>
</dt><dd>The name of the accessible channel, including the session
number of the call.</dd><dt>
<span class="term">
<code class="code">${AVAILORIGCHAN}</code>
</span>
</dt><dd>The canonical channel name (<span class="emphasis"><em>i.e.</em></span>,
the channel name without session number).</dd><dt>
<span class="term">
<code class="code">${AVAILSTATUS}</code>
</span>
</dt><dd>
<p>Status code of the channel:</p>
<div class="variablelist">
<dl><dt>
<span class="term"><code class="code">AST_DEVICE_UNKNOWN</code> (0)</span>
</dt><dd>Status of the channel is unknown. It is a valid
channel, but we don't know about its state.</dd><dt>
<span class="term"><code class="code">AST_DEVICE_NOT_INUSE</code> (1)</span>
</dt><dd>The channel is not in use.</dd><dt>
<span class="term"><code class="code">AST_DEVICE_IN_USE</code> (2)</span>
</dt><dd>The channel is in use.</dd><dt>
<span class="term"><code class="code">AST_DEVICE_BUSY</code> (3)</span>
</dt><dd>The channel is busy.</dd><dt>
<span class="term"><code class="code">AST_DEVICE_INVALID</code> (4)</span>
</dt><dd>The channel is unknown.</dd><dt>
<span class="term"><code class="code">AST_DEVICE_UNAVAILABLE</code> (5)</span>
</dt><dd>The channel is not available and not
registered.</dd><dt>
<span class="term"><code class="code">AST_DEVICE_RINGING</code> (6)</span>
</dt><dd>The channel is ringing.</dd><dt><br></dt></dl>
</div>
</dd></dl>
</div><br><br><div class="gmail_quote">On Thu, May 29, 2008 at 10:36 AM, Telecom - UNION <<a href="mailto:telecom@union.com.br" target="_blank">telecom@union.com.br</a>> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff">
<div><font face="Arial">Bom dia lista.</font></div>
<div><font face="Arial">Sera que alguém poderia me ajudar com o extensions
abaixo.</font></div>
<div><font face="Arial">Preciso que o *, antes de direcionar a ligação para o
ramal, verifique se o mesmo esta disponivel e se é SIP ou IAX.</font></div>
<div><font face="Arial">Consegui que ele verifique se é SIP ou IAX mas tem hora
que não funciona.</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">[macro-dial]<br>exten =>
s,1,MixMonitor(${STRFTIME(${EPOCH},,%Y%m%d-%H%M%S)}-${CONTEXTO}-${CALLERID(num)}-${NUM}.wav49)</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">exten =>
s,2,ChanIsAvail(IAX2/${NUM}&SIP/${NUM},s)<br>exten => s,3,NoOp(AVAIL
-> ${AVAILCHAN})<br>exten => s,4,GotoIf($[${AVAILCHAN} =
0]?5:7)</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">exten => s,5,Dial(SIP/${NUM},15,tTw)<br>exten =>
s,6,Goto(s-${DIALSTATUS},1)</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">exten => s,7,Dial(IAX2/${NUM},15,tTw)<br>exten =>
s,8,Goto(s-${DIALSTATUS},1)</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">exten => s-CHANUNAVAIL,1,Macro(${GRUPO},s)<br>exten
=> s-CONGESTION,1,Macro(${GRUPO},s)<br>exten =>
s-BUSY,1,Macro(${GRUPO},s)<br>exten =>
s-NOANSWER,1,Macro(${GRUPO},s)<br>exten =>
s-CANCEL,1,Macro(${GRUPO},s)<br>exten =>
s-HANGUP,1,Macro(${GRUPO},s)<br>exten => s,20,Hangup<br></font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">ERRO NR.01</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"> -- Executing [701@ti:1]
Goto("SIP/708-adb25bf0", "union|701|1") in new stack<br> --
Goto (union,701,1)<br> -- Executing [701@union:1]
Set("SIP/708-adb25bf0", "NAME=708") in new stack<br> --
Executing [701@union:2] Set("SIP/708-adb25bf0", "NUM=701") in new
stack<br> -- Executing [701@union:3] Set("SIP/708-adb25bf0",
"CONTEXTO=union") in new stack<br> -- Executing [701@union:4]
GotoIf("SIP/708-adb25bf0", "0?5:7") in new stack<br> -- Goto
(union,701,7)<br> -- Executing [701@union:7]
GotoIf("SIP/708-adb25bf0", "0?8:10") in new stack<br> -- Goto
(union,701,10)<br> -- Executing [701@union:10]
GotoIf("SIP/708-adb25bf0", "1?11:13") in new stack<br> -- Goto
(union,701,11)<br> -- Executing [701@union:11]
Set("SIP/708-adb25bf0", "GRUPO=grupoti") in new stack<br> --
Executing [701@union:12] Goto("SIP/708-adb25bf0", "s(iax)|1") in new
stack<br> -- Goto (union,s(iax),1)<br> --
Executing [s(iax)@union:1] Macro("SIP/708-adb25bf0", "sigame|s") in new
stack<br> -- Executing [s@macro-sigame:1]
Set("SIP/708-adb25bf0", "TEMP=") in new stack<br> -- Executing
[s@macro-sigame:2] Set("SIP/708-adb25bf0", "NUM1=701") in new
stack<br> -- Executing [s@macro-sigame:3]
Set("SIP/708-adb25bf0", "TAM=0") in new stack<br> -- Executing
[s@macro-sigame:4] GotoIf("SIP/708-adb25bf0", "1?nsigame:proximo") in new
stack<br> -- Goto (macro-sigame,s,12)<br> --
Executing [s@macro-sigame:12] Macro("SIP/708-adb25bf0", "dialiax|701") in new
stack<br> -- Executing [s@macro-dialiax:1]
MixMonitor("SIP/708-adb25bf0", "20080529-101859-union-708-701.wav49") in new
stack<br> -- Executing [s@macro-dialiax:2]
ChanIsAvail("SIP/708-adb25bf0", "IAX2/701&SIP/701|s") in new
stack<br> <font color="#0000ff"> -- Executing [s@macro-dialiax:3]
NoOp("SIP/708-adb25bf0", "AVAIL -> ") in new stack<br></font><b>[May 29
10:18:59] WARNING[22761]: ast_expr2.fl:398 ast_yyerror: ast_yyerror():
syntax error: syntax error, unexpected '=', expecting $end; Input:<br> =
0<br> ^<br>[May 29 10:18:59] WARNING[22761]: ast_expr2.fl:402 ast_yyerror:
If you have questions, please refer to doc/channelvariables.txt in the asterisk
source.<br></b> -- Executing [s@macro-dialiax:4]
GotoIf("SIP/708-adb25bf0", "?5:7") in new stack<br> -- Goto
(macro-dialiax,s,7)<br> -- Executing [s@macro-dialiax:7]
Dial("SIP/708-adb25bf0", "IAX2/701|15|tTw") in new stack<br>[May 29 10:18:59]
WARNING[22761]: app_dial.c:1106 dial_exec_full: Unable to create channel of type
'IAX2' (cause 3 - No route to destination)<br> == Everyone is
busy/congested at this time (1:0/0/1)<br> -- Executing
[s@macro-dialiax:8] Goto("SIP/708-adb25bf0", "s-CHANUNAVAIL|1") in new
stack<br> -- Goto
(macro-dialiax,s-CHANUNAVAIL,1)<br> -- Executing
[s-CHANUNAVAIL@macro-dialiax:1] Macro("SIP/708-adb25bf0", "grupoti|s") in new
stack<br> -- Executing [s@macro-grupoti:1]
Dial("SIP/708-adb25bf0",
"SIP/700&SIP/701&SIP/702&SIP/703&SIP/704&SIP/705&SIP/706&SIP/707&SIP/708|10|tTw")
in new stack</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">No log apresentado, o ramal 701 estava on, e mesmo assim o
erro aconteceu.Isso ocorre ao acaso.</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">ERRO NR.02</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"> -- Executing [701@ti:1] Goto("SIP/708-007ce5b0",
"union|701|1") in new stack<br> -- Goto
(union,701,1)<br> -- Executing [701@union:1]
Set("SIP/708-007ce5b0", "NAME=708") in new stack<br> --
Executing [701@union:2] Set("SIP/708-007ce5b0", "NUM=701") in new
stack<br> -- Executing [701@union:3] Set("SIP/708-007ce5b0",
"CONTEXTO=union") in new stack<br> -- Executing [701@union:4]
GotoIf("SIP/708-007ce5b0", "0?5:7") in new stack<br> -- Goto
(union,701,7)<br> -- Executing [701@union:7]
GotoIf("SIP/708-007ce5b0", "0?8:10") in new stack<br> -- Goto
(union,701,10)<br> -- Executing [701@union:10]
GotoIf("SIP/708-007ce5b0", "1?11:13") in new stack<br> -- Goto
(union,701,11)<br> -- Executing [701@union:11]
Set("SIP/708-007ce5b0", "GRUPO=grupoti") in new stack<br> --
Executing [701@union:12] Goto("SIP/708-007ce5b0", "s(iax)|1") in new
stack<br> -- Goto (union,s(iax),1)<br> --
Executing [s(iax)@union:1] Macro("SIP/708-007ce5b0", "sigame|s") in new
stack<br> -- Executing [s@macro-sigame:1]
Set("SIP/708-007ce5b0", "TEMP=") in new stack<br> -- Executing
[s@macro-sigame:2] Set("SIP/708-007ce5b0", "NUM1=701") in new
stack<br> -- Executing [s@macro-sigame:3]
Set("SIP/708-007ce5b0", "TAM=0") in new stack<br> -- Executing
[s@macro-sigame:4] GotoIf("SIP/708-007ce5b0", "1?nsigame:proximo") in new
stack<br> -- Goto (macro-sigame,s,12)<br> --
Executing [s@macro-sigame:12] Macro("SIP/708-007ce5b0", "dialiax|701") in new
stack<br> -- Executing [s@macro-dialiax:1]
MixMonitor("SIP/708-007ce5b0", "20080529-102319-union-708-701.wav49") in new
stack<br> -- Executing [s@macro-dialiax:2]
ChanIsAvail("SIP/708-007ce5b0", "IAX2/701&SIP/701|s") in new stack<br>
== Begin MixMonitor Recording SIP/708-007ce5b0<br> --
Executing [s@macro-dialiax:3] NoOp("SIP/708-007ce5b0", "AVAIL ->
SIP/701-00794300") in new stack<br>[May 29 10:23:19] WARNING[23147]:
ast_expr2.y:893 op_div: non-numeric argument<br> <b> --
Executing [s@macro-dialiax:4] GotoIf("SIP/708-007ce5b0", "0?5:7") in new
stack</b><br> -- Goto
(macro-dialiax,s,7)<br> -- Executing [s@macro-dialiax:7]
Dial("SIP/708-007ce5b0", "<font color="#0000ff">IAX2/701|15|tTw</font>") in new
stack<br>[May 29 10:23:19] WARNING[23147]: app_dial.c:1106 dial_exec_full:
Unable to create channel of type 'IAX2' (cause 3 - No route to
destination)<br> == Everyone is busy/congested at this time
(1:0/0/1)<br> -- Executing [s@macro-dialiax:8]
Goto("SIP/708-007ce5b0", "s-CHANUNAVAIL|1") in new stack<br>
-- Goto (macro-dialiax,s-CHANUNAVAIL,1)<br> -- Executing
[s-CHANUNAVAIL@macro-dialiax:1] Macro("SIP/708-007ce5b0", "grupoti|s") in new
stack<br> -- Executing [s@macro-grupoti:1]
Dial("SIP/708-007ce5b0",
"SIP/700&SIP/701&SIP/702&SIP/703&SIP/704&SIP/705&SIP/706&SIP/707&SIP/708|10|tTw")
in new stack<br></font></div>
<div><font face="Arial"> Aqui o erro acontece porque o * interpreta o canal
como IAX sendo que é SIP.</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial">Quando tudo sai bem (eu acho)</font></div>
<div><font face="Arial"></font> </div>
<div><font face="Arial"> -- Executing [701@ti:1]
Goto("SIP/708-00851ed0", "union|701|1") in new stack<br> --
Goto (union,701,1)<br> -- Executing [701@union:1]
Set("SIP/708-00851ed0", "NAME=708") in new stack<br> --
Executing [701@union:2] Set("SIP/708-00851ed0", "NUM=701") in new
stack<br> -- Executing [701@union:3] Set("SIP/708-00851ed0",
"CONTEXTO=union") in new stack<br> -- Executing [701@union:4]
GotoIf("SIP/708-00851ed0", "0?5:7") in new stack<br> -- Goto
(union,701,7)<br> -- Executing [701@union:7]
GotoIf("SIP/708-00851ed0", "0?8:10") in new stack<br> -- Goto
(union,701,10)<br> -- Executing [701@union:10]
GotoIf("SIP/708-00851ed0", "1?11:13") in new stack<br> -- Goto
(union,701,11)<br> -- Executing [701@union:11]
Set("SIP/708-00851ed0", "GRUPO=grupoti") in new stack<br> --
Executing [701@union:12] Goto("SIP/708-00851ed0", "s(iax)|1") in new
stack<br> -- Goto (union,s(iax),1)<br> --
Executing [s(iax)@union:1] Macro("SIP/708-00851ed0", "sigame|s") in new
stack<br> -- Executing [s@macro-sigame:1]
Set("SIP/708-00851ed0", "TEMP=") in new stack<br> -- Executing
[s@macro-sigame:2] Set("SIP/708-00851ed0", "NUM1=701") in new
stack<br> -- Executing [s@macro-sigame:3]
Set("SIP/708-00851ed0", "TAM=0") in new stack<br> -- Executing
[s@macro-sigame:4] GotoIf("SIP/708-00851ed0", "1?nsigame:proximo") in new
stack<br> -- Goto (macro-sigame,s,12)<br> --
Executing [s@macro-sigame:12] Macro("SIP/708-00851ed0", "dialiax|701") in new
stack<br> -- Executing [s@macro-dialiax:1]
MixMonitor("SIP/708-00851ed0", "20080529-102537-union-708-701.wav49") in new
stack<br> -- Executing [s@macro-dialiax:2]
ChanIsAvail("SIP/708-00851ed0", "IAX2/701&SIP/701|s") in new stack<br>
== Begin MixMonitor Recording SIP/708-00851ed0<br> --
Executing [s@macro-dialiax:3] NoOp("SIP/708-00851ed0", "AVAIL ->
SIP/701-007000b0") in new stack<br><b>[May 29 10:25:37] WARNING[23360]:
ast_expr2.y:893 op_div: non-numeric argument<br>[May 29 10:25:37]
WARNING[23360]: ast_expr2.y:755 op_minus: non-numeric
argument<br></b> -- Executing [s@macro-dialiax:4]
GotoIf("SIP/708-00851ed0", "1?5:7") in new stack<br> -- Goto
(macro-dialiax,s,5)<br> -- Executing [s@macro-dialiax:5]
Dial("SIP/708-00851ed0", "SIP/701|15|tTw") in new stack<br> --
Called 701<br></font></div>
<div><font face="Arial">Aqui é quando a operação é um sucesso, porém tem dois
WARNING que não sei como resolve-lo.</font></div>
<div><br></div>
<div><font face="Arial" size="-3">
<table>
<tbody>
<tr>
<td><img src="?ui=2&ik=2ad4f06166&realattid=0.0.1&attid=0.1&disp=emb&view=att&th=11a34fa2dd7fdbdf" align="middle">
</td>
<td><font face="Arial" size="-1"><big><b>Pereira,
Sidnei</b></big><br>Tecnologia da Informação / Telecom<br><b>UNION
Crédito Fácil e Serviços Ltda</b> - <font face="Wingdings" size="3">C</font>
Certeza de Sucesso <br><font face="Webdings" size="3">O</font>(17) 8124 3954 -
<font face="Wingdings" size="3">(</font>(17) 4009 6767 - <font face="Wingdings" size="3">*</font> <a href="mailto:telecom@union.com.br" target="_blank">telecom@union.com.br</a>
</font></td></tr></tbody></table></font>
<hr align="Bottom" size="2" width="100%">
</div></div>
<br>_______________________________________________<br>
Compre uma camiseta da AsteriskBrasil.org!<br>
<a href="http://www.voipmania.com.br" target="_blank">http://www.voipmania.com.br</a><br>
== <a href="http://VoIPMania.com.br" target="_blank">VoIPMania.com.br</a> ==<br>
<br>
_______________________________________________<br>
Lista de discussões AsteriskBrasil.org<br>
<a href="mailto:AsteriskBrasil@listas.asteriskbrasil.org" target="_blank">AsteriskBrasil@listas.asteriskbrasil.org</a><br>
<a href="http://listas.asteriskbrasil.org/mailman/listinfo/asteriskbrasil" target="_blank">http://listas.asteriskbrasil.org/mailman/listinfo/asteriskbrasil</a><br></blockquote></div><br>