00001 /* 00002 * Copyright 2008-2010 Arsen Chaloyan 00003 * 00004 * Licensed under the Apache License, Version 2.0 (the "License"); 00005 * you may not use this file except in compliance with the License. 00006 * You may obtain a copy of the License at 00007 * 00008 * http://www.apache.org/licenses/LICENSE-2.0 00009 * 00010 * Unless required by applicable law or agreed to in writing, software 00011 * distributed under the License is distributed on an "AS IS" BASIS, 00012 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. 00013 * See the License for the specific language governing permissions and 00014 * limitations under the License. 00015 * 00016 * $Id: mrcp_recorder_header.h 1474 2010-02-07 20:51:47Z achaloyan $ 00017 */ 00018 00019 #ifndef MRCP_RECORDER_HEADER_H 00020 #define MRCP_RECORDER_HEADER_H 00021 00022 /** 00023 * @file mrcp_recorder_header.h 00024 * @brief MRCP Recorder Header 00025 */ 00026 00027 #include "mrcp_types.h" 00028 #include "mrcp_header_accessor.h" 00029 00030 APT_BEGIN_EXTERN_C 00031 00032 /** MRCP recorder header fields */ 00033 typedef enum { 00034 RECORDER_HEADER_SENSITIVITY_LEVEL, 00035 RECORDER_HEADER_NO_INPUT_TIMEOUT, 00036 RECORDER_HEADER_COMPLETION_CAUSE, 00037 RECORDER_HEADER_COMPLETION_REASON, 00038 RECORDER_HEADER_FAILED_URI, 00039 RECORDER_HEADER_FAILED_URI_CAUSE, 00040 RECORDER_HEADER_RECORD_URI, 00041 RECORDER_HEADER_MEDIA_TYPE, 00042 RECORDER_HEADER_MAX_TIME, 00043 RECORDER_HEADER_TRIM_LENGTH, 00044 RECORDER_HEADER_FINAL_SILENCE, 00045 RECORDER_HEADER_CAPTURE_ON_SPEECH, 00046 RECORDER_HEADER_VER_BUFFER_UTTERANCE, 00047 RECORDER_HEADER_START_INPUT_TIMERS, 00048 RECORDER_HEADER_NEW_AUDIO_CHANNEL, 00049 00050 RECORDER_HEADER_COUNT 00051 } mrcp_recorder_header_id; 00052 00053 00054 /** MRCP recorder completion-cause */ 00055 typedef enum { 00056 RECORDER_COMPLETION_CAUSE_SUCCESS_SILENCE = 0, 00057 RECORDER_COMPLETION_CAUSE_SUCCESS_MAXTIME = 1, 00058 RECORDER_COMPLETION_CAUSE_NO_INPUT_TIMEOUT = 2, 00059 RECORDER_COMPLETION_CAUSE_URI_FAILURE = 3, 00060 RECORDER_COMPLETION_CAUSE_ERROR = 4, 00061 00062 RECORDER_COMPLETION_CAUSE_COUNT = 5, 00063 RECORDER_COMPLETION_CAUSE_UNKNOWN = RECORDER_COMPLETION_CAUSE_COUNT 00064 } mrcp_recorder_completion_cause_e; 00065 00066 00067 00068 /** MRCP recorder-header declaration */ 00069 typedef struct mrcp_recorder_header_t mrcp_recorder_header_t; 00070 00071 /** MRCP recorder-header */ 00072 struct mrcp_recorder_header_t { 00073 /** To filter out background noise and not mistake it for speech */ 00074 float sensitivity_level; 00075 /** When recording is started and there is no speech detected for a 00076 certain period of time, the recorder can send a RECORD-COMPLETE event */ 00077 apr_size_t no_input_timeout; 00078 /** MUST be part of a RECORD-COMPLETE event coming from the 00079 recorder resource to the client */ 00080 mrcp_recorder_completion_cause_e completion_cause; 00081 /** MAY be specified in a RECORD-COMPLETE event coming from 00082 the recorder resource to the client */ 00083 apt_str_t completion_reason; 00084 /** When a recorder method needs to post the audio to a URI and access to 00085 the URI fails, the server MUST provide the failed URI in this header 00086 in the method response */ 00087 apt_str_t failed_uri; 00088 /** When a recorder method needs to post the audio to a URI and access to 00089 the URI fails, the server MUST provide the URI specific or protocol 00090 specific response code through this header in the method response */ 00091 apt_str_t failed_uri_cause; 00092 /** When a recorder method contains this header the server must capture 00093 the audio and store it */ 00094 apt_str_t record_uri; 00095 /** A RECORD method MUST contain this header, which specifies to the 00096 server the Media Type of the captured audio or video */ 00097 apt_str_t media_type; 00098 /** When recording is started this specifies the maximum length of the 00099 recording in milliseconds, calculated from the time the actual 00100 capture and store begins and is not necessarily the time the RECORD 00101 method is received */ 00102 apr_size_t max_time; 00103 /** This header MAY be sent on a STOP method and specifies the length of 00104 audio to be trimmed from the end of the recording after the stop */ 00105 apr_size_t trim_length; 00106 /** When recorder is started and the actual capture begins, this header 00107 specifies the length of silence in the audio that is to be 00108 interpreted as the end of the recording*/ 00109 apr_size_t final_silence; 00110 /** f false, the recorder MUST start capturing immediately when started. 00111 If true, the recorder MUST wait for the endpointing functionality to 00112 detect speech before it starts capturing */ 00113 apt_bool_t capture_on_speech; 00114 /** Tells the server to buffer the utterance associated with this 00115 recording request into the verification buffer */ 00116 apt_bool_t ver_buffer_utterance; 00117 /** MAY be sent as part of the RECORD request. A value of false tells the 00118 recorder resource to start the operation, but not to start the no-input 00119 timer until the client sends a START-INPUT-TIMERS */ 00120 apt_bool_t start_input_timers; 00121 /** MAY be specified in a RECORD request and allows the 00122 client to tell the server that, from this point on, further input 00123 audio comes from a different audio source */ 00124 apt_bool_t new_audio_channel; 00125 }; 00126 00127 00128 /** Get recorder header vtable */ 00129 const mrcp_header_vtable_t* mrcp_recorder_header_vtable_get(mrcp_version_e version); 00130 00131 /** Get recorder completion cause string */ 00132 MRCP_DECLARE(const apt_str_t*) mrcp_recorder_completion_cause_get( 00133 mrcp_recorder_completion_cause_e completion_cause, 00134 mrcp_version_e version); 00135 00136 APT_END_EXTERN_C 00137 00138 #endif /* MRCP_RECORDER_HEADER_H */