Tropo Scripting Development Guide Home  |  Frameset Home


timeout  event


This event is returned when the user did not respond within a specified period of time, defined by the 'timeout' parameter.


usage

timeout( , {anonymous function: STRING } )


attributes

none


code samples

JavaScript example
answer();
event=ask("Who would you like to call?  Just say John or Jane", {
    attempts:3,
    timeout:7,
    choices:"john, jane",
    onChoice:function(event) {
        say("You said" + event.choice);
    },
    onBadChoice: function(event) { 
        say("I'm sorry, I didn't understand what you said.");
    },
    onError:function(event) { 
        log("There was an error");
    },
    onHangup:function(event) { 
        log("The user hungup");
    },
    onTimeout:function(event) {
         say("I'm sorry, I didn't hear anything.");
    }
});




Ruby example
answer
event=ask "Who would you like to call?  Just say John or Jane", {
    :attempts => 3,
    :timeout => 7,
    :choices => "john, jane",
    :onChoice => lambda { |event|
        say "You said" + event.value},
    :onBadChoice => lambda { |event| 
        say "I'm sorry, I didn't understand what you said."},
    :onError => lambda { |event|
        log "There was an error"},
    :onHangup => lambda { |event|
        log "The user hungup"},
    :onTimeout => lambda { |event| 
        say "I'm sorry, I didn't hear anything"}
    }





PHP example
<?php
answer();
ask("Who would you like to call?  Just say John or Jane", array(
    "attempts" => 3,
    "timeout" => 7,
    "choices"=>"john, jane",
    "onChoice" => "choiceFCN" ,
    "onBadChoice" => "badChoiceFCN",
    "onError" => "errorFCN",
    "onHangup" => "hangupFCN",
    "onTimeout" => "timeoutFCN"
    )
);
function choiceFCN($event) {
    say("You said" . $event->value);
}
function badChoiceFCN($event) {
    say("I'm sorry, I didn't understand what you said.");
}
function errorFCN($event) {
    log("There was an error");
}
function hangupFCN($event) {
    log("The user hungup");  
}
function timeoutFCN($event) {
    say("I'm sorry, I didn't hear anything");
}    
?>





Python example
answer()
ask("Who would you like to call?  Just say John or Jane", {
    "attempt":3,
    "timeout":7,
    "choices":"john, jane",
    "onChoice": lambda event : say("You said" + event.value),
    "onBadChoice": lambda event : say("I'm sorry, I didn't understand what you said."),
    "onError": lambda event : log("There was an error"),
    "onHangup": lambda event : log("The user hungup"),
    "onTimeout": lambda event : say("I'm sorry, I didn't hear anything")
})






Groovy example
answer()
ask("Who would you like to call?  Just say John or Jane", [
    attempts: 3,
    timeout: 7,
    choices: "john, jane",
    onChoice: { event->
        say("You said" + event.value)},
    onBadChoice: { event->
        say("I'm sorry, I didn't understand what you said")},
    onError: { event->
        log("There was an error")},
    onHangup: { event->
        log("The user hungup")},
    onTimeout: { event->
        say("I'm sorry, I didn't understand what you said")}
    ])




additional links

none


  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login



© 2012 Voxeo Corporation  |  Voxeo IVR  |  VoiceXML & CCXML IVR Developer Site