# Universal Speech Access API constants

The Universal Speech Access API defines the following constants for defining synthesizer and recognizer parameters:

- SAI_AUDIO_FETCH_HINT

- SAI_ENGINE_STATUS_CODE

- SAI_FETCH_HINT

- SAI_GRAMMAR_TYPE

- SAI_METHOD_TYPE

- SAI_RECOGNIZER_COMPLETION_CAUSE

- SAI_REQUEST_STATE

- SAI_SPEAK_COMPLETION_CAUSE

- SAI_SPEAK_DATA_TYPE

- SAI_SPEECH_LANGUAGE_TYPE

- SAI_STATUS_CODE

- SAI_VOICE_GENDER

- Other constants

## SAI_AUDIO_FETCH_HINT

Audio fetch hints value that defines whether or not the synthesizer can optimize speech by pre-fetching audio. (for example, when the application calls saiTtsSetAudioFetchHint):

Constant | Decimal | Description
SAI_AUDIO_FETCH_HINT_PREFETCH | 0 | Permit, but not require the platform pre-fetch audio.
SAI_AUDIO_FETCH_HINT_SAFE | 1 | Only fetch audio when it is needed, never before.
SAI_AUDIO_FETCH_HINT_STREAM | 2 | Allow the platform to stream audio fetches.
SAI_AUDIO_FETCH_HINT_LAST | 3 | Last entry in constant table.

## SAI_ENGINE_STATUS_CODE

Status code enumeration resulting from a saiCreateRecognizer or saiCreateSynthesizer calls that indicates the success or failure of the request to establish a session or provides status information about the request. USAI can also return SAI_ENGINE_STATUS_CODE when a failure occurs in an open session, in which case the status code is provided in the SAI_EVENT_ENGINE_FAILED event buffer.

For more information about SAI_ENGINE_STATUS_CODE constants, refer to the RTSP specification.

Constant | Decimal
SAI_ENGINE_SUCCESS | 200
SAI_ENGINE_CREATED | 201
SAI_ENGINE_NOT_ENOUGH_MEMORY | 250
SAI_ENGINE_MULTIPLE_CHOICES | 300
SC_CSC_MOVED_PERMANENTLY | 301
SAI_ENGINE_TEMPORARILY | 302
SAI_ENGINE_OTHER | 303
SAI_ENGINE_NOT_MODIFIED | 304
SAI_ENGINE_USE_PROXI | 305
SAI_ENGINE_BAD_REQUEST | 400
SAI_ENGINE_UNAUTHORIZED | 401
SAI_ENGINE_PAYMENT_REQUIRED | 402
SAI_ENGINE_FORBIDDEN | 403
SAI_ENGINE_FOUND | 404
SAI_ENGINE_METHOD_NOT_ALLOWED | 405
SAI_ENGINE_NOT_ACCEPTABLE | 406
SAI_ENGINE_PROXI_AUTHENTICATION_REQUIRED | 407
SAI_ENGINE_REQUEST_TIMEOUT | 408
SAI_ENGINE_GONE | 410
SAI_ENGINE_LENGTH_REQUIRED | 411
SAI_ENGINE_PRECONDITION_FAILED | 412
SAI_ENGINE_REQUEST_ENTITY_TOO_LARGE | 413
SAI_ENGINE_REQUEST_URL_TOO_LARGE | 414
SAI_ENGINE_UNSUPPORTED_MEDIA_TYPE | 415
SAI_ENGINE_PARAMETER_NOT_UNDERSTOOD | 451
SAI_ENGINE_CONFERENCE_NOT_FOUND | 452
SAI_ENGINE_NOT_ENOUGH_BANDWIDTH | 453
SAI_ENGINE_SESSION_NOT_FOUND | 454
SAI_ENGINE_METHOD_NOT_VALID_IN_THIS_STATE | 455
SAI_ENGINE_HDR_FIELD_NOT_VALID_FOR_RESOURCE | 456
SAI_ENGINE_INVALID_RANGE | 457
SAI_ENGINE_PARAMETER_IS_READ_ONLY | 458
SAI_ENGINE_AGGREGATE_OPERATION_NOT_ALLOWED | 459
SAI_ENGINE_ONLY_AGGREGATE_OPERATION_ALLOWED | 460
SAI_ENGINE_UNSUPPORTED_TRANSPORT | 461
SAI_ENGINE_DESTINATION_UNREACHABLE | 462
SAI_ENGINE_INTERNAL_SERVER_ERROR | 500
SAI_ENGINE_NOT_IMPLEMENTED | 501
SAI_ENGINE_BAD_GATEWAY | 502
SAI_ENGINE_SERVICE_UNAVAILABLE | 503
SAI_ENGINE_GATEWAY_TIMEOUT | 504
SAI_ENGINE_RTSP_VERSION_NOT_SUPPORTED | 505
SAI_ENGINE_OPTION_NOT_SUPPORT | 551

