Tropo is part of CiscoLearn More

Interrupting Your Code - One Signal

Say you want to play some hold music, then interrupt it later. In order to interrupt, you would give a the say that's playing the hold music a signal using the allowSignals parameter. You can then make a web service call using that name and Tropo will stop running that function. If the function has already run and completed, your interrupt request will be ignored. If it has not run yet, it will be queued until the function runs.

With WebAPI, the route itself will be interrupted, meaning that the app wil either fire the "on continue" event, or it will redirect based on the signal itself (as defined here).

Note: transfer and conference must include the terminator parameter for signaling to work.

This example uses "exit" for allowSignals:

var sessionid = currentCall.sessionId;
log("The Session ID is " + sessionid);
say("http://www.phono.com/audio/holdmusic.mp3", {
    allowSignals: "exit"
});

say("You are now off hold.");
sessionid = $currentCall.sessionId
log "The Session ID is " + sessionid
say "http://www.phono.com/audio/holdmusic.mp3", {
    :allowSignals => "exit"}

say "You are now off hold."
<?php
$sessionid = $currentCall->sessionId;
log("The Session ID is " . $sessionid);
say("http://www.phono.com/audio/holdmusic.mp3", array(
    "allowSignals" => "exit"
));

say("You are now off hold.");
?>
sessionid = currentCall.sessionId
log("The Session ID is " + sessionid)
say("http://www.phono.com/audio/holdmusic.mp3", {
    "allowSignals": "exit"
})

say("You are now off hold.")
sessionid = currentCall.sessionId
log("The Session ID is " + sessionid)
say("http://www.phono.com/audio/holdmusic.mp3", [
    allowSignals: "exit"
])

say("You are now off hold.")

Now for the REST methods - both POST and GET are supported.

Request

    URL:

    https://api.tropo.com/1.0/sessions/<session-id>/signals

    Replace with the 16-byte GUID session ID that Tropo gives you in currentCall.sessionId. Adding log to the application (like we did in the above example) will report the sessionId in your debugger window, which is accessible at the bottom of any page on tropo.com:

    Method:

    POST or GET

    Headers:

    Only required when using POST:

    accept:application/json
    
    content-type:application/json
    accept:text/xml
    
    content-type:text/xml
    content-type:application/x-www-form-urlencoded

    Request Body:

    POST:

    {
       "signal":"exit"
    }
    <signal>
       <value>exit</value>
    </signal>
    value=exit

    GET:

    https://api.tropo.com/1.0/sessions/<session-id>/signals?action=signal&value=exit

Response