Tropo is part of CiscoLearn More

wait

The wait function suspends the script's current thread of execution for the specified length of time, or until the active session changes state (such as a user hanging up), whichever occurs first. Note that in the absence of an active session, the wait function is no different than a typical sleep statement against the current thread.

Since Tropo is synchronous, wait is a blocking method. This means no other method can run until wait is complete.

Note
This function is called await() in Groovy to avoid a conflict with Groovy's built-in Wait function

Parameters

milliseconds

Integer
(Required)
Default: 
0

This defines the time to wait for a state change. Defaults to 0ms if the parameter is skipped.

Map Parameters

allowSignals

String or Array
Default: 
* (any signal)

This parameter allows you to assign a signal to this function. Events from the Tropo REST API with a matching signal name will "interrupt" the function (i.e., stop it from running). If it already ran and completed, your interrupt request will be ignored. If the function has not run yet, the interrupt will be queued until it does run.

By default, allowSignals will accept any signal as valid; if you define allowSignals as an empty string (""), it defines the function as "uninterruptible". You can also use an array - the function will stop if it receives an interrupt signal matching any of the names in the array.

onSignal

Function

This specifies a callback function to run if the function is interrupted by a signal. Review documentation on sending interrupts here.

Examples

  answer();
wait(3000);
record("Please leave your message at the beep", {
    beep: true,
    timeout: 10});  
answer
wait(3000)
record "Please leave your message at the beep", {
    :beep => true,
    :timeout => 10}
<?php
 
answer();
wait(3000);
record("Please leave your message at the beep", array(
    "beep" => true,
    "timeout" => 10)
);
 
?>
answer()
wait(3000)
record("Please leave your message at the beep", {
    "beep": True,
    "timeout": 10})
answer()
await(3000)
record ("Please leave your message at the beep", {
    beep : true,
    timeout : 10})