Timeout <NoofSeconds>
Jumps to ONTIMEOUT
label after specified number of seconds.
Parameters
<NoofSeconds>
Number of seconds after which the jump to ONTIMEOUT takes
place. If not specified, it defaults to -1 (Do not timeout at all).
Remarks
- Each time,
the Timeout is encountered in the script, the timeout value is reset
from that point on.
- The command is useful when we are doing any lengthy operations in the script where we want to stop it if it exceeds the time limit.
- Timeout
is active only during a call. The last timeout value encountered by the script
is used when a call becomes active.
- If Timeout
is not specified in the script, the script does not timeout at all.
Example
:MAIN
// cancel any previous timeout settings
timeout
// waiting for call
answer 1
;.........
;.........
;.........
;Please wait while we connect your call to United States
play "connect.wav"
;.....
;.....
$TalkTime = GetTalkTime()
; Your call has been connected to United States
; You have a talk time of (n) seconds
timeout $TalkTime
SoftInterconnect($sipchannel)
; Wait in an idle loop.
while true
sleepevent
endwhile
:ONTIMEOUT
log "Your talk time has been expired."
play "expired.wav"
play "goodbye.wav"
hangup
goto MAIN
function GetTalkTime()
;......
;......
$talk = $end - $start
return $talk