Tropo WebAPI Development Guide Home  |  Frameset Home

JSON Object Summary

Objects Fields
ask choices, allowSignals, attempts, bargein, interdigitTimeout, minConfidence, name, recognizer, required, say, timeout, voice
call to, allowSignals, answerOnMedia, channel, from, headers, name, network, recording, required, timeout
conference id, allowSignals, interdigitTimeout, mute, name, playTones, required, terminator
hangup headers
message say, to, answerOnMedia, channel, from, name, network, required, timeout, voice
on event, next, say
record attempts, allowSignals, bargein, beep, choices, say, format, maxSilence, maxTime, method, minConfidence, name, required, transcription, url, password, username, timeout, interdigitTimeout, voice
redirect to, name, required
reject none
result actions, callId, complete, error, sequence, sessionDuration, sessionId, state
say value, allowSignals, as, name, required, voice
session accountId, callId, from, headers, id, initialText, parameters, timestamp, to, userType
startRecording format, method, url, username, password
stopRecording none
transfer to, allowSignals, answerOnMedia, choices, from, headers, interdigitTimeout, name, on, required, ringRepeat, timeout
The choices object tells Tropo how to handle user input. It indicates the structure of the expected data, if any, and the various acceptable modes of input - some applications require just keypad input (dtmf), others are speech driven and some can accept both.

These are the properties for the choices object:

    value This is the grammar which determines the type of expected data. See the examples below for more detail.
    mode Only applies to the voice channel and can be either 'speech', 'dtmf', or 'any'.
    terminator This is the touch-tone key (also known as "DTMF digit") that indicates the end of input. A common use of the terminator is the # key, eg: "Please enter your five digit zip code, then press the pound key."

If you use a text channel, where voice recognition is not required, you can use the grammar [ANY] to return a successful match for any input. Using the [ANY] grammar on voice channels will fail, so don't do that.

Examples

Simple grammar that will return 'sales' or 'support' if recognized:

"choices": { "value": "sales, support" }

Simple grammar that will return 'sales' or 'support' if spoken or selected with keypad input:

"choices": { "value": "sales(1, sales), support(2, support)" }

Simple grammar for entering in digits only:

"choices": { "value": "[5 DIGITS]", "mode": "dtmf" }

This object also supports advanced grammars like GRXML and JSGF.
This parameter allows you to assign a signal to this function. Events from the Tropo REST API with a matching signal name will "interrupt" the function (i.e., stop it from running). If it already ran and completed, your interrupt request will be ignored. If the function has not run yet, the interrupt will be queued until it does run.

By default, allowSignals will accept any signal as valid; if you define allowSignals as "", it defines the function as "uninterruptible". You can also use an array - the function will stop if it receives an interrupt signal matching any of the names in the array.
This defines the total amount of times the user will hear the prompt before the ask ends in an "incomplete" event (i.e. the user provided incorrect input or no input at all).
The bargein attribute specifies whether or not the caller will be able to interrupt the TTS/audio output with a touch tone phone keypress or voice utterance. A value of 'true' indicates that the user is allowed to interrupt, while a value of 'false' forces the caller to listen to the entire prompt before being allowed to give input to the application.
With ask, interdigitTimeout defines how long to wait - in seconds - between key presses to determine the user has stopped entering input. This is useful to allow to help users restart the process if they mistyped, or to slim down the wait time experienced by the user if you need to get a variable amount of digits (enter you 4 or 5 digit pin code, for example).

If the interdigitTimeout is hit, it will trigger incomplete with the on event.
This is the minimum amount of confidence that the 'recognize' must have before matching a response to a choice. As an example, if your grammar defines the choices as red, blue and green, and someone says 'rud', a particular confidence will be set identifying how likely "rud" was meant to be "red". This is expressed as an Integer between 0-100.
This is the key used to identify the result of an operation, so you can differentiate between multiple results. As an example, if you asked the user for their favorite color, you could set the name value as 'color' while the returned value might be 'blue'. Not particularly useful if there's only one result returned, but if there are multiple results it helps to determine which result belonged to which operation.
Recognizer tells Tropo what language to listen for; the available options can be found here (there's quite a few).
This determines whether Tropo should move on to the next verb; if required is set to 'true', Tropo will only move on to the next verb if the current operation completely successfully.
This determines what is played or sent to the caller. This can be a single object or an array of objects. When say is a part of an ask, it takes an event key. This determines if the prompt will be played based on a particular event; the possible events are:

  • nomatch - Returned if the user did not say or input a valid response.
  • timeout - Returned if there was no user input in the allotted time.

Each of these event descriptors can also take an attempt value, based on the number of attempted input requests. For example, if you want to define a different say depending on the attempt, you would specify one say with the event 'nomatch:1' and a different say for the event 'nomatch:2'.
The amount of time - in seconds - that Tropo will wait for input. If the timeout is reached and the caller has not begun input, the URL specified in the incomplete handler will be called. The maximum value for this parameter is 2 hours.
Specifies the default voice to be used when speaking text back to a user.

A full list of all voices can be found here (there's many, many options).
Ask is essentially a say that requires input; it requests information from the caller and waits for a response.
The destination to make a call to or send a message to. This may currently take one of the following forms:

  • +14155551212 - The telephone number to dial with a '+' and country code. For US numbers, the country code can be omitted.
  • tel:+14155551212 - The telephone number with a tel: prefix
  • sip:username@doamin.com - The SIP URL to dial
  • username - The IM or Twitter user name.

Some IM networks like Google Talk and Live Messenger include a domain as part of the user name. For those networks, include the domain: username@gmail.com

When making a voice call, you can specify dialing options as part of the number:

  • postd - The DTMF digits to dial after the call has connected
  • pause - The amount of time to wait before issuing the digits after the call is connected
  • Example: "+14155551212;postd=1234pp56;pause=1000ms". This will dial 1234 one second after connecting to the phone number, pause for an additional 2 seconds (pp) and then dial 56

You can also list multiple phone numbers or SIP addresses (or both!) as an array for a voice call; whichever destination picks up first, wins.
This parameter allows you to assign a signal to this function. Events from the Tropo REST API with a matching signal name will "interrupt" the function (i.e., stop it from running). If it already ran and completed, your interrupt request will be ignored. If the function has not run yet, the interrupt will be queued until it does run.

By default, allowSignals will accept any signal as valid; if you define allowSignals as "", it defines the function as "uninterruptible". You can also use an array - the function will stop if it receives an interrupt signal matching any of the names in the array.
If this is set to true, the call will be considered "answered" and audio will begin playing as soon as media is received from the far end (ringing / busy signal / etc).
This defines the channel used to place new calls. For phone calls it is "VOICE", for SMS and instant messaging it is "TEXT".
If multiple contact methods for a given network are attached to an application, this field allows you to specify which one it comes from. For example, if you have two phone numbers, setting this field would allow you to specify the caller ID that appears to the recipient. For voice calls, this can be any valid phone number; for SMS it needs to be a number assigned to your account. For IM, there's no need to set a specific value for from - it will always need to match the IM account associated with your application, which is what Tropo uses by default anyways.
This contains the Session Initiation Protocol (SIP) Headers for the current session. This is advanced network information.
This is the key used to identify the result of an operation, so you can differentiate between multiple results. As an example, if you asked the user for their favorite color, you could set the name value as 'color' while the returned value might be 'blue'. Not particularly useful if there's only one result returned, but if there are multiple results it helps to determine which result belonged to which operation.
The name of the network being used for this session. For voice, this can be 'PSTN", "SIP", "SKYPE" or "INUM". For text, this can be "AIM", "GTALK", "JABBER", "MSN", "SMS", "TWITTER" or "YAHOO". Note that SKYPE is not a valid value for outbound calls, it will only display if you're recording the network for an inbound call.

Network is used mainly by the text channels; for IM network, you must have an IM account linked in your app. For example, if you try to send to AIM when you don't have an AIM username included in your app, your app will fail. TWITTER is a valid network, but as Twitter is currently only supported for inbound applications, it would not be used here.
This is a shortcut to allow you to start call recording as soon as the call is answered. This parameter is only useful on voice calls and is ignored on text channels. Review the included example below:

    {"tropo":[
          {
             "call":{
                "to":"+14075551212",
                "recording":{"url":"http://example.com/recording.php"}
             }
          },
          {
             "ask":{
                "say":{"value":"Please say your account number"},
                "choices":{"value":"[5 DIGITS]"}
             }
          }
       ]
    }

See startRecording for a complete list of properties.
This determines whether Tropo should move on to the next verb; if required is set to 'true', Tropo will only move on to the next verb if the current operation completely successfully.
The amount of time, in seconds, to wait for an answer before returning to the application. The maximum value for this parameter is 2 hours and it's recommended for outbound voice calls that this be set somewhere between 50-90 seconds. This ensures if one carrier cannot connect the call for whatever reason, there is time to try it on another carrier.
Initiates an outbound call or a text conversation. Note that this verb is only valid when there is no active WebAPI call and the maximum session time with Tropo is 2 hours, so the maximum time a call can be connected is also 2 hours.

For voice calls, destinations are specified using a URL format. Supported formats include:

  • tel: Phone Number - must be proceeded by a + and the country code (ie - +14155551212 for a US #)
  • sip: SIP protocol address

When this method is called:

  • A new call is initiated to the destination specified by the "to" parmeter.
  • If "from" is specified then it will be used as the callerId when making the call. Otherwise, the callerId will be "unknown".
  • If answerOnMedia is true, the audio from the new call is connected immediately.
  • The system waits for an answer or other event from the new call up to the specified timeout.
  • If the call successfully completes within the timeout the call action is considered complete and Tropo will continue to the next action.
  • If the call fails due to the timeout or network issue the call action is considered incomplete and the state of the call will be FAILED.

Additional dial options:

  • postd - The DTMF digits to dial after the call has connected
  • pause - The amount of time to wait before issuing the digits after the call is connected; this exists to allow for large values of time to be defined
  • p - Defines a one second pause
  • Example: "+14155551212;postd=1234pp56;pause=5s". This will dial 1234 five seconds after connecting to the phone number, pause for an additional 2 seconds (pp) and then dial 56. This example will do the same thing, though looks a little more complex: "+14155551212;postd=ppppp1234pp56" 'ms' is also supported, so you could define 5000ms instead of 5s.

For SMS and IM conversations, the "to" represents the SMS enabled phone number or IM username. Make sure you supply the appropriate network so Tropo knows how to route this message. While you can define multiple SMS destinations as an array, it won't break the application, only the first destination phone number will actually receive the text message. In order to send an SMS message, you must have a U.S. or Canadian phone number attached to the application.

Note that before you can send to non-U.S. destinations, both for voice and SMS, you need to contact support first to get international dialing enabled. This can be done via an account ticket or via support@voxeo.com.
This defines the id/name of the conference room to create.
This parameter allows you to assign a signal to this function. Events from the Tropo REST API with a matching signal name will "interrupt" the function (i.e., stop it from running). If it already ran and completed, your interrupt request will be ignored. If the function has not run yet, the interrupt will be queued until it does run.

By default, allowSignals will accept any signal as valid; if you define allowSignals as "", it defines the function as "uninterruptible". You can also use an array - the function will stop if it receives an interrupt signal matching any of the names in the array.
For conference, record and transfer, interdigitTimeout defines how long the user needs to wait - in seconds - before Tropo will recognize another key press. Essentially, this means if a user presses the wrong key to terminate the session (say * instead of #), how long do you want Tropo to wait before letting them try again.
Adds the user to the conference room with their audio muted.
This is the key used to identify the result of an operation, so you can differentiate between multiple results. As an example, if you asked the user for their favorite color, you could set the name value as 'color' while the returned value might be 'blue'. Not particularly useful if there's only one result returned, but if there are multiple results it helps to determine which result belonged to which operation.
This defines whether to send touch tone phone input to the conference or block the audio.
This determines whether Tropo should move on to the next verb; if required is set to 'true', Tropo will only move on to the next verb if the current operation completely successfully.
This is the touch-tone key (also known as "DTMF digit") used to exit the conference.
This object allows multiple lines in separate sessions to be conferenced together so that the parties on each line can talk to each other simultaneously.
This contains the Session Initiation Protocol (SIP) Headers for the current session. This is advanced network information.
This function instructs Tropo to "hang-up" or disconnect the session associated with the current session.
This determines what is played or sent to the caller. This can be a single object or an array of objects.
The destination to make a call to or send a message to. This may currently take one of the following forms:

  • +14155551212 - The telephone number to dial with a '+' and country code. For US numbers, the country code can be omitted.
  • tel:+14155551212 - The telephone number with a tel: prefix
  • sip:username@doamin.com - The SIP URL to dial
  • username - The IM or Twitter user name.

Some IM networks like Google Talk and Live Messenger include a domain as part of the user name. For those networks, include the domain: username@gmail.com

When making a voice call, you can specify dialing options as part of the number:

  • postd - The DTMF digits to dial after the call has connected
  • pause - The amount of time to wait before issuing the digits after the call is connected
  • Example: "+14155551212;postd=1234pp56;pause=1000ms". This will dial 1234 one second after connecting to the phone number, pause for an additional 2 seconds (pp) and then dial 56

You can also list multiple phone numbers or SIP addresses (or both!) as an array for a voice call; whichever destination picks up first, wins.
If this is set to true, the call will be considered "answered" and audio will begin playing as soon as media is received from the far end (ringing / busy signal / etc).
This defines the channel used to place new calls. For phone calls it is "VOICE", for SMS and instant messaging it is "TEXT".
If multiple contact methods for a given network are attached to an application, this field allows you to specify which one it comes from. For example, if you have two phone numbers, setting this field would allow you to specify the caller ID that appears to the recipient. For voice calls, this can be any valid phone number; for SMS it needs to be a number assigned to your account. For IM, there's no need to set a specific value for from - it will always need to match the IM account associated with your application, which is what Tropo uses by default anyways.
This is the key used to identify the result of an operation, so you can differentiate between multiple results. As an example, if you asked the user for their favorite color, you could set the name value as 'color' while the returned value might be 'blue'. Not particularly useful if there's only one result returned, but if there are multiple results it helps to determine which result belonged to which operation.
The name of the network being used for this session. For voice, this can be 'PSTN", "SIP", "SKYPE" or "INUM". For text, this can be "AIM", "GTALK", "JABBER", "MSN", "SMS", "TWITTER" or "YAHOO". Note that SKYPE is not a valid value for outbound calls, it will only display if you're recording the network for an inbound call.

Network is used mainly by the text channels; for IM network, you must have an IM account linked in your app. For example, if you try to send to AIM when you don't have an AIM username included in your app, your app will fail. TWITTER is a valid network, but as Twitter is currently only supported for inbound applications, it would not be used here.
This determines whether Tropo should move on to the next verb; if required is set to 'true', Tropo will only move on to the next verb if the current operation completely successfully.
This defines, in seconds, how long Tropo should wait for the other party to answer the call. If the timeout is reached and the call has not been answered, the URL specified in your incomplete event handler will be called. The maximum value for this parameter is 2 hours. It's recommended for outbound voice calls that this be set somewhere between 50-90 seconds. This ensures if one carrier cannot connect the call for whatever reason, there is time to try it on another carrier.
Specifies the default voice to be used when speaking text back to a user.

A full list of all voices can be found here (there's many, many options).
Creates a call, says something and then hangs up, all in one step.
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.
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.
This determines what is played or sent to the caller. This can be a single object or an array of objects.
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.
This defines the total amount of times the user will hear the prompt before the ask ends in an "incomplete" event (i.e. the user provided incorrect input or no input at all).
This parameter allows you to assign a signal to this function. Events from the Tropo REST API with a matching signal name will "interrupt" the function (i.e., stop it from running). If it already ran and completed, your interrupt request will be ignored. If the function has not run yet, the interrupt will be queued until it does run.

By default, allowSignals will accept any signal as valid; if you define allowSignals as "", it defines the function as "uninterruptible". You can also use an array - the function will stop if it receives an interrupt signal matching any of the names in the array.
The bargein attribute specifies whether or not the caller will be able to interrupt the TTS/audio output with a touch tone phone keypress or voice utterance. A value of 'true' indicates that the user is allowed to interrupt, while a value of 'false' forces the caller to listen to the entire prompt before being allowed to give input to the application.
When set to true, callers will hear a tone indicating the recording has begun.
When used with record, choices allows you to define a terminator. The terminator is the touch-tone key (also known as "DTMF digit") that will allow the caller to indicate their recording is complete. A common terminator would be the pound key (#).
This determines what is played or sent to the caller. This can be a single object or an array of objects. When say is a part of a record action, it can also take an event key. This determines if the prompt will be played based on a particular event; for record, the only possible event is 'timeout'.
This specifies the format for the audio recording; it can be 'audio/wav', 'audio/mp3' or 'audio/au'.
The maximum amount of time, in seconds, to wait for silence after a user stops speaking, to ensure they are not just pausing as they speak.
The maximum amount of time (in seconds) allowed for a recording. Defaults to 30 seconds, but may be set up to 2 hours in length (Tropo disconnects any session that exceeds 2 hours long, effectively reducing the recording to 2 hours as well).
When submitting recordings via HTTP, this parameter determines the method used. This can be 'POST' (which is the default) or 'PUT' . When sending via POST, the name of the form field is "filename".
This is the minimum amount of confidence that the 'recognize' must have before matching a response to a choice. As an example, if your grammar defines the choices as red, blue and green, and someone says 'rud', a particular confidence will be set identifying how likely "rud" was meant to be "red". This is expressed as an Integer between 0-100.
This is the key used to identify the result of an operation, so you can differentiate between multiple results. As an example, if you asked the user for their favorite color, you could set the name value as 'color' while the returned value might be 'blue'. Not particularly useful if there's only one result returned, but if there are multiple results it helps to determine which result belonged to which operation.
This determines whether Tropo should move on to the next verb; if required is set to 'true', Tropo will only move on to the next verb if the current operation completely successfully.
This allows you to submit a recording to be transcribed and specifies where to send the transcription. This field is a hash containing other fields.

  • id - the value that's included with your transcription when it's sent to your URL. This allows you to keep track of transcriptions; accepts a string.
  • url - The address this transcription will be POSTed to; use a mailto: url to have the transcription emailed.
  • emailFormat - the format of the email. Setting it as "encoded" will include a chunk of JSON in the email body or you can set it as "omit" to send as a human-readable message. It defaults to "omit", so unless you want JSON, this can be left out.

Note that the transcription arrives as the content of the HTTP POST, as opposed to a header, named field or variable.
This is the destination URL to send the recording. This can be an FTP destination, like so:

ftp://ftp.myServer.com/files/myRecording.wav

You can build your username and password directly inline with the URL, or you can define them with the individual "username" and "password" fields.
This identifies the FTP account password.
This identifies the FTP account username.
The amount of time Tropo will wait--in seconds and after sending or playing the prompt--for the user to begin a response. If the timeout is reached and the call has not been answered, the URL specified in your incomplete event handler will be called.

For conference, record and transfer, interdigitTimeout defines how long the user needs to wait - in seconds - before Tropo will recognize another key press. Essentially, this means if a user presses the wrong key to terminate the session (say * instead of #), how long do you want Tropo to wait before letting them try again.
Specifies the default voice to be used when speaking text back to a user.

A full list of all voices can be found here (there's many, many options).
Plays a prompt (audio file or text to speech) then optionally waits for a response from the caller and records it.
The SIP destination for the incoming call, as a URL. An example:

sip:9991436228@sip.trpop.com
This is the key used to identify the result of an operation, so you can differentiate between multiple results. As an example, if you asked the user for their favorite color, you could set the name value as 'color' while the returned value might be 'blue'. Not particularly useful if there's only one result returned, but if there are multiple results it helps to determine which result belonged to which operation.
This determines whether Tropo should move on to the next verb; if required is set to 'true', Tropo will only move on to the next verb if the current operation completely successfully.
This is used to deflect the call to a third party SIP address.
Rejects the incoming call.
Actions contains either an Array or an Object with the result of the actions requested in the previous payload, such as an ask or record. The field will be an array if multiple inputs were requested, an object if only one input was requested. Contains the following keys:

  • "name" [String] - The name provided for this action result in the request.
  • "attempts" [Integer] - The number of attempts it took to obtain the result.
  • "disposition" [String] - The final result of the request, values may be "success", "timeout" or "nomatch".
  • "confidence" [Integer] - The result returned by the confidence engine that the result is correct.
  • "interpretation" [String] - What the recognition engine believes what was said.
  • "utterrance" [String] - The specific utterance returned by the speech recognition engine.
  • "value" [String] - This is the result of the grammar. If you have a grammar that says "BBQ (BBQ, Bar Bee Que)" and someone says "Bar Bee Que", then interpretation would say "Bar Bee Que" and value would say "BBQ".
  • "concept" [String] - The result of a Simple Grammar recognition.
  • "xml" [String] - Contains the raw NLSML output.

  • When an Object:

"actions": { "name": "account_number", "attempts": 1, "disposition": "SUCCESS", "confidence": 100, "interpretation": "12345", "utterance": "1 2 3 4 5", "concept": "12345" }


  • When an Array:

"actions": [{ "name": "account_number", "attempts": 1, "disposition": "SUCCESS", "confidence": 100, "interpretation": "12345", "utterance": "1 2 3 4 5", "concept": "12345" }, { "name": "pin", "attempts": 1, "disposition": "SUCCESS", "confidence": 100, "interpretation": "9876", "utterance": "9 8 7 6", "concept": "9876" }]
This contains the ID of the call itself; this is not the caller ID or called ID, this is a value that identifies the actual call.
This indicates whether a request resulted in all required fields being completed.
If the state of the result is an error, refer to this field for the error message.
Represents the number of Tropo payloads returned from your application. For example, if your application receives a session payload and returns a Tropo payload such as an ask, the sequence is at 1. If you then receive a result from Tropo and return a say, the sequence is at 2.
The total length of time, in seconds, the current session has been running.
This is the unique identifier that is available with each session and result payload.
This is the state of the session at the time the result was generated. Values may be: NEW, RINGING, ANSWERING, ANSWERED, REJECTING, REJECTED, DISCONNECTED, FAILED, REDIRECTING, or REDIRECTED.
Returned anytime a request is made to the Tropo Web API, as exemplified by this brief call flow:

  1. User calls a Tropo WebAPI application.
  2. Tropo sends session JSON to defined web server, requesting instructions.
  3. Web server application responds with JSON requesting Tropo ask the caller a question.
  4. Tropo asks the question, user responds.
  5. Tropo sends result JSON back to the web server with the user's answer.

Result is not limited to use in an "ask", the above is just one example. Note that any encoded data, like accented characters, will be passed to your app as ISO-8859-1 encoded in the JSON.
This defines what the user will hear when the verb is executed. In the case of a voice channel, this can be text for the Text to Speech engine or a URL to play an audio file. In the case of a text channel, text is sent to the user via SMS or instant message.
This parameter allows you to assign a signal to this function. Events from the Tropo REST API with a matching signal name will "interrupt" the function (i.e., stop it from running). If it already ran and completed, your interrupt request will be ignored. If the function has not run yet, the interrupt will be queued until it does run.

By default, allowSignals will accept any signal as valid; if you define allowSignals as "", it defines the function as "uninterruptible". You can also use an array - the function will stop if it receives an interrupt signal matching any of the names in the array.
This specifies the type of data being spoken, so the TTS Engine can interpret it correctly. The possible values are "DATE", "DIGITS" and "NUMBER". Applies to voice only.
This is the key used to identify the result of an operation, so you can differentiate between multiple results. As an example, if you asked the user for their favorite color, you could set the name value as 'color' while the returned value might be 'blue'. Not particularly useful if there's only one result returned, but if there are multiple results it helps to determine which result belonged to which operation.
This determines whether Tropo should move on to the next verb; if required is set to 'true', Tropo will only move on to the next verb if the current operation completely successfully.
Specifies the default voice to be used when speaking text back to a user.

A full list of all voices can be found here (there's many, many options).
Says something to the user. Unlike "ask", this function has no ability to wait for a response from the user.
Contains the user account ID that started this session.
This contains the ID of the call itself; this is not the caller ID or called ID, this is a value that identifies the actual call.
This contains the elements that identify the origination of the session. There are four keys present in from:

  • "id" - The identifier of the user that initiated the session. In the case of a "VOICE" channel this will be their Caller ID, in the case of a "TEXT" session their username
  • "name" - The name of the user that initiated the session
  • *channel* - For voice this may be 'PSTN" or "VOIP"
  • *network* - For text this may be "AIM", "GTALK", "JABBER", "MSN", "SMS", "YAHOO" or "TWITTER". Note that in order to send to one of these networks, you need to have the network mapped in your app. For example, if you try to send to AIM when you don't have an AIM username included in your app, your app would fail.

Example:

"from":{"id":"john@gmail.com","name":"unknown", "channel":"TEXT", "network":"GTALK"}
This contains the Session Initiation Protocol (SIP) Headers for the current session. This is advanced network information.
This is the GUID representing the unique session identifier.
When the channel is of a type "TEXT", this field contains the initial text of the message from the SMS or instant message that the user sent when initiating the session.

Note that the initialText field will be saved and used for the first ask object.

To have your text application disregard this field, you can use the following code to store the initialText (and remove it from the queue): {"tropo":[{"ask":{"say":[{"value":""}],"choices":{"value":"[ANY]"},"name":"initial_text_capture"}}]}
If you utilize a token launch via the Session API to start your application, parameters will include:

  • token:token_id
  • action:create

Where token_id is your actual 88 character Token. Parameters can also include additional variables passed when you use a URL to launch the Session API. In this URL...

http://api.tropo.com/1.0/sessions?action=create&token=token_id&myNum=4075551212

...myNum would be passed to parameters. Here's an example of the session JSON generated by that URL:

    {"session": {
          "id": "76b05a0b25127dbf59a4627f6dcd38a7",
          "accountId": "12345",
          "timestamp": "2010-05-05T01:59:19.402Z",
          "userType": "NONE",
          "initialText": null,
          "callId":"092f931c4dddf0124ef426c56d26f98c",
          "parameters": {
              "token": "token_id",
              "action": "create",
              "myNum":"4075551212"
          }
      }
    }
The time that the session was started. As an example:

2012-02-21T16:09:33.891Z

The initial portion is the date, followed by "T" to indicate "Time" is coming next. The time is 16 hours, 9 minutes, 33 seconds, 891 milliseconds, followed by "Z" which stands for "Zulu" and really means GMT.
This contains the elements that identify the destination of the session. There are four keys present within this object:

  • "id" - The identifier of the user receiving the session. In the case of a "VOICE" channel this will be the Called ID, in the case of a "TEXT" session their username
  • "name" - The name of the user that receiving the session; only applies to SIP
  • *channel* - For voice this may be 'PSTN" or "VOIP"
  • *network* - For text this may be "AIM", "GTALK", "JABBER", "MSN", "SMS", "YAHOO" or "TWITTER". Note that in order to send to one of these networks, you need to have the network mapped in your app. For example, if you try to send to AIM when you don't have an AIM username included in your app, your app would fail.

Example:

"to":{"id":"jane@gmail.com","name":"unknown", "channel":"TEXT", "network":"GTALK"}
This identifies the type of user that is on the other end of the session; it can be set to 'HUMAN', 'MACHINE' or 'FAX'.
Session is the payload sent as an HTTP POST to your web application when a new session arrives. It includes all the data regarding how the application was launched, including parameters passed to the app (if any), channel that was used (voice or text), the datetime, etc.

For example:

  1. User calls a Tropo WebAPI application.
  2. Tropo sends session JSON to the defined web server, asking for instructions.
  3. Web server application responds telling Tropo to play an audio file to the caller.
  4. Tropo plays the audio file and disconnects the call, relaying result JSON back to the web server with final details.

Note that any encoded data, like accented characters, will be passed to your app as ISO-8859-1 encoded in the JSON.
This specifies the format for the audio recording; it can be 'audio/wav', 'audio/mp3' or 'audio/au'.
When submitting recordings via HTTP, this parameter determines the method used. This can be 'POST' (which is the default) or 'PUT' . When sending via POST, the name of the form field is "filename".
This is the destination URL to send the recording. This can be an FTP destination, like so:

ftp://ftp.myServer.com/files/myRecording.wav

You can build your username and password directly inline with the URL, or you can define them with the individual "username" and "password" fields.
This identifies the FTP account username.
This identifies the FTP account password.
Allows Tropo applications to begin recording the current session. The resulting recording may then be sent via FTP or an HTTP POST/Multipart Form.
This stops the recording of the current call after startCallRecording has been called.
The new destination for the incoming call as a URL, in one of two forms:

* Telephone number: tel:+14155551212 (requires + and the country code)
* SIP Address: sip:9991436228@sip.tropo.com

You can also list multiple phone numbers or SIP addresses (or both!) as an array; whichever destination picks up first, wins.
This parameter allows you to assign a signal to this function. Events from the Tropo REST API with a matching signal name will "interrupt" the function (i.e., stop it from running). If it already ran and completed, your interrupt request will be ignored. If the function has not run yet, the interrupt will be queued until it does run.

By default, allowSignals will accept any signal as valid; if you define allowSignals as "", it defines the function as "uninterruptible". You can also use an array - the function will stop if it receives an interrupt signal matching any of the names in the array.
If this is set to true, the call will be considered "answered" and audio will begin playing as soon as media is received from the far end (ringing / busy signal / etc).
When used with a transfer, choices allows you to define a terminator. The terminator is the touch-tone key (also known as "DTMF digit") that will allow the caller to cancel the transfer before it connects. A common terminator would be the pound key (#).
If multiple contact methods for a given network are attached to an application, this field allows you to specify which one it comes from. For example, if you have two phone numbers, setting this field would allow you to specify the caller ID that appears to the recipient. For voice calls, this can be any valid phone number; for SMS it needs to be a number assigned to your account. For IM, there's no need to set a specific value for from - it will always need to match the IM account associated with your application, which is what Tropo uses by default anyways.
This contains the Session Initiation Protocol (SIP) Headers for the current session. This is advanced network information.
For conference, record and transfer, interdigitTimeout defines how long the user needs to wait - in seconds - before Tropo will recognize another key press. Essentially, this means if a user presses the wrong key to terminate the session (say * instead of #), how long do you want Tropo to wait before letting them try again.
This is the key used to identify the result of an operation, so you can differentiate between multiple results. As an example, if you asked the user for their favorite color, you could set the name value as 'color' while the returned value might be 'blue'. Not particularly useful if there's only one result returned, but if there are multiple results it helps to determine which result belonged to which operation.
Adds an event callback so that your application may be notified when a particular event occurs. For transfer, the only possible event is "ring"; this allows you to play an audio file or "say" something while the outbound call is ringing.
This determines whether Tropo should move on to the next verb; if required is set to 'true', Tropo will only move on to the next verb if the current operation completely successfully.
This specifies the number of times the audio file specified in the ring event will repeat itself.
This defines, in seconds, how long Tropo should wait for the other party to answer the call. If the timeout is reached and the call has not been answered, the URL specified in your incomplete event handler will be called. The maximum value for this parameter is 2 hours. It's recommended for outbound voice calls that this be set somewhere between 50-90 seconds. This ensures if one carrier cannot connect the call for whatever reason, there is time to try it on another carrier.
This will transfer an already answered call to another destination / phone number. The call can be transferred to either a phone number or SIP address, which is set by the "to" parameter. This verb only applies to voice calls.

Additional dial options are:

  • postd - The DTMF digits to dial after the call has connected
  • pause - The amount of time to wait before issuing the digits after the call is connected; this exists to allow for large values of time to be defined
  • p - Defines a one second pause
  • Example: "+14155551212;postd=1234pp56;pause=5s". This will dial 1234 five seconds after connecting to the phone number, pause for an additional 2 seconds (pp) and then dial 56. This example will do the same thing, though looks a little more complex: "+14155551212;postd=ppppp1234pp56" 'ms' is also supported, so you could define 5000ms instead of 5s.



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