<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:x="urn:schemas-microsoft-com:office:excel" xmlns:p="urn:schemas-microsoft-com:office:powerpoint" xmlns:a="urn:schemas-microsoft-com:office:access" xmlns:dt="uuid:C2F41010-65B3-11d1-A29F-00AA00C14882" xmlns:s="uuid:BDC6E3F0-6DA3-11d1-A2A3-00AA00C14882" xmlns:rs="urn:schemas-microsoft-com:rowset" xmlns:z="#RowsetSchema" xmlns:b="urn:schemas-microsoft-com:office:publisher" xmlns:ss="urn:schemas-microsoft-com:office:spreadsheet" xmlns:c="urn:schemas-microsoft-com:office:component:spreadsheet" xmlns:oa="urn:schemas-microsoft-com:office:activation" xmlns:html="http://www.w3.org/TR/REC-html40" xmlns:q="http://schemas.xmlsoap.org/soap/envelope/" xmlns:D="DAV:" xmlns:x2="http://schemas.microsoft.com/office/excel/2003/xml" xmlns:ois="http://schemas.microsoft.com/sharepoint/soap/ois/" xmlns:dir="http://schemas.microsoft.com/sharepoint/soap/directory/" xmlns:ds="http://www.w3.org/2000/09/xmldsig#" xmlns:dsp="http://schemas.microsoft.com/sharepoint/dsp" xmlns:udc="http://schemas.microsoft.com/data/udc" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:sps="http://schemas.microsoft.com/sharepoint/soap/" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:udcxf="http://schemas.microsoft.com/data/udc/xmlfile" xmlns:wf="http://schemas.microsoft.com/sharepoint/soap/workflow/" xmlns:mver="http://schemas.openxmlformats.org/markup-compatibility/2006" xmlns:m="http://schemas.microsoft.com/office/2004/12/omml" xmlns:mrels="http://schemas.openxmlformats.org/package/2006/relationships" xmlns:ex12t="http://schemas.microsoft.com/exchange/services/2006/types" xmlns:ex12m="http://schemas.microsoft.com/exchange/services/2006/messages" xmlns="http://www.w3.org/TR/REC-html40">

<head>
<meta http-equiv=Content-Type content="text/html; charset=us-ascii">
<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;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 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;}
pre
        {mso-style-priority:99;
        mso-style-link:"HTML Preformatted Char";
        margin:0cm;
        margin-bottom:.0001pt;
        font-size:10.0pt;
        font-family:"Courier New";}
span.HTMLPreformattedChar
        {mso-style-name:"HTML Preformatted Char";
        mso-style-priority:99;
        mso-style-link:"HTML Preformatted";
        font-family:Consolas;}
span.comment
        {mso-style-name:comment;}
span.keywordflow
        {mso-style-name:keywordflow;}
span.EmailStyle21
        {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:2.0cm 42.5pt 2.0cm 3.0cm;}
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=RU link=blue vlink=purple>

<div class=Section1>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>I guess you meant ast_autoservice_stop not ast_service_stop.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>Honestly I have no idea what causes your problem &#8211; it is
something for Russell to look at probably.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US style='font-size:11.0pt;font-family:"Calibri","sans-serif";
color:#1F497D'>However, I&#8217;m almost sure that upgrading tor latest SVN 1.4
branch will fix the problem because of commit 90967.<o:p></o:p></span></p>

<p class=MsoNormal><span lang=EN-US 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 lang=EN-US style='font-size:10.0pt;font-family:
"Tahoma","sans-serif"'>From:</span></b><span lang=EN-US style='font-size:10.0pt;
font-family:"Tahoma","sans-serif"'> asterisk-dev-bounces@lists.digium.com
[mailto:asterisk-dev-bounces@lists.digium.com] <b>On Behalf Of </b>Paulo Garcia<br>
<b>Sent:</b> Tuesday, December 11, 2007 10:44 PM<br>
<b>To:</b> Asterisk Developers Mailing List<br>
<b>Subject:</b> [asterisk-dev] Asterisk 1.4.15 ast_service_stop() function
deadlock?<o:p></o:p></span></p>

</div>

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

<p class=MsoNormal style='margin-bottom:12.0pt'>Hi,<br>
<br>
well, it isn't really a deadlock, but I think it is something wrong....<br>
<br>
in my channel driver, I have a fax detection procedure that calls
ast_exists_extensions() to check if there is a 'fax' exten available to jump
for. <br>
<br>
My test environment is an Asterisk box with FXO interface and another
non-asterisk box with FXS interface. The FXS side originates the call and the
asterisk box answer the call.<br>
<br>
I always used the following dialplan for testing: <br>
<br>
exten =&gt; s,1,Answer(1000);<br>
exten =&gt; s,n,Record(test:ulaw|0|0)<br>
exten =&gt; s,n,NoOp(${REMOTESTATIONID})<br>
<br>
When the Asterisk side answer the call, the FXS side starts a Fax transmit. Of
course the fax won't be received since there is no Rx application running on
Asterisk side. <br>
<br>
The problem is that, when the Asterisk detects the fax signal and calls
ast_exists_extensions(), the function ast_service_stop() only returns when the
call finishes. I followed the stack and it seems that the ast_service_stop
function stay the following point: <o:p></o:p></p>

<pre>00234&nbsp;&nbsp;&nbsp; <span class=comment>/* Wait for it to un-block */</span><o:p></o:p></pre><pre><a
name=l00235></a>00235&nbsp;&nbsp;&nbsp; <span class=keywordflow>while</span> (<a
href="http://www.asterisk.org/doxygen/1.4/utils_8h.html#0cba63300a5690b7f297b26179882cd9">ast_test_flag</a>(<a
href="http://www.asterisk.org/doxygen/1.4/structasent.html#24fea160601399d6d7a15f28b22bebd7"><o:p></o:p></a></pre><pre><span
class=MsoHyperlink><a
href="http://www.asterisk.org/doxygen/1.4/structasent.html#24fea160601399d6d7a15f28b22bebd7">chan</a></span>, <a
href="http://www.asterisk.org/doxygen/1.4/channel_8h.html#d032a9ab2ed31c90af611a3c6221925306284ba3d5b82164197739aff2f52568">AST_FLAG_BLOCKING</a>))<br>
<a name=l00236></a>00236&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; usleep(1000);<o:p></o:p></pre>

<p class=MsoNormal style='margin-bottom:12.0pt'><br>
So, If my call takes 3 minutes, the Asterisk will stay on that point for 3
minutes and return only to hangup.<br>
<br>
Also, I tested using Asterisk 1.4.14 and this problem doesn't happen. I saw
that 1.4.15 has a lot of changes on that function, to keep dtmf frames but I
couldn't figure out why these changes starts to cause the problem in 1.4.15
since that loop exists on both versions.<br>
<br>
Any idea?<br clear=all>
<br>
<i>Note: I used the Record() application because it has the same loop to wait
finish that my fax rx application has. I swapped them to be sure that it is not
only a problem in my application. <br>
</i><br>
-- <br>
--------------<br>
Paulo Garcia<o:p></o:p></p>

</div>

</body>

</html>