MRCP event messages
The server resource may need to communicate a change in state or the occurrence of a certain event to the client. These messages are used when a request does not complete immediately and the response returns a status of PENDING or IN-PROGRESS. The intermediate results and events of the request are indicated to the client through the event message from the server. The event message consists of an event header line followed by the message header section and an optional message body containing data specific to the event message. The header line has the request-id of the corresponding request and status value. The request-state value is COMPLETE if the request is done and this was the last event, else it is IN-PROGRESS.
event-line = mrcp-version SP message-length SP event-name SP request-id SP request-state CRLF
The mrcp-version used here is identical to the one used in the Request/Response Line and indicates the version of the MRCP protocol running on the server.
mrcp-version = "MRCP" "/" 1*DIGIT "." 1*DIGIT
The message-length field describes the length of the message (in bytes), including the start-line:
message-length = 1*19DIGIT
The request-id field is a unique identifier associated with each request. Clients should assign incremental numbers to each unique request, and the Media Server will use this request-id when responding to requests. In event messages, this value indicates which specific request the event relates to.
request-id = 1*10DIGIT
The event-name identifies the nature of the event generated by the media resource. The set of valid event names depends on the resource generating it. See the corresponding resource-specific section of the article (below).
event-name = synthesizer-event / recognizer-event
The request-state field indicates whether the Request/Command causing this event is complete or still in progress. The final event for a request has a COMPLETE status indicating the completion of the request.
request-state = "COMPLETE" / "IN-PROGRESS" / "PENDING"
Recognizer Events
The recognizer can generate the following events.
recognizer-event = "START-OF-INPUT" / "RECOGNITION-COMPLETE" / "INTERPRETATION-COMPLETE"
The START-OF-INPUT event is issued whenever the recognizer detects the beginning of either speech or DTMF signal within the RTP audio stream associated with the session. The input-type header field of the START-OF-INPUT indicates whether the source of the event was speech or dtmf. Note that in the MRCPv1 specification, "START-OF-INPUT" is reported as "START-OF-SPEECH", so when using MRCPv1, the event will be "START-OF-SPEECH", not "START-OF-INPUT".
The RECOGNITION-COMPLETE event is issued when the Media Server finishes a recognition operation. The recognition result is sent in the body of the message. If the server is configured to return a URI to the audio waveform for this request, it will be indicated in the Waveform-URI header field. The client can use this URI to retrieve or playback the audio. The request-state for these events will be COMPLETE to indicate that no further messages will be associated with the associated request-id.
The INTERPRETATION-COMPLETE event from the recognizer resource to the client indicates that a INTERPRET operation is complete. The interpretation result is sent in the body of the message. The request-state for these events will be COMPLETE to indicate that no further messages will be associated with the associated request-id. The Completion-Cause header field will be included in this event and will be set to an appropriate value from the table below.
Recognizer Completion-Codes
The Completion-Code header field is part of a RECOGNITION-COMPLETE event coming from the recognizer resource to the client. It indicates the reason behind the RECOGNIZE method completion. This header field is sent in the DEFINE-GRAMMAR and RECOGNIZE responses, if they return with a failure status and a COMPLETE state. In the ABNF below, the 'cause-code' contains a numerical value selected from the Cause-Code column of the following table. The 'cause-name' contains the corresponding token selected from the Cause-Name column.
completion-cause = "Completion-Cause" ":" cause-code SP cause-name CRLF cause-code = 3DIGIT cause-name = *VCHAR
Cause-Code | Cause-Name | Description |
000 | success | RECOGNIZE completed with a match or DEFINE-GRAMMAR succeeded in downloading and compiling the grammar |
001 | no-match | RECOGNIZE completed, but no match was found |
002 | no-input-timeout | RECOGNIZE completed without a match due to a no-input-timeout |
003 | hotword-maxtime | RECOGNIZE in hotword mode completed without a match due to a recognition-timeout |
004 | grammar-load-failure | RECOGNIZE failed due grammar load failure |
005 | grammar-compilation-failure | RECOGNIZE failed due to grammar compilation failure |
006 | recognizer-error | RECOGNIZE request terminated prematurely due to a recognizer error |
007 | speech-too-early | RECOGNIZE request terminated because speech was too early. This happens when the audio stream is already “in-speech” when the RECOGNIZE request was received. |
008 | success-maxtime | RECOGNIZE request terminated because speed was too long but whatever was spoken till that point was a full match |
009 | uri-failure | Failure accessing a URI |
010 | language-unsupported | Language not supported |
011 | cancelled | A new RECOGNIZE cancelled this one, or a prior RECOGNIZE failed while this one was still in the queue. |
012 | semantics-failure | Recognition succeeded but semantic interpretation of the recognized input failed. The RECOGNITION-COMPLETE event will contain the Recognition result with only input text and no interpretation. |
013 | partial-match | Speech Incomplete timeout expired before there was a full match. But whatever that was spoken till that point was a partial match to one or more grammars. |
014 | partial-match-maxtime | The Recognition-Timer expired before full match was achieved. But whatever was spoken till that point was a partial match to one or more grammars. |
015 | no-match-maxtime | The Recognition-Timer expired. Whatever was spoken till that point either did not match any of the grammars. This cause could also be returned if the recognizer does not support detecting partial grammar matches. |
016 | grammar-definition-failure | Any DEFINE-GRAMMAR error other than grammar-load-failure and grammar-compilation-failure. |
Synthesizer Events
The synthesizer can generate the following events.
synthesizer-event = "SPEECH-MARKER" / "SPEAK-COMPLETE"
The SPEECH-MARKER event is issued whenever the synthesizer reaches a marker tag in the speech markup it is currently processing. The value of the request-id field will match that of the corresponding SPEAK request. The request-state field will have the value "IN-PROGRESS" as the speech is still not complete. The value of the speech marker hit, describing where the synthesizer is in the speech markup will be returned in the Speech-Marker header field, along with the timestamp indicating the instant in the output speech stream that the marker was encountered.
The SPEAK-COMPLETE event is issued when the Media Server finishes a SPEAK operation. The request-state for these events will be COMPLETE to indicate that no further messages will be associated with the associated request-id. The Completion-Cause header field specifies the cause code pertaining to the status and reason of the request completion, such as SPEAK completed normally or because of an error, kill-on-barge-in etc. The Completion-Cause header field will be included in this event and will be set to an appropriate value from the table below.
Synthesizer Completion-Codes
The Completion-Code header field is part of a SPEAK-COMPLETE event coming from the synthesizer resource to the client. It indicates the reason behind the SPEAK method completion. This header field is sent in the SPEAK responses, if they return with a failure status and a COMPLETE state.
completion-cause = "Completion-Cause" ":" 3DIGIT SP 1*VCHAR CRLF
Cause-Code | Cause-Name | Description |
000 | normal | SPEAK completed normally. |
001 | barge-in | SPEAK request was terminated because of barge-in |
002 | parse-failure | SPEAK request terminated because of failure to parse the speech markup text. |
003 | uri-failure | SPEAK request terminated because access to one of the URIs failed. |
004 | error | SPEAK request terminated prematurely due to synthesizer error |
005 | language-unsupported | Language not supported |
006 | lexicon-load-failure | Lexicon loading failed |
007 | Cancelled | A prior SPEAK request failed while this one was still in the queue. |