[asterisk-users] AEL2: If-then-else not permitted in Switch-Case

Philipp Kempgen philipp.kempgen at amooma.de
Wed Mar 4 04:33:03 CST 2009


Lee, John (Sydney) schrieb:
> I just want to confirm but it seems that if-then-else is not permitted
> in case structure.
> It was not really documented but it seems to be the case.
> 
> Can anyone confirm?
> 
> switch(${DIALSTATUS})
>       {
>         case NOANSWER:
>              {
>                // if-then-else not permitted
>                If (${ael-var} = 1)
>                    {
>                      Playback(beep); 
>                      return;
>                    }
>              }

I would have written this like so:

switch ("${DIALSTATUS}") {
	case "NOANSWER":
		if ("${ael-var}" = "1") {
			Playback(beep);
		}
		break;
}

Give it a try.


    Philipp Kempgen
-- 
AMOOCON 2009, May 4-5, Rostock / Germany   ->  http://www.amoocon.de
Asterisk: http://the-asterisk-book.com - http://das-asterisk-buch.de
AMOOMA GmbH - Bachstr. 126 - 56566 Neuwied  ->  http://www.amooma.de
Geschäftsführer: Stefan Wintermeyer, Handelsregister: Neuwied B14998
-- 



More information about the asterisk-users mailing list