## SAI_FETCH_HINT

Fetch hints value that defines when the synthesizer retrieves content from the server (for example, when the application calls saiTtsSetFetchHint). This constant is used when setting URI access properties if the speech must fetch documents or other resources such as speech markup or audio files:

Constant | Decimal | Description
SAI_FETCH_HINT_PREFETCH | 0 | A file may be downloaded when the request is received.
SAI_FETCH_HINT_SAFE | 1 | A file that should only be downloaded when actually needed.
SAI_FETCH_HINT_LAST | 2 | Last entry in the constant table.

## SAI_GRAMMAR_TYPE

Define the type of user-defined grammar:

Constant | Decimal | Description
SAI_GRAMMAR_TYPE_URL | 0 | Grammar includes URL that will be loaded by the speech engine.
SAI_GRAMMAR_TYPE_XML | 1 | Grammar is formatted following XML rules
SAI_GRAMMAR_TYPE_GRAMMAR_LIST | 2 | Grammar is actually a table of grammar.
SAI_GRAMMAR_TYPE_LAST | 3 | Last entry in the constant table.

## SAI_METHOD_TYPE

Parameter defining the methodType field property when specific USAI functions are invoked:

Constant | Decimal | USAI function invoked....
SAI_METHOD_TTS_GET_PARAM | 1 | saiGetParamSynthesizer
SAI_METHOD_TTS_SET_PARAM | 2 | saiSetParamSynthesizer
SAI_METHOD_TTS_SPEAK | 3 | saiSpeakSynthesizer
SAI_METHOD_TTS_STOP | 4 | saiStopSynthesizer
SAI_METHOD_TTS_PAUSE | 5 | saiPauseSynthesizer
SAI_METHOD_TTS_RESUME | 6 | saiResumeSynthesizer
SAI_METHOD_TTS_BARGE_IN_OCCURRED | 7 | saiNotifyBargeInToSynthesizer
SAI_METHOD_TTS_CONTROL | 8 | saiControlSynthesizer
SAI_METHOD_ASR_GET_PARAM | 9 | saiGetParamRecognizer
SAI_METHOD_ASR_SET_PARAM | 10 | saiSetParamRecognizer
SAI_METHOD_ASR_DEFINE_GRAMMAR | 11 | saiDefineGrammarRecognizer
SAI_METHOD_ASR_RECOGNIZE | 12 | saiStartRecognizer
SAI_METHOD_ASR_GET_RESULT | 13 | saiGetResultRecognizer
SAI_METHOD_ASR_RECOGNITION_START_TIMERS | 14 | saiStartTimerRecognizer
SAI_METHOD_ASR_STOP | 15 | saiStopRecognizer
SAI_METHOD_LAST | 16 | Last entry in the constant table.

## SAI_RECOGNIZER_COMPLETION_CAUSE

Speech recognizer cause enumeration:

