Tropo Scripting Development Guide Home  |  Frameset Home


hangup  event


This event is returned when the user disconnects or "hangs up" the call.


usage

hangup( , {anonymous function: STRING } )


attributes

none


code samples

JavaScript example
event=ask("Who would you like to call?  Just say John or Jane", {
    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.");
    },
    onTimeout:function(event) {
        say("I'm sorry, I didn't hear anything.");
    },
    onHangup: function(event) {
        log("Caller disconnected");
    }
});


Ruby example
event=ask "Who would you like to call?  Just say John or Jane", {
    :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."},
    :onTimeout => lambda { |event| 
        say "I'm sorry, I didn't hear anything"},
    :onHangup => lambda { |event|
        log "Caller disconnected"}
    }




PHP example
<?php
ask("Who would you like to call?  Just say John or Jane", array(
    "choices"=>"john, jane",
    "onChoice" => "choiceFCN" ,
    "onBadChoice" => "badChoiceFCN",
    "onTimeout" => "timeoutFCN",
    "onHangup" => "hangupFCN"
    )
);
function choiceFCN($event) {
    say("You said" . $event->value);
}
function badChoiceFCN($event) {
    say("I'm sorry, I didn't understand what you said.");
}
function timeoutFCN($event) {
    say("I'm sorry, I didn't hear anything");
}
function hangupFCN ($event) {
    log("Caller disconnected.");
}   
?>





Python example
ask("Who would you like to call?  Just say John or Jane", {
    "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."),
    "onTimeout": lambda event : say("I'm sorry, I didn't hear anything"),
    "onHangup": lambda event : log("Caller disconnected")
})






Groovy example
ask("Who would you like to call?  Just say John or Jane", [
    choices: "john, jane",
    onChoice: { event->
        say("You said" + event.value)},
    onBadChoice: { event->
        say("I'm sorry, I didn't understand what you said")},
    onTimeout: { event->
        say("I'm sorry, I didn't understand what you said")},
    onHangup: { event ->
        log("Caller disconnected")
    ])





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