<html xmlns:v="urn:schemas-microsoft-com:vml" xmlns:o="urn:schemas-microsoft-com:office:office" xmlns:w="urn:schemas-microsoft-com:office:word" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=utf-8">
<meta name=Generator content="Microsoft Word 12 (filtered medium)">
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0cm;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman","serif";}
a:link, span.MsoHyperlink
        {mso-style-priority:99;
        color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {mso-style-priority:99;
        color:purple;
        text-decoration:underline;}
span.EmailStyle17
        {mso-style-type:personal-reply;
        font-family:"Calibri","sans-serif";
        color:#1F497D;}
.MsoChpDefault
        {mso-style-type:export-only;}
@page Section1
        {size:612.0pt 792.0pt;
        margin:72.0pt 72.0pt 72.0pt 72.0pt;}
div.Section1
        {page:Section1;}
-->
</style>
<!--[if gte mso 9]><xml>
 <o:shapedefaults v:ext="edit" spidmax="1026" />
</xml><![endif]--><!--[if gte mso 9]><xml>
 <o:shapelayout v:ext="edit">
  <o:idmap v:ext="edit" data="1" />
 </o:shapelayout></xml><![endif]-->
</head>

<body lang=EN-US link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Melcon, <o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Suppose you have four E1, where span1 and span2 is assigned
Group1;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Span3 is assigned Group2; and span4 is assigned group3;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>So you have G1, G2, and G3 groups<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Then you have “Transit Telecom” on G1,  “Embratel Telecom” on G2;
and “Oi Telecom“ on G3;<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>For some destinations Transit is cheaper then Embratel, so you
need these calls to go first to Transit then to Embratel.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Chanisavail can scan the tree groups (or even more if you have) and
find the first available channel in this sequence. (G1 -&gt; G2 -&gt; G3) If
there is a Transit channel available, it will be used for this destination; If
Transit is unavailable, Embratel is the second choice; And Oi the last choice.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>For others destinations, Embratel is cheaper, so you can scan
the groups using another sequence (G2 -&gt; G3 -&gt; G1). If there is a free
Embratel channel, it will be used now for this destination.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>And so on for the others destination.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>We use the chanisavail application as a complement for our LCR
system, which determines in real time the groups sequence based on call price,
time, date, destinations point of presence, long distance prefix and local
prefix.<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>--<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Prado<o:p></o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<p class=MsoNormal><span style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'><o:p>&nbsp;</o:p></span></p>

<div style='border:none;border-top:solid #B5C4DF 1.0pt;padding:3.0pt 0cm 0cm 0cm'>

<p class=MsoNormal><b><span style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>From:</span></b><span
style='font-size:10.0pt;font-family:"Tahoma","sans-serif"'>
asterisk-r2-bounces@lists.digium.com
[mailto:asterisk-r2-bounces@lists.digium.com] <b>On Behalf Of </b>Melcon Moraes<br>
<b>Sent:</b> sexta-feira, 21 de agosto de 2009 14:55<br>
<b>To:</b> asterisk-r2@lists.digium.com<br>
<b>Subject:</b> Re: [asterisk-r2] ChanIsAvail locking R2 channel<o:p></o:p></span></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

<p class=MsoNormal style='margin-bottom:12.0pt'>Just for the sake of curiosity,
why exactly ChanIsAvail() is needed?<br>
<br>
-<br>
MM<o:p></o:p></p>

<div>

<p class=MsoNormal>On Fri, Aug 21, 2009 at 2:00 AM, Moises Silva &lt;<a
href="mailto:moises.silva@gmail.com">moises.silva@gmail.com</a>&gt; wrote:<o:p></o:p></p>

<p class=MsoNormal>I just uploaded a new patch for Asterisk:&nbsp;<a
href="http://openr2.googlecode.com/files/openr2-asterisk-1.4.26.1.patch"
target="_blank">http://openr2.googlecode.com/files/openr2-asterisk-1.4.26.1.patch</a><o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>The patch should fix the issue with CHANISAVAIL, however I
have not tested it myself. Please test asap so I can upload a new one if the
issue is still present.<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>The issue was fixed as well in Asterisk trunk and Asterisk
1.6.2 branch (which soon will have a new beta out).<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>OpenR2 1.2.0 will be released this weekend.<o:p></o:p></p>

<div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p>

<div>

<p class=MsoNormal>On Wed, Aug 19, 2009 at 10:59 AM, Moises Silva &lt;<a
href="mailto:moises.silva@gmail.com" target="_blank">moises.silva@gmail.com</a>&gt;
wrote:<o:p></o:p></p>

<p class=MsoNormal>Hello Rafael,<o:p></o:p></p>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>I think it's a bug in chan_dahdi.c, I have not tested but
checking what application CHANISAVAIL does, the code path seems like
unexpected, when ast_request() is called I set mfcr2call=1 to reserve the
channel, but in ast_hangup() I do not set mfcr2call=0 because the usual code
path is ast_request() -&gt; ast_call() -&gt; ast_hangup() and at that point
openr2 callbacks will report call end and I will set mfcr2call=0, but when just
checking if the channel is avail, the call is never initiated and the
mfcr2call=1 flag keeps set after ast_hangup().<o:p></o:p></p>

</div>

<div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

<div>

<p class=MsoNormal>This bug will be present in all patches for Asterisk and
1.6.2 as well. I will fix it tonight (or sooner if I have a chance) for 1.6.2,
and create a new patch for 1.4 probably the weekend, or sooner if I can.&nbsp;<o:p></o:p></p>

<div>

<div>

<p class=MsoNormal style='margin-bottom:12.0pt'><o:p>&nbsp;</o:p></p>

<div>

<p class=MsoNormal>On Wed, Aug 19, 2009 at 2:09 AM, Rafael Prado Rocchi &lt;<a
href="mailto:prado@practis.com.br" target="_blank">prado@practis.com.br</a>&gt;
wrote:<o:p></o:p></p>

<p class=MsoNormal>Hi,<br>
We are having problems with chanisavail.<br>
<br>
Everytime we use chanisavail to check for channel availability, when using R2,
the channel gets locked.<br>
We tested with 1.4.22, 1.4.24 and 1.4.26, using OpenR2 release 209.<br>
<br>
Chanisavail works fine if the E1 is ISDN<br>
But chanisavail gives error and locks the channel if we configure the E1 as R2.
Next run, it locks the second available channel and so, until we get all 30
channels locked. Then we have to restart.<br>
<br>
<br>
All other applications and the asterisk itself is working fine with R2<br>
<br>
<br>
<br>
Can anyone please test this and confirm this problem?<br>
<br>
<br>
<br>
Here is a simple dialplan for testing:<br>
<br>
<br>
exten =&gt; 123,1,noop( ---- TESTE CHANISVAIL ---- )<br>
exten =&gt; 123,n,CHANISAVAIL(dahdi/g1)<br>
exten =&gt; 123,n,NOOP(CHAN=${AVAILCHAN})<br>
exten =&gt; 123,n,SET(CHAN=${CUT(AVAILCHAN||1)})<br>
exten =&gt; 123,n,DIAL(${CHAN}/1234)<br>
exten =&gt; 123,n,NOOP( STATUS = ${DIALSTATUS})<br>
<br>
<br>
<br>
Thanks in advance,<br>
<br>
Rafael Prado<br>
<br>
<br>
PRACTIS - Comunicação &amp; Tecnologia<br>
Av Aquidaban, 766 - Conj 51&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<br>
CEP 13026-510, Campinas/SP - Brasil<br>
<a href="http://www.practis.com.br" target="_blank">http://www.practis.com.br</a><br>
<br>
<br>
This message and any archive transmited may contain confidential and/or
privileged information. If you are not the addressee or authorized to receive
this for the addressee, you must not use, copy, disclose or take
any&nbsp;action based&nbsp;on this message or any information herein. If you
have received this message in error, please advise the sender immediately by
reply e-mail and delete this message. Any views or opinions expressed in this
email are solely those of the author and might not represent those of Practis.
Although reasonable precautions have been taken by Practis to ensure no viruses
are present in this email, the company cannot accept responsability for any
loss or damage arising from the use of this email or it's attachments. Thank
you for your cooperation.<br>
<br>
<br>
_______________________________________________<br>
--Bandwidth and Colocation Provided by <a href="http://www.api-digital.com--"
target="_blank">http://www.api-digital.com--</a><br>
<br>
asterisk-r2 mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
&nbsp; <a href="http://lists.digium.com/mailman/listinfo/asterisk-r2"
target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-r2</a><o:p></o:p></p>

</div>

<p class=MsoNormal><br>
<br clear=all>
<o:p></o:p></p>

</div>

</div>

<p class=MsoNormal>-- <br>
Moises Silva<br>
Software Developer<br>
Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 9T3
Canada<br>
t. 1 905 474 1990 x 128 | e. <a href="mailto:moy@sangoma.com" target="_blank">moy@sangoma.com</a><o:p></o:p></p>

</div>

</div>

<p class=MsoNormal><br>
<br clear=all>
<br>
-- <br>
Moises Silva<br>
Software Developer<br>
Sangoma Technologies Inc. | 50 McIntosh Drive, Suite 120, Markham ON L3R 9T3
Canada<br>
t. 1 905 474 1990 x 128 | e. <a href="mailto:moy@sangoma.com" target="_blank">moy@sangoma.com</a><o:p></o:p></p>

</div>

</div>

</div>

<p class=MsoNormal><br>
_______________________________________________<br>
--Bandwidth and Colocation Provided by <a href="http://www.api-digital.com--"
target="_blank">http://www.api-digital.com--</a><br>
<br>
asterisk-r2 mailing list<br>
To UNSUBSCRIBE or update options visit:<br>
&nbsp; <a href="http://lists.digium.com/mailman/listinfo/asterisk-r2"
target="_blank">http://lists.digium.com/mailman/listinfo/asterisk-r2</a><o:p></o:p></p>

</div>

<p class=MsoNormal><o:p>&nbsp;</o:p></p>

</div>

</body>

</html>