Constant | Decimal | Description
SAI_RCC_NORMAL | 0 | Speech recognizer request completed with a match, or DEFINE-GRAMMAR succeeded in downloading and compiling the grammar.
SAI_RCC_NO_MATCH | 1 | Speech recognizer request completed, but no match was found.
SAI_RCC_INPUT_TIMEOUT | 2 | Speech recognizer request completed without a match due to a no-input-timeout.
SAI_RCC_RECOGNITION_TIMEOUT | 3 | Speech recognizer request completed without a match due to a recognition-timeout.
SAI_RCC_GRAMMAR_LOAD_FAILURE | 4 | Speech recognizer request failed due to a grammar load failure.
SAI_RCC_GRAMMAR_COMPILE_FAILURE | 5 | Speech recognizer request failed due to grammar compilation failure.
SAI_RCC_ERROR | 6 | Speech recognizer request terminated prematurely due to a recognizer error.
SAI_RCC_SPEECH_TO_EARLY | 7 | Speech recognizer request terminated because speech was too early.
SAI_RCC_TOO_MUCH_SPEECH_TIMEOUT | 8 | Speech recognizer request terminated because the supplied was too long.
SAI_RCC_URL_FAILURE | 9 | There was a failure accessing a URL.
SAI_RCC_LANGUAGE_UNSUPPORTED | 10 | Language not supported.
SAI_RCC_LAST | 11 | Last entry in the constant table.

## SAI_REQUEST_STATE

Request state code enumeration:

Constant | Decimal | Description
SAI_REQUEST_COMPLETE | 0 | Request is completed
SAI_REQUEST_INPROGRESS | 1 | Request is in progress
SAI_REQUEST _PENDING | 2 | Request is pending
SAI_REQUEST_STATE_LAST | 3 | Last entry in the constant table.

## SAI_SPEAK_COMPLETION_CAUSE

Speech synthesizer cause enumeration:

Constant | Decimal | Description
SAI_SCC_NORMAL | 0 | Speech synthesizer request completed normally,
SAI_SCC_BARGE_IN | 1 | Speech synthesizer request completed because of a barge-in detection.
SAI_SCC_PARSE_FAILURE | 2 | Speech synthesizer request terminated because of a failure to parse the speech markup text.
SAI_SCC_URL_FAILURE | 3 | Speech synthesizer request terminated because, access to one of the URLs failed.
SAI_SCC_ERROR | 4 | Speech synthesizer request terminated prematurely due to synthesizer error.
SAI_SCC_LANGUAGE_UNSUPPORTED | 5 | Speech synthesizer request terminated because of a language not supported by the synthesizer.
SAI_SCC_LAST | 6 | Last entry in the constant table.

## SAI_SPEAK_DATA_TYPE

Constant | Decimal | Description
SAI_SPEAK_DATA_TYPE_URL | 0 | The data sent with saiSpeakSynthesizer is a URL.
SAI_SPEAK_DATA_TYPE_XML | 1 | The data sent with saiSpeakSynthesizer is in XML format.
SAI_SPEAK_DATA_TYPE_PLAIN_TEXT | 2 | The data sent with saiSpeakSynthesizer is a non-formatted plain text.
SAI_SPEAK_DATA_TYPE_DATA_LIST | 3 | The data sent with saiSpeakSynthesizer contains a list of speak rules.
SAI_SPEAK_DATA_TYPE_LAST | 4 | Last entry in the constant table.

## SAI_SPEECH_LANGUAGE_TYPE

Predefined language types for the speech synthesizer to use. If the language is not predefined here, you must use a user-defined type. Refer to the speech vendor documentation for more information about supported languages.

