WaitForCondition(replacementchar,expression[,timeout,interval])
Dialplan Builder
-- build your WaitForCondition() command
Specifies the character in the expression used to replace the `$` character. This character should not be used anywhere in the expression itself.
A modified logical expression with the `$` characters replaced by *replacementchar*. This is necessary to pass the expression itself into the application, rather than its initial evaluation.
The maximum amount of time, in seconds, this application should wait for a condition to become true before dialplan execution continues automatically to the next priority. By default, there is no timeout.
The frequency, in seconds, of polling the condition, which can be adjusted depending on how time-sensitive execution needs to be. By default, this is 0.05.
Full arguments reference
replacementcharrequired - Specifies the character in the expression used to replace the$character. This character should not be used anywhere in the expression itself.expressionrequired - A modified logical expression with the$characters replaced by replacementchar. This is necessary to pass the expression itself into the application, rather than its initial evaluation.timeout- The maximum amount of time, in seconds, this application should wait for a condition to become true before dialplan execution continues automatically to the next priority. By default, there is no timeout.interval- The frequency, in seconds, of polling the condition, which can be adjusted depending on how time-sensitive execution needs to be. By default, this is 0.05.
Description
Waits until expression evaluates to true, checking every interval seconds for up to timeout. Default is evaluate expression every 50 milliseconds with no timeout.
Wait for condition dialplan variable/function to become 1 for up to 40 seconds, checking every 500ms
same => n,WaitForCondition(#,#["#{condition}"="1"],40,0.5)
Sets WAITFORCONDITIONSTATUS to one of the following values:
- WAITFORCONDITIONSTATUS
TRUE- Condition evaluated to true before timeout expired.FAILURE- Invalid argument.TIMEOUT- Timeout elapsed without condition evaluating to true.HANGUP- Channel hung up before condition became true.
Arguments
replacementcharrequired - Specifies the character in the expression used to replace the$character. This character should not be used anywhere in the expression itself.expressionrequired - A modified logical expression with the$characters replaced by replacementchar. This is necessary to pass the expression itself into the application, rather than its initial evaluation.timeout- The maximum amount of time, in seconds, this application should wait for a condition to become true before dialplan execution continues automatically to the next priority. By default, there is no timeout.interval- The frequency, in seconds, of polling the condition, which can be adjusted depending on how time-sensitive execution needs to be. By default, this is 0.05.
User Notes
Know a tip or gotcha for this topic? Share it below and help others.
Contribute a note
Share a tip, gotcha, or practical example. Keep it under 2000 characters. No questions (use the Asterisk community forums for support). Wrap code in backticks.
Related
Applications
ConfBridge()
MusicOnHold()
StartMusicOnHold()
StopMixMonitor()
ADSIProg()
AELSub()
AGI()
AMD()
AddQueueMember()
AgentLogin()
AgentRequest()
AlarmReceiver()
Answer()
AttendedTransfer()
AudioSocket()
Authenticate()
Background()
BackgroundDetect()
BlindTransfer()
Bridge()
BridgeAdd()
BridgeWait()
Broadcast()
Busy()
CELGenUserEvent()
CallCompletionCancel()
CallCompletionRequest()
ChanIsAvail()
ChanSpy()
ChangeMonitor()
ChannelRedirect()
ClearHash()
ConfKick()
Congestion()
ContinueWhile()
ControlPlayback()
DAHDIAcceptR2Call()
DAHDIRAS()
DAHDIScan()
DAHDISendCallreroutingFacility()
DAHDISendKeypadFacility()
DBdeltree()
DISA()
DateTime()
DeadAGI()
Dial()
Dictate()
Directory()
DumpChan()
EAGI()
Echo()
Else()
ElseIf()
EndIf()
EndWhile()
Exec()
ExecIf()
ExecIfTime()
ExitIf()
ExitWhile()
ExtenSpy()
ExternalIVR()
Festival()
Flash()
FollowMe()
ForkCDR()
GetCPEID()
Gosub()
GosubIf()
Goto()
GotoIf()
GotoIfTime()
Hangup()
HangupCauseClear()
IAX2Provision()
ICES()
IVRDemo()
If()
ImportVar()
Incomplete()
JACK()
JabberJoin()
JabberLeave()
JabberSend()
JabberSendGroup()
JabberStatus()
Log()
MP3Player()
MSet()
Macro()
MacroExclusive()
MacroExit()
MacroIf()
MailboxExists()
MeetMe()
MeetMeAdmin()
MeetMeChannelAdmin()
MeetMeCount()
MessageSend()
Milliwatt()
MinivmAccMess()
MinivmDelete()
MinivmGreet()
MinivmMWI()
MinivmNotify()
MinivmRecord()
MixMonitor()
Monitor()
Morsecode()
NBScat()
NoCDR()
NoOp()
ODBCFinish()
ODBC_Commit()
ODBC_Rollback()
OSPAuth()
OSPFinish()
OSPLookup()
OSPNext()
Originate()
PJSIPHangup()
PJSIPNotify()
Page()
Park()
ParkAndAnnounce()
ParkedCall()
PauseMonitor()
PauseQueueMember()
Pickup()
PickupChan()
PlayTones()
Playback()
PrivacyManager()
Proceeding()
Progress()
Queue()
QueueLog()
QueueUpdate()
RaiseException()
Read()
ReadExten()
ReceiveFAX()
ReceiveMF()
ReceiveSF()
ReceiveText()
Record()
Reload()
RemoveQueueMember()
ResetCDR()
RetryDial()
Return()
Ringing()
SIPAddHeader()
SIPDtmfMode()
SIPRemoveHeader()
SIPSendCustomINFO()
SLAStation()
SLATrunk()
SMS()
SayAlpha()
SayAlphaCase()
SayCountedAdj()
SayCountedNoun()
SayDigits()
SayMoney()
SayNumber()
SayOrdinal()
SayPhonetic()
SayUnixTime()
SendDTMF()
SendFAX()
SendImage()
SendMF()
SendSF()
SendText()
SendURL()
Set()
SetAMAFlags()
Signal()
SkelGuessNumber()
SoftHangup()
SpeechActivateGrammar()
SpeechBackground()
SpeechCreate()
SpeechDeactivateGrammar()
SpeechDestroy()
SpeechLoadGrammar()
SpeechProcessingSound()
SpeechStart()
SpeechUnloadGrammar()
StackPop()
Stasis()
StatsD()
StopMonitor()
StopMusicOnHold()
StopPlayTones()
StoreDTMF()
StreamEcho()
System()
TestClient()
TestServer()
ToneScan()
Transfer()
TryExec()
TrySystem()
UnpauseMonitor()
UnpauseQueueMember()
UserEvent()
VMAuthenticate()
VMSayName()
Verbose()
VoiceMail()
VoiceMailMain()
VoiceMailPlayMsg()
Wait()
WaitDigit()
WaitExten()
WaitForCondition()
WaitForNoise()
WaitForRing()
WaitForSignal()
WaitForSilence()
WaitForTone()
WaitUntil()
While()
Zapateller()