50. GotoIf()

Springt bedingt zu der angegebenen Priorität,

GotoIf(Bedingung?PrioWahr:PrioFalsch)

Schickt den Anruf ohne Möglichkeit der Rückkehr an die Priorität PrioWahr, falls die Bedingung wahr ist oder zu PrioFalsch, falls sie falsch ist. Entweder PrioWahr oder PrioFalsch können ausgelassen werden (dann wird ggf. mit der nächsten Priorität weitergemacht), aber nicht beide (und nicht der Doppelpunkt!).

Eine Priorität ist hier eines der Folgenden:

  • eine Priorität, z.B. 10
  • eine Extension und eine Priorität, z.B. 123,10
  • Context, Extension und Priorität, z.B. incoming,123,10
  • eine benannte Priorität innerhalb der gleichen Extension, z.B. ok
exten => 123,1,GotoIf($[ ${test} = 5 ]?ok:nein)
exten => 123,10(ok),Playback(tt-monkeys)
exten => 123,20(nein),Playback(tt-weasels)
[Anmerkung]Anmerkung

Interner Hilfetext zu dieser Applikation in Asterisk 1.4: 

  -= Info about application 'GotoIf' =- 

[Synopsis]
Conditional goto

[Description]
  GotoIf(condition?[labeliftrue]:[labeliffalse]): This application will cause
the calling channel to jump to the specified location in the dialplan based on
the evaluation of the given condition. The channel will continue at
'labeliftrue' if the condition is true, or 'labeliffalse' if the condition is
false. The labels are specified with the same syntax as used within the Goto
application.  If the label chosen by the condition is omitted, no jump is
performed, but execution continues with the next priority in the dialplan.

Differenz zum internen Hilfetext in Asterisk 1.2: 

- keine - 

Siehe auch. Abschnitt 49, „Goto(), Abschnitt 51, „GotoIfTime(), Abschnitt 47, „Gosub(), Abschnitt 48, „GosubIf(), Abschnitt 58, „Macro()


$Revision:473 $

Beta-Version!

2.0 Entwickler-Version des Asterisk Buches. Die 1.0 stabile Version ist natürlich noch online. Die 2.0er Version enthält viele Neuerungen, ist aber noch nicht 100% fehlerfrei. Im Zweifelsfall bitte auf die 1.0er Version gehen.

Bitte melden Sie Fehler und Feedback zur neuen 2.0er Version per E-Mail an den Autor.

Asterisk-Tag.org 2008

Auf der Asterisk-Tag.org Webseite finden Sie die Folien und Videos der Vorträge.

Werbung