Constant | Decimal | Description
SAI_SPEECH_LANGUAGE_TYPE_US_ENGLISH | 0 | US English
SAI_SPEECH_LANGUAGE_TYPE_UK_ENGLISH | 1 | UK English
SAI_SPEECH_LANGUAGE_TYPE_DUTCH | 2 | Dutch
SAI_SPEECH_LANGUAGE_TYPE_FRENCH | 3 | French
SAI_SPEECH_LANGUAGE_TYPE_GERMAN | 4 | German
SAI_SPEECH_LANGUAGE_TYPE_ITALIAN | 5 | Italian
SAI_SPEECH_LANGUAGE_TYPE_NORWEGIAN | 6 | Norwegian
SAI_SPEECH_LANGUAGE_TYPE_SPANISH_EUROPEAN | 7 | European Spanish
SAI_SPEECH_LANGUAGE_TYPE_SWEDISH | 8 | Swedish
SAI_SPEECH_LANGUAGE_TYPE_USER_DEFINED | 9 | User-defined language
SAI_SPEECH_LANGUAGE_TYPE_LAST | 10 | Last entry in the constant table.

## SAI_STATUS_CODE

Result of a specific resource control command representing the success or failure or other status of the request.

Constant | Decimal | Description
SAI_SC_SUCCESS | 200 | Request has been executed successfully.
SAI_SC_SUCCESS_IGNORED | 201 | Success with some optional parameters ignored.
SAI_SC_FAILURE_MASK | 400 | Mask determining failure results.
SAI_SC_METHOD_NOT_ALLOWED | 401 | Request (command) is not supported by the speech server.
SAI_SC_METHOD_NOT_VALID_IN_THIS_STATE | 402 | Speech engine is not ready or not in the appropriate state to accept this request.
SAI_SC_UNSUPPORTED_PARAMETER | 403 | At least one command parameter is not supported.
SAI_SC_ILLEGAL_PARAMETER_VALUE | 404 | Parameter is supported but contains an illegal value.
SAI_SC_NOT_FOUND | 405 | Resource URI not initialized or doesn't exist
SAI_SC_MANDATORY_PARAMETER_MISSING | 406 | A mandatory parameter is missing.
SAI_SC_OPERATION_FAILED | 407 | Grammar compilation failed in the recognizer. The cause is indicated in the completion cause field.
SAI_SC_UNSUPPORTED_MESSAGE_ENTITY | 408 | An unrecognized or unsupported message entity was sent to the speech server.
SAI_SC_UNSUPPORTED_PARAMETER_VALUE | 409 | One of the parameters contains a non-supported value.
SAI_SC_RESOURCE_SPECIFIC_FAILURE_START | 421 | Beginning of the vendor specific failure code range. Refer to the vendor documentation for more information.
SAI_SC_RESOURCE_SPECIFIC_FAILURE_END | 499 | End of the vendor specific failure code range. Refer to the vendor documentation for more information.

## SAI_VOICE_GENDER

Type of voice gender the Synthesizer uses when defining voice profiles with the SAI_VOICE structure:

Constant | Decimal | Description
SAI_VOICE_GENDER_NEUTRAL | 0 | Neutral voice.
SAI_VOICE_GENDER_MALE | 1 | Male voice.
SAI_VOICE_GENDER_FEMALE | 2 | Female voice.
SAI_VOICE_GENDER_LAST | 3 | Last entry in the constant table.

## Other constants

The following table lists other constants used by the SAI service:

Constant | Decimal | Description
SAI_MAX_STOPREQUEST | 10 | Maximum number of request identifiers that can be contained in the reqList[] field of the extInfo buffer received with the returned event in saiStopRecognizer or saiStopSynthesizer.
SAI_MAX_IP_ADDRESS_LENGTH | 32 | Maximum string length when defining an IP address.
SAI_MAX_SERVER_NAME | 256 | Maximum string length for a server name.
SAI_MAX_URLLENGTH | 256 | Maximum string length when defining a URL address.
SAI_MAX_LOGGINGTAGLENGTH | 256 | Maximum string length when defining a logging tag.
SAI_MAX_STRINGLENGTH | 256 | Maximum string length when setting various string type parameters.
SAI_MAX_TAGLENGTH | 256 | Maximum string length when setting various tag type parameters.