{"result":} object

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.

Fields

actions
Data Type: 
Array or Object
Default: (none) Optional

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, FAILED, EXTERNAL_EVENT, TIMEOUT, BUSY, or REJECTED.
  • "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" }]

callId
Data Type: 
String
Default: (none) Optional

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.

calledID
Data Type: 
String
Default: 
none
Optional

On outgoing calls (either with a call or transfer), the calledID will be set to the number called. In the case of multiple numbers called at once, calledID will indicate which number answered.

complete
Data Type: 
Boolean
Default: (none) Optional

This indicates whether a request resulted in all required fields being completed.

error
Data Type: 
String
Default: (none) Optional

If the state of the result is an error, refer to this field for the error message.

sequence
Data Type: 
Integer
Default: 
0
Optional

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.

duration
Data Type: 
Integer
Default: 
0
Optional

Set on a transfer only, the total duration in seconds of a transferred call, including the time spent ringing before the call was answered.

connectedDuration
Data Type: 
Integer
Default: 
0
Optional

Set on a transfer only, the duration in seconds of a transferred call, starting from when the destination leg answers.

sessionDuration
Data Type: 
Integer
Default: 
0
Optional

The total length of time, in seconds, the current session has been running.

sessionId
Data Type: 
String
Default: (none) Optional

This is the unique identifier that is available with each session and result payload.

state
Data Type: 
String
Default: (none) Optional

This is the state of the session at the time the result was generated. Values may be: ANSWERED, DISCONNECTED, or FAILED.

Examples

Example of result JSON for an inbound ask

{
   "result":{
      "sessionId":"f4140488a0036e725e112f4c74c12345",
      "callId":"9a9cd46c961fc631068557eb7b812345",
      "userType":"NONE",
      "state":"ANSWERED",
      "sessionDuration":6,
      "sequence":1,
      "complete":true,
      "error":null,
      "calledid":"14075550100",
      "actions":{
         "name":"color",
         "attempts":1,
         "disposition":"SUCCESS",
         "confidence":46,
         "interpretation":"blue",
         "utterance":"blue",
         "concept":"blue",
         "value":"blue",
         "xml":"<?xml version=\\\\"         1.0         \\\\"?>\\\\r\\\\n<result grammar=\\\\"0@dde9c50f.vxmlgrammar\\\\">\\\\r\\\\n    <interpretation grammar=\\\\"0@dde9c50f.vxmlgrammar\\\\" confidence=\\\\"46\\\\">\\\\r\\\\n        \\\\r\\\\n      <input mode=\\\\"speech\\\\">blue<\\\\/input>\\\\r\\\\n    <\\\\/interpretation>\\\\r\\\\n<\\\\/result>\\\\r\\\\n"
      }
   }
}

Example of result JSON for an outbound call and ask

{
   "result":{
      "sessionId":"be9610c12d60ae8c99f0fbf554212345",
      "callId":"8986b9d9252c0b0ea6acf76fdb212345",
      "userType":"NONE",
      "state":"ANSWERED",
      "sessionDuration":12,
      "sequence":1,
      "complete":true,
      "error":null,
      "calledid":"+14075550100",
      "_call":{
         "sessionId":"be9610c12d60ae8c99f0fbf554212345",
         "callId":"8986b9d9252c0b0ea6acf76fdb212345",
         "userType":"NONE",
         "state":"ANSWERED",
         "sessionDuration":12,
         "sequence":1,
         "complete":true,
         "error":null,
         "calledid":"+14075550100"
      },
      "actions":[
         {
            "name":"call-bf1c3e59-7779-422a-b0d1-f43f01212345",
            "sessionId":"be9610c12d60ae8c99f0fbf554212345",
            "callId":"8986b9d9252c0b0ea6acf76fdb212345",
            "userType":"NONE",
            "state":"ANSWERED",
            "sessionDuration":12,
            "sequence":1,
            "complete":true,
            "error":null,
            "calledid":"+14075550100",
            "_call":{
               "sessionId":"be9610c12d60ae8c99f0fbf554212345",
               "callId":"8986b9d9252c0b0ea6acf76fdb212345",
               "userType":"NONE",
               "state":"ANSWERED",
               "sessionDuration":12,
               "sequence":1,
               "complete":true,
               "error":null,
               "calledid":"+14075550100"
            }
         },
         {
            "name":"color",
            "attempts":1,
            "disposition":"SUCCESS",
            "confidence":33,
            "interpretation":"blue",
            "utterance":"blue",
            "concept":"blue",
            "value":"blue",
            "xml":"<?xml version=\\\\"            1.0            \\\\"?>\\\\r\\\\n<result grammar=\\\\"0@23806e29.vxmlgrammar\\\\">\\\\r\\\\n    <interpretation grammar=\\\\"0@23806e29.vxmlgrammar\\\\" confidence=\\\\"33\\\\">\\\\r\\\\n        \\\\r\\\\n      <input mode=\\\\"speech\\\\">blue<\\\\/input>\\\\r\\\\n    <\\\\/interpretation>\\\\r\\\\n<\\\\/result>\\\\r\\\\n"
         }
      ]
   }
}

Example of result JSON for an outbound call with CPA active (and an ask, same as the previous examples)

{
    "result": {
        "sessionId": "863ec8a756fe3b10dac6b6d1f6712345",
        "callId": "ee0d0f9f33d876ead7d33c1395612345",
        "userType": "HUMAN",
        "state": "ANSWERED",
        "sessionDuration": 34,
        "sequence": 1,
        "complete": true,
        "error": null,
        "calledid": "+14075550100",
        "_call": {
            "sessionId": "863ec8a756fe3b10dac6b6d1f6712345",
            "callId": "ee0d0f9f33d876ead7d33c1395612345",
            "userType": "HUMAN",
            "state": "ANSWERED",
            "sessionDuration": 34,
            "sequence": 1,
            "complete": true,
            "error": null,
            "calledid": "+14075550100"
        },
        "actions": [
            {
                "name": "call-8cdf73ea-40da-47c4-a040-b2b814e12345",
                "sessionId": "863ec8a756fe3b10dac6b6d1f6712345",
                "callId": "ee0d0f9f33d876ead7d33c1395612345",
                "userType": "HUMAN",
                "state": "ANSWERED",
                "sessionDuration": 34,
                "sequence": 1,
                "complete": true,
                "error": null,
                "calledid": "+14075550100",
                "_call": {
                    "sessionId": "863ec8a756fe3b10dac6b6d1f6712345",
                    "callId": "ee0d0f9f33d876ead7d33c1395612345",
                    "userType": "HUMAN",
                    "state": "ANSWERED",
                    "sessionDuration": 34,
                    "sequence": 1,
                    "complete": true,
                    "error": null,
                    "calledid": "+14075550100"
                }
            },
            {
                "name": "color",
                "attempts": 1,
                "disposition": "SUCCESS",
                "confidence": 59,
                "interpretation": "blue",
                "utterance": "blue",
                "concept": "blue",
                "value": "blue",
                "xml": "<?xml version=\\\\"1.0\\\\"?>\\\\r\\\\n<result grammar=\\\\"0@37c12891.vxmlgrammar\\\\">\\\\r\\\\n    <interpretation grammar=\\\\"0@37c12891.vxmlgrammar\\\\" confidence=\\\\"59\\\\">\\\\r\\\\n        \\\\r\\\\n      <input mode=\\\\"speech\\\\">blue<\\\\/input>\\\\r\\\\n    <\\\\/interpretation>\\\\r\\\\n<\\\\/result>\\\\r\\\\n"
            }
        ]
    }
}