Summary:ASTERISK-05211: [patch] Switch default case not working inside a Macro
Reporter:Russ Price (russ price)Labels:
Date Opened:2005-10-02 02:28:26Date Closed:2008-01-15 15:55:26.000-0600
Versions:Frequency of
Environment:Attachments:( 0) dialplan-bad.txt
( 1) dialplan-good.txt
( 2) extensions.ael
( 3) extensions-good.ael
( 4) pbx_ael.c-default-dash.diff
Description:As supplied, the std-exten-ael macro does not work properly if the call is not answered and ${DIALSTATUS} is anything other than BUSY. If it is CHANUNAVAIL or NOANSWER, for instance, it will silently fail and time out.

Console output when this happens (dialing into Zap FXO port, attempting to call an IAX extension that is not present):

   -- Executing Wait("Zap/1-1", "1") in new stack
   -- Executing DISA("Zap/1-1", "no-password|default") in new stack
   -- Executing Macro("Zap/1-1", "std-exten-ael|103|IAX2") in new stack
   -- Executing Set("Zap/1-1", "ext=103") in new stack
   -- Executing Set("Zap/1-1", "dev=IAX2") in new stack
   -- Executing Dial("Zap/1-1", "IAX2/103|20") in new stack
Oct  2 02:22:36 NOTICE[27277]: app_dial.c:1109 dial_exec_full: Unable to create channel of type 'IAX2' (cause 3 - No route to destination)
 == Everyone is busy/congested at this time (1:0/0/1)
   -- Executing Goto("Zap/1-1", "sw-std-exten-ael-4-CHANUNAVAIL|1") in new stack
   -- Goto (macro-std-exten-ael,sw-std-exten-ael-4-CHANUNAVAIL,1)
   -- Timeout on Zap/1-1
 == CDR updated on Zap/1-1
   -- Executing Hangup("Zap/1-1", "") in new stack
 == Spawn extension (default, t, 1) exited non-zero on 'Zap/1-1'
   -- Hungup 'Zap/1-1'

Workaround: don't use a default condition. Include a condition for each and every possibility.
Comments:By: Russ Price (russ price) 2005-10-02 02:29:15

OOPS - this should be filed under AEL, not ACD

By: Tilghman Lesher (tilghman) 2005-10-02 09:45:25

Please upload a text file containing the output of "show dialplan" and your extensions.ael.

By: Russ Price (russ price) 2005-10-02 19:46:44

The first extensions.ael file contains the default case which fails; extensions-good.ael has cases for all of the results from Dial().

I have also provided dialplan output for both versions of the extensions.ael file.

By: Tilghman Lesher (tilghman) 2005-10-02 23:29:55

It would appear that the exceptional case is that the default portion of a switch statement does not work inside a Macro.

By: Sergey Okhapkin (sokhapkin) 2005-11-06 09:47:47.000-0600

I solved the problem. The "default" case extension created by AEL must not have special pattern characters like -,N,Z,X etc. I'm attaching the diff which fixes the problem.

By: Sergey Okhapkin (sokhapkin) 2005-11-07 06:04:55.000-0600

I just found out that "-" characters are just ignored in both pattern and the string to match, I've updated the patch to use better readable "-" characters like before.

By: Tilghman Lesher (tilghman) 2005-11-09 17:40:12.000-0600

sokhapkin:  do you have a disclaimer on file?

By: Sergey Okhapkin (sokhapkin) 2005-11-09 17:44:35.000-0600

Yes I have.

By: Kevin P. Fleming (kpfleming) 2005-11-10 19:23:36.000-0600

Committed to CVS HEAD, thanks!

By: Digium Subversion (svnbot) 2008-01-15 15:55:26.000-0600

Repository: asterisk
Revision: 7060

U   trunk/ChangeLog
U   trunk/pbx/pbx_ael.c

r7060 | kpfleming | 2008-01-15 15:55:25 -0600 (Tue, 15 Jan 2008) | 2 lines

issue ASTERISK-5211