<br><br><div class="gmail_quote">On Sun, Mar 22, 2009 at 4:09 AM, Asterisk <span dir="ltr"><<a href="mailto:asterisk@solutionengineers.com">asterisk@solutionengineers.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
Hi List,<br>
<br>
I have a nice simple dialplan question for you.... Currently, I have<br>
definitions similar to the following in my extensions.conf file, to allow me<br>
to dial out using a variety of channels:<br>
<br>
; Direct dial (number starts with zero), use 0151 xxx xxxx:<br>
exten => _0.,1,Set(CALLERID(number)=0845xxxxxxx)<br>
exten => _0.,n,Dial(SIP/${EXTEN}@sipgate,90,t)<br>
exten => _0.,n,Playback(invalid) <br>
exten => _0.,n,Hangup[/code]<br>
<br>
(I've munged some of the numbers, hence the x's)<br>
<br>
Now, this works fine provided the person answers in 90 seconds or less: If<br>
not, I get "that option is invalid" announced, and it hangs up. I want to do<br>
this:<br>
<br>
If DIAL fails because the other party is engaged, I'd like Asterisk to<br>
automatically re-try the number, for as long as I've got the handset off the<br>
hook or until the other party starts ringing. As there'll be no ring tone,<br>
it'd be nice it it could play music until DIAL succeeds in getting a ring<br>
tone; at which point it makes "ring ring" noises (this will serve as my<br>
prompt that - hopefully - someone's going to answer soon).<br>
<br>
If DIAL fails because I got the number wrong, then a PLAYBACK to that effect<br>
would be useful... I can record my own soundfile if there isn't a standard<br>
one. By wrong, I mean the exchange would return number unavailable, rather<br>
than I get the wrong person!<br>
<br>
If DIAL fails after it's been ringing for ages (e.g. when calling the local<br>
Post Office sorting office, who only answer 1 in 5 calls), I'd like it to<br>
retry, ala the busy response.<br>
<br>
IF DIAL exits because the other party hung up, I'd want it to simply hang up<br>
on me like it does now. I suspect this is standard behaviour? But maybe it<br>
tries to read the invalid announce to a closed channel with my dialplan, I'm<br>
not sure.<br>
<br>
If the above can be achieved in extensions.conf, that's great, as I've not<br>
done any AEL... but if AEL (or AGI, even) is the only way, so be it...</blockquote><div><br>You can do it all three ways.<br> <br></div><div>In AEL, you'd do something like this <br><br>context internalexten <br>{<br>
_0. => {<br> Set(prevstatus=NOANSWER); /* set up a prevstatus */<br> Set(CALLERID(number)=0845xxxxxxx);<br> while("${prevstatus}" == "NOANSWER" || "${prevstatus}" == "BUSY")<br>
{<br> Dial(SIP/${EXTEN}@sipgate,90,tm); /* transfers and moh */<br> switch(${DIALSTATUS})<br> {<br> case CHANUNAVAIL:<br> Playback(bad_num);<br>
hangup();<br> break;<br> case CONGESTION:<br> Playback(congested);<br> hangup();<br> break;<br>
case BUSY:<br> case NOANSWER:<br> break; /* BUSY will fall thru into NOANSWER */<br> default:<br> break;<br>
}<br> Set(prevstatus=${DIALSTATUS});<br> }<br> hangup();<br> }<br><meta http-equiv="Content-Type" content="text/html; charset=utf-8"><meta name="ProgId" content="Word.Document"><meta name="Generator" content="Microsoft Word 12"><meta name="Originator" content="Microsoft Word 12"><link rel="File-List" href="file:///C:%5CUsers%5Cmurf%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_filelist.xml"><link rel="themeData" href="file:///C:%5CUsers%5Cmurf%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_themedata.thmx"><link rel="colorSchemeMapping" href="file:///C:%5CUsers%5Cmurf%5CAppData%5CLocal%5CTemp%5Cmsohtmlclip1%5C01%5Cclip_colorschememapping.xml"><style>
<!--
/* Font Definitions */
@font-face
        {font-family:"Cambria Math";
        panose-1:2 4 5 3 5 4 6 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:roman;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1107304683 0 0 159 0;}
@font-face
        {font-family:Calibri;
        panose-1:2 15 5 2 2 2 4 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:swiss;
        mso-font-pitch:variable;
        mso-font-signature:-1610611985 1073750139 0 0 159 0;}
@font-face
        {font-family:Consolas;
        panose-1:2 11 6 9 2 2 4 3 2 4;
        mso-font-charset:0;
        mso-generic-font-family:modern;
        mso-font-pitch:fixed;
        mso-font-signature:-1610611985 1073750091 0 0 159 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
        {mso-style-unhide:no;
        mso-style-qformat:yes;
        mso-style-parent:"";
        margin-top:0in;
        margin-right:0in;
        margin-bottom:10.0pt;
        margin-left:0in;
        line-height:115%;
        mso-pagination:widow-orphan;
        font-size:11.0pt;
        font-family:"Calibri","sans-serif";
        mso-ascii-font-family:Calibri;
        mso-ascii-theme-font:minor-latin;
        mso-fareast-font-family:Calibri;
        mso-fareast-theme-font:minor-latin;
        mso-hansi-font-family:Calibri;
        mso-hansi-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;}
p.MsoPlainText, li.MsoPlainText, div.MsoPlainText
        {mso-style-priority:99;
        mso-style-link:"Plain Text Char";
        margin:0in;
        margin-bottom:.0001pt;
        mso-pagination:widow-orphan;
        font-size:10.5pt;
        font-family:Consolas;
        mso-fareast-font-family:Calibri;
        mso-fareast-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;}
span.PlainTextChar
        {mso-style-name:"Plain Text Char";
        mso-style-priority:99;
        mso-style-unhide:no;
        mso-style-locked:yes;
        mso-style-link:"Plain Text";
        mso-ansi-font-size:10.5pt;
        mso-bidi-font-size:10.5pt;
        font-family:Consolas;
        mso-ascii-font-family:Consolas;
        mso-hansi-font-family:Consolas;}
.MsoChpDefault
        {mso-style-type:export-only;
        mso-default-props:yes;
        mso-ascii-font-family:Calibri;
        mso-ascii-theme-font:minor-latin;
        mso-fareast-font-family:Calibri;
        mso-fareast-theme-font:minor-latin;
        mso-hansi-font-family:Calibri;
        mso-hansi-theme-font:minor-latin;
        mso-bidi-font-family:"Times New Roman";
        mso-bidi-theme-font:minor-bidi;}
.MsoPapDefault
        {mso-style-type:export-only;
        margin-bottom:10.0pt;
        line-height:115%;}
@page Section1
        {size:8.5in 11.0in;
        margin:1.0in 1.0in 1.0in 1.0in;
        mso-header-margin:.5in;
        mso-footer-margin:.5in;
        mso-paper-source:0;}
div.Section1
        {page:Section1;}
-->
</style>
}<br><br>The above code should (I haven't tested it or anything) give you most of the behavior you<br>specified, but it will play MOH up to the time someone answers. No ringing/moh mixture...<br>Dial doesn't do that. You may have to correct some typos, etc. that I've made above!<br>
<br>A hangup from the remote end will end the Dial app, and the result should be ANSWER,<br>which should drop you out of the loop and end the call.<br><br>Also, a hangup from the dialing exten should just terminate the dialplan execution.<br>
<br>I might note that the above code should be easier to read than the equiv extenstions.conf<br>code! But, I guess I'm biased!<br><br>murf<br clear="all"><br></div></div><br>-- <br>Steve Murphy<br>ParseTree Corp<br>
<br>