forked from mheadd/tropo-webapi-php-original
-
Notifications
You must be signed in to change notification settings - Fork 50
Result Class
mheadd edited this page Sep 14, 2010
·
4 revisions
An object representation of the JSON that is delivered when a request is made to the Tropo WebAPI.
Use this object to examine the result of an Ask() that has gathered a response from a user.
// Create a new instance of the Result Object and determine the user input. $result = new Result(); // Get the unique identifier that is available with each Tropo session. $sessionID = $result->getSessionId(); // Get the state of the session at the time the result was generated. // Values may be: "ANSWERED", "ERROR", "HANGUP" or "RINGING". // If the state is "ERROR" refer to the error field for the message. $state = $result->getState(); // Get the total length of time, in seconds, the current session has been running. $sessionDuration = $result->getSessionDuration(); // Get he number of Tropo payloads returned from your application. $sequence = $result->getSequence(); // Indicates whether a request resulted in all required fields being completed. $complete = $result->isComplete(); // If the state of the result is an error, call this method for the error message. $error = $result->getError(); // Get the result of the actions requested in the previous payload. $actions = $result->getActions(); // The name provided for the action result in the request. $name = $result->getName(); // The number of attempts it took to obtain the result. $attempts = $result->getAttempts(); // The final result of the request, values may be "success", "timeout" or "nomatch" $disposition = $result->getDisposition(); // The result returned by the confidence engine that the result is correct. $confidence = $result->getConfidence(); // What the recognition engine believes what was said. $interpretation = $result->getInterpretation(); // The result of a Simple Grammar recognition. $concept = $result->getConcept(); // The specific utterance returned by the speech recognition engine. $utterance = $result->getUtterance(); // The value of the input returned in the request. $value = $result->getValue();