Tropo WebAPI Development Guide Home  |  Frameset Home

  Node.js - Voice Recording Example  |  TOC  |  Advanced Call Control  

Behind the Scenes JSON - Voice Recording


Interested in the JSON sent back and forth between Tropo and your web server by the Node.js - Voice Recording Example? It's all here, in the same order as the main description of the application.

Here's the initial session JSON that starts it all off:

{
   "session":{
      "id":"de515ed12ff39afdfba48149763f96e9",
      "accountId":"46256",
      "timestamp":"2010-10-08T18:25:06.153Z",
      "userType":"HUMAN",
      "initialText":null,
      "callId":"5717e7d3cc199afc9108384a9a5b7fa6",
      "to":{
         "id":"9991479096",
         "name":"sip.tropo.com",
         "channel":"VOICE",
         "network":"SIP"
      },
      "from":{
         "id":"userID",
         "name":"unknown",
         "channel":"VOICE",
         "network":"SIP"
      },
      "headers":{
         "x-sbc-allow":"MESSAGE",
         "x-sbc-user-agent":"Blink 0.20.2 (MacOSX)",
         "x-voxeo-sbc-name":"10.6.63.201",
         "x-sbc-contact":"",
         "Content-Length":"247",
         "To":"",
         "x-voxeo-sbc":"true",
         "Contact":"",
         "x-voxeo-to":"",
         "x-sbc-request-uri":"sip:9991479096@sip.tropo.com",
         "x-sbc-call-id":"Wrz495nyTIZFuvpeaZkzjb1UFoqeGnQf",
         "x-sid":"1bfdb22333b4d9dc6a885df9be088d6f",
         "x-sbc-cseq":"8337 INVITE",
         "x-sbc-max-forwards":"69",
         "x-sbc-supported":"100rel",
         "x-voxeo-sbc-session-id":"1bfdb22333b4d9dc6a885df9be088d6f",
         "CSeq":"2 INVITE",
         "Via":"SIP/2.0/UDP 66.193.54.6:5060;received=10.6.63.201"
      }
   }
}

The application interprets the JSON and sends back instructions to Tropo, based on the channel; in this example, the channel was VOICE (line 18 of Figure 10.0):

{"tropo":[
      {
         "say":{
            "value":"Welcome to my Tropo Web API node demo."
         }
      },
      {
         "record":{
            "attempts":3,
            "bargein":false,
            "choices":{
               "terminator":"#"
            },
            "maxSilence":5,
            "maxTime":60,
            "name":"recording",
            "say":{
               "value":"Please ree cord your message after the beep."
            },
            "timeout":5,
            "url":"http://example.com/tropo"
         }
      },
      {
         "on":{
            "event":"continue",
            "next":"/answer",
            "required":true
         }
      },
      {
         "on":{
            "event":"incomplete",
            "next":"/timeout",
            "required":true
         }
      },
      {
         "on":{
            "event":"error",
            "next":"/error",
            "required":true
         }
      }
   ]
}

Tropo interprets the JSON sent by the application, asks the user to record their message after the beep (line 18 of Figure 10.1), records the example and sends it to http://example.com/tropo (line 21 of Figure 10.1). It then sends this result JSON back to the application, noting the user entered in the # symbol to terminate the connection (line 15 of figure 10.2):

{
   "result":{
      "sessionId":"de515ed12ff39afdfba48149763f96e9",
      "callId":"5717e7d3cc199afc9108384a9a5b7fa6",
      "state":"ANSWERED",
      "sessionDuration":9,
      "sequence":1,
      "complete":true,
      "error":null,
      "actions":{
         "name":"recording",
         "attempts":1,
         "disposition":"SUCCESS",
         "confidence":100,
         "interpretation":"#",
         "utterance":"#",
         "concept":"#",
         "value":"#",
         "xml":"<?xml version=\"1.0\"?>\r\n\r\n \r\n \r\n dtmf-pound<\/input>\r\n <\/interpretation>\r\n<\/result>\r\n",
         "duration":817,
         "url":"http://example.com/tropo"
      }
   }
}

Once the application receives the result JSON, it takes the choice and returns the appropriate prompt (line 4 of Figure 10.3); in this case, that's the end of the application, so Tropo simply hangs up afterwards:

{"tropo":[
      {
         "say":{
            "value":"Recording successfully saved. Thank you!"
         }
      }
   ]
}



  ANNOTATIONS: EXISTING POSTS
0 posts - click the button below to add a note to this page

login
  Node.js - Voice Recording Example  |  TOC  |  Advanced Call Control  

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