C.66. 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 (siehe Expression) wahr ist, oder zu PrioFalsch, falls sie falsch ist. Sie können entweder PrioWahr oder PrioFalsch auslassen (dann wird ggf. mit der nächsten Priorität weitergemacht), aber nicht beide (und nicht den Doppelpunkt!).
Eine Priorität ist hier einer der folgenden Parameter:
  • 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)
Asterisk-Versionen:
————————| 1.2 |————————| 1.4 |————————| 1.6 |————————
Interner Hilfetext zu dieser Applikation in Asterisk 1.4:
  -= Info about application 'GotoIf' =-

[Synopsis]
Conditional goto

[Description]
  GotoIf(condition?[labeliftrue]:[labeliffalse]): This application will set the current
context, extension, and priority in the channel structure based on the evaluation of
the given condition. After this application completes, the
pbx engine will continue dialplan execution at the specified location in the dialplan.
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, and the execution passes to the next instruction.
If the target location is bogus, and does not exist, the execution engine will try
to find and execute the code in the 'i' (invalid)
extension in the current context. If that does not exist, it will try to execute the
'h' extension. If either or neither the 'h' or 'i' extensions have been defined, the
channel is hung up, and the execution of instructions on the channel is terminated.
Remember that this command can set the current context, and if the context specified
does not exist, then it will not be able to find any 'h' or 'i' extensions there, and
the channel and call will both be terminated!
Differenz des internen Hilfetexts von Asterisk 1.2 zu 1.4:
--- in Asterisk 1.2
+++ in Asterisk 1.4
@@ -19,5 +19,5 @@
   'h' extension. If either or neither the 'h' or 'i' extensions have been defined, the
   channel is hung up, and the execution of instructions on the channel is terminated.
   Remember that this command can set the current context, and if the context specified
-  does not exist, then it will not be able to find any 'h' or 'i' extensions there,
-  and the channel and call will both be terminated!
+  does not exist, then it will not be able to find any 'h' or 'i' extensions there, and
+  the channel and call will both be terminated!
Differenz des internen Hilfetexts von Asterisk 1.4 zu 1.6:
— keine —