{"on":} object

This determines the events to be handled. Possible events are: "continue", "error", "incomplete" and "hangup", except when used with a transfer, in which case the possible event is 'ring', or when used with a signal, in which case the event can be the name of an assigned signal.

Fields

event
Data Type: 
String
Default: 
undefined
Required

This defines which event the on action handles. The core values are "continue", "incomplete", "error" and "hangup", except when used within a transfer, in which case the possible event is 'ring'. Continue will fire if the resource's actions were successful (such as a valid choice) or if no other events are defined. Incomplete fires when the resource's actions were unsuccessful, such as a timeout or call failure. Error will fire if something went wrong at the server level, and hangup will fire when the user disconnects the call.

If used with a signal, in which case the event can be the name of an assigned signal.

next
Data Type: 
String
Default: 
undefined
Optional

When an associated event occurs, Tropo will post to the URL defined here. If an event has no handler, then the "continue" event is fired. If an event has a handler but that handler does not have a URL specified (for example, it has a 'say' verb instead), then that handler is processed and then the "continue" event is fired.

If the continue event handler is not present or if it is present but has no URL, then the call is hung up and the "hangup" event is fired.

say
Data Type: 
Object
Default: 
undefined
Required

This determines what is played or sent to the caller. This can be a single object or an array of objects.

Examples

Example showing triggers for each event

{
   "tropo":[
      {
         "on":{
            "event":"continue",
            "next":"/continue.json"
         }
      },
      {
         "on":{
            "event":"error",
            "next":"/error.json"
         }
      },
      {
         "on":{
            "event":"hangup",
            "next":"/hangup.json"
         }
      },
      {
         "on":{
            "event":"incomplete",
            "next":"/incomplete.json"
         }
      },
      {
         "ask":{
            "say":[
               {
                  "value":"Welcome to Tropo.  What's your birth year?"
               }
            ],
            "name":"year",
            "required":true,
            "choices":{
               "value":"[4 DIGITS]"
            }
         }
      }
   ]
}

Example showing use of "on" with a signal

{
   "tropo":[
      {
         "on":{
            "event":"exit",
            "next":"exit-say.json"
         }
      },
      {
         "say":{
            "value":"http://phono.com/audio/holdmusic.mp3",
            "allowSignals":"exit"
         }
      }
   ]
}

Example showing the inclusion of voice for the on continue event

{
   "tropo":[
      {
         "on":{
            "event":"continue",
            "next":"continue.json",
            "say":[
               {
                  "value":"Nice answer!",
                  "voice":"Victor"
               }
            ]
         },
         "ask":{
            "say":[
               {
                  "value":"Welcome to Tropo.  What's your birth year?"
               }
            ],
            "voice":"Victor",
            "name":"year",
            "required":true,
            "choices":{
               "value":"[4 DIGITS]"
            }
         }
      }
   ]
}