Lee, John (Sydney)
2009-Mar-04 00:20 UTC
[asterisk-users] AEL2: If-then-else not permitted in Switch-Case
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; } } case BUSY: { return; } default: { Hangup(); }; }
Philipp Kempgen
2009-Mar-04 10:33 UTC
[asterisk-users] AEL2: If-then-else not permitted in Switch-Case
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 --
Klaus Darilion
2009-Mar-04 13:02 UTC
[asterisk-users] AEL2: If-then-else not permitted in Switch-Case
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)^^ case sensitive?> { > Playback(beep); > return; > } > } > case BUSY: > { > return; > } > default: > { > Hangup(); > }; > } > > > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users
Philipp Kempgen
2009-Mar-04 14:10 UTC
[asterisk-users] AEL2: If-then-else not permitted in Switch-Case
Klaus Darilion schrieb:> 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: >> {^ no code block required here. probably invalid syntax.>> // if-then-else not permitted >> If (${ael-var} = 1) > > ^^ case sensitive? > >> { >> Playback(beep); >> return; >> } >> } >> case BUSY: >> { >> return; >> } >> default: >> { >> Hangup(); >> }; >> }Try `aelparse -n` 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 --
Watkins, Bradley
2009-Mar-04 22:12 UTC
[asterisk-users] AEL2: If-then-else not permitted in Switch-Case
> 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?No, if-then-else works fine inside a case statement. See inline comments.> > switch(${DIALSTATUS}) > { > case NOANSWER: > {This brace, and its closing-brace mate, are superfluous though not harmful.> // if-then-else not permitted > If (${ael-var} = 1)Your primary problem is probably right here, the if needs to be all lower-case ( If != if ).> { > Playback(beep); > return; > } > }Again, unnecessary.> case BUSY: > { > return; > } > default: > { > Hangup(); > }; > } > > > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > >
Lee, John (Sydney)
2009-Mar-04 22:59 UTC
[asterisk-users] AEL2: If-then-else not permitted in Switch-Case
Thanks guys. It was the If vs if that was causing the problem. This is probably due to my good coding practice of other languages in the past :-)> -----Original Message----- > From: asterisk-users-bounces at lists.digium.com [mailto:asterisk-users- > bounces at lists.digium.com] On Behalf Of Watkins, Bradley > Sent: Thursday, 5 March 2009 9:12 AM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: Re: [asterisk-users] AEL2: If-then-else not permitted inSwitch-> Case > > > I just want to confirm but it seems that if-then-else is notpermitted> > in case structure. > > It was not really documented but it seems to be the case. > > > > Can anyone confirm? > > No, if-then-else works fine inside a case statement. See inline > comments. > > > > switch(${DIALSTATUS}) > > { > > case NOANSWER: > > { > This brace, and its closing-brace mate, are superfluous though not > harmful. > > > // if-then-else not permitted > > If (${ael-var} = 1) > Your primary problem is probably right here, the if needs to be all > lower-case ( If != if ). > > > { > > Playback(beep); > > return; > > } > > } > Again, unnecessary. > > > case BUSY: > > { > > return; > > } > > default: > > { > > Hangup(); > > }; > > } > > > > > > > > _______________________________________________ > > -- Bandwidth and Colocation Provided by http://www.api-digital.com--> > > > asterisk-users mailing list > > To UNSUBSCRIBE or update options visit: > > http://lists.digium.com/mailman/listinfo/asterisk-users > > > > > > _______________________________________________ > -- Bandwidth and Colocation Provided by http://www.api-digital.com -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users