<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="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 11 (filtered medium)">
<!--[if !mso]>
<style>
v\:* {behavior:url(#default#VML);}
o\:* {behavior:url(#default#VML);}
w\:* {behavior:url(#default#VML);}
.shape {behavior:url(#default#VML);}
</style>
<![endif]-->
<title>Asterisk Manager Problem</title>
<style>
<!--
 /* Font Definitions */
 @font-face
        {font-family:Wingdings;
        panose-1:5 0 0 0 0 0 0 0 0 0;}
@font-face
        {font-family:Tahoma;
        panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;}
 /* Style Definitions */
 p.MsoNormal, li.MsoNormal, div.MsoNormal
        {margin:0in;
        margin-bottom:.0001pt;
        font-size:12.0pt;
        font-family:"Times New Roman";}
a:link, span.MsoHyperlink
        {color:blue;
        text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
        {color:purple;
        text-decoration:underline;}
p
        {mso-margin-top-alt:auto;
        margin-right:0in;
        mso-margin-bottom-alt:auto;
        margin-left:0in;
        font-size:12.0pt;
        font-family:"Times New Roman";}
span.EmailStyle18
        {mso-style-type:personal-reply;
        font-family:Arial;
        color:navy;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.25in 1.0in 1.25in;}
div.Section1
        {page:Section1;}
 /* List Definitions */
 @list l0
        {mso-list-id:368647930;
        mso-list-template-ids:203455206;}
@list l0:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
@list l0:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:1.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:"Courier New";
        mso-bidi-font-family:"Times New Roman";}
@list l1
        {mso-list-id:582377144;
        mso-list-template-ids:129147216;}
@list l1:level1
        {mso-level-number-format:bullet;
        mso-level-text:\F0B7;
        mso-level-tab-stop:.5in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:Symbol;}
@list l1:level2
        {mso-level-number-format:bullet;
        mso-level-text:o;
        mso-level-tab-stop:1.0in;
        mso-level-number-position:left;
        text-indent:-.25in;
        mso-ansi-font-size:10.0pt;
        font-family:"Courier New";
        mso-bidi-font-family:"Times New Roman";}
ol
        {margin-bottom:0in;}
ul
        {margin-bottom:0in;}
-->
</style>

</head>

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

<div class=Section1>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<p class=MsoNormal><font size=2 color=navy face=Arial><span style='font-size:
10.0pt;font-family:Arial;color:navy'><o:p>&nbsp;</o:p></span></font></p>

<div>

<div class=MsoNormal align=center style='text-align:center'><font size=3
face="Times New Roman"><span style='font-size:12.0pt'>

<hr size=2 width="100%" align=center tabindex=-1>

</span></font></div>

<p class=MsoNormal><b><font size=2 face=Tahoma><span style='font-size:10.0pt;
font-family:Tahoma;font-weight:bold'>From:</span></font></b><font size=2
face=Tahoma><span style='font-size:10.0pt;font-family:Tahoma'>
asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] <b><span style='font-weight:
bold'>On Behalf Of </span></b>Deric Page<br>
<b><span style='font-weight:bold'>Sent:</span></b> Thursday, July 15, 2010 2:24
PM<br>
<b><span style='font-weight:bold'>To:</span></b>
asterisk-users@lists.digium.com<br>
<b><span style='font-weight:bold'>Subject:</span></b> [asterisk-users] Asterisk
Manager Problem</span></font><o:p></o:p></p>

</div>

<p class=MsoNormal><font size=3 face="Times New Roman"><span style='font-size:
12.0pt'><o:p>&nbsp;</o:p></span></font></p>

<p><font size=3 face=Calibri><span style='font-size:12.0pt;font-family:Calibri'>I
am</span></font> <font face=Calibri><span style='font-family:Calibri'>originating
a call to a Local channel using an Originate Action:</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>Action: Originate</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>Channel: Local/dial@outdial</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>Context: outdial</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>Exten: answer</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>Priority: 1</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>Timeout: 45000</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>ActionID: some_id</span></font><o:p></o:p></p>

<p><font size=3 face=Calibri><span style='font-size:12.0pt;font-family:Calibri'>In
my dialplan, I have this:</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>[outdial]</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>exten =&gt; dial,1,Dial(${DIAL_STRING},
${DIAL_TIMEOUT})</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>exten =&gt; dial,n,NoOp(Dial Status =
${DIALSTATUS})</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>exten =&gt; dial,n,Agi(agi://localhost/Outdial.agi,
${DIAL_STRING})</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>exten =&gt; dial,n,Hangup()</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>exten =&gt; answer,1,NoOp(Dial Status =
${DIALSTATUS})</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>exten =&gt; answer,n,Playback(${GREETING_NAME})</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>exten =&gt; answer,n,WaitForSilence(2000)</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>exten =&gt;
answer,n,Agi(agi://localhost/Outdial.agi)</span></font><o:p></o:p></p>

<p style='margin-left:1.0in'><font size=3 face=Calibri><span style='font-size:
12.0pt;font-family:Calibri'>exten =&gt; answer,n,Hangup()</span></font><o:p></o:p></p>

<p><font size=3 face=Calibri><span style='font-size:12.0pt;font-family:Calibri'>Everything
seems to work fine so long as the Dial command executes successfully.&nbsp;</span></font>
<font face=Calibri><span style='font-family:Calibri'>For example, if someone
picks up the other end after the Dial command completes, processing jumps to
the</span></font> <font face=Calibri><span style='font-family:Calibri'>&#8220;answer&#8221;
extension as expected.&nbsp; If no one ever answers and the Dial command times
out,</span></font> <font face=Calibri><span style='font-family:Calibri'>processing
continues on with the next priority of the</span></font> <font face=Calibri><span
style='font-family:Calibri'>&#8220;dial&#8221; extension, again as expected.</span></font><o:p></o:p></p>

<p><font size=3 face=Calibri><span style='font-size:12.0pt;font-family:Calibri'>However,
if someone sets a bad DIAL_STRING (such as using a channel that doesn&#8217;t
exist), things start to behave oddly.&nbsp; It continues on in the next
priority of the</span></font> <font face=Calibri><span style='font-family:Calibri'>&#8220;dial&#8221;</span></font>
<font face=Calibri><span style='font-family:Calibri'>extension (as I would
expect).&nbsp; However, as soon as it executes the call to the AGI script, it
also starts processing the</span></font> <font face=Calibri><span
style='font-family:Calibri'>&#8220;answer&#8221; extension at the same
time.&nbsp;</span></font> <font face=Calibri><span style='font-family:Calibri'>As
a result, I end up with two calls into my AGI script.&nbsp;</span></font> <font
face=Calibri><span style='font-family:Calibri'>Unfortunately, I don&#8217;t
know what I&#8217;m doing wrong here.</span></font><o:p></o:p></p>

<p><font size=3 face=Calibri><span style='font-size:12.0pt;font-family:Calibri'>Thanks,</span></font><o:p></o:p></p>

<p><font size=3 face=Calibri><span style='font-size:12.0pt;font-family:Calibri'>Deric
Page</span></font><o:p></o:p></p>

<p><font size=3 face=Calibri><span style='font-size:12.0pt;font-family:Calibri'>--
<o:p></o:p></span></font></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>-- probably not the answer, but you could add these lines to
the bottom of [outdial]<o:p></o:p></span></font></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Exten =&gt; *,1,hangup<o:p></o:p></span></font></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Exten =&gt; t,1,hangup<o:p></o:p></span></font></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>Exten =&gt; i,1,hangup<o:p></o:p></span></font></p>

<p><font size=2 color=navy face=Arial><span style='font-size:10.0pt;font-family:
Arial;color:navy'>This would hang-up any call that had an invalid number or did
not dial correctly.<o:p></o:p></span></font></p>

<p><font size=3 face=Calibri><span style='font-size:12.0pt;font-family:Calibri'>deric.page@nisc.coop</span></font><o:p></o:p></p>

</div>

</body>

</html>