/** Generate MRCP prosody-volume value */
static apt_bool_t mrcp_prosody_volume_generate(mrcp_prosody_volume_t *prosody_volume, apt_str_t *str, apr_pool_t *pool)
{
	if(prosody_volume->type == PROSODY_VOLUME_TYPE_LABEL) {
		apt_string_table_value_pgenerate(
			prosody_volume_string_table,
			PROSODY_VOLUME_COUNT,
			prosody_volume->value.label,
			str,
			pool);
	}
	else if (prosody_volume->type == PROSODY_VOLUME_TYPE_NUMERIC) {
		apt_float_value_generate(prosody_volume->value.numeric,str,pool);
	}
	else {
		apt_float_value_generate(prosody_volume->value.relative,str,pool);
	}

	return TRUE;
}
Example #2
0
/** Generate MRCPv2 recognizer header */
static apt_bool_t mrcp_v2_recog_header_generate(mrcp_header_accessor_t *accessor, apr_size_t id, apt_text_stream_t *value)
{
	mrcp_recog_header_t *recog_header = accessor->data;
	if(id == RECOGNIZER_HEADER_CONFIDENCE_THRESHOLD) {
		return apt_float_value_generate(recog_header->confidence_threshold,value);
	}
	else if(id == RECOGNIZER_HEADER_SENSITIVITY_LEVEL) {
		return apt_float_value_generate(recog_header->sensitivity_level,value);
	}
	else if(id == RECOGNIZER_HEADER_SPEED_VS_ACCURACY) {
		return apt_float_value_generate(recog_header->speed_vs_accuracy,value);
	}
	else if(id == RECOGNIZER_HEADER_COMPLETION_CAUSE) {
		const apt_str_t *name = apt_string_table_str_get(
			v2_completion_cause_string_table,
			RECOGNIZER_COMPLETION_CAUSE_COUNT,
			recog_header->completion_cause);
		return mrcp_completion_cause_generate(recog_header->completion_cause,name,value);
	}
	return mrcp_recog_header_generate(recog_header,id,value);
}
Example #3
0
/** Generate MRCP recognizer header */
static apt_bool_t mrcp_recog_header_generate(const mrcp_recog_header_t *recog_header, apr_size_t id, apt_str_t *value, apr_pool_t *pool)
{
	switch(id) {
		case RECOGNIZER_HEADER_N_BEST_LIST_LENGTH:
			apt_size_value_generate(recog_header->n_best_list_length,value,pool);
			break;
		case RECOGNIZER_HEADER_NO_INPUT_TIMEOUT:
			apt_size_value_generate(recog_header->no_input_timeout,value,pool);
			break;
		case RECOGNIZER_HEADER_RECOGNITION_TIMEOUT:
			apt_size_value_generate(recog_header->recognition_timeout,value,pool);
			break;
		case RECOGNIZER_HEADER_WAVEFORM_URI:
			*value = recog_header->waveform_uri;
			break;
		case RECOGNIZER_HEADER_RECOGNIZER_CONTEXT_BLOCK:
			*value = recog_header->recognizer_context_block;
			break;
		case RECOGNIZER_HEADER_START_INPUT_TIMERS:
			apt_boolean_value_generate(recog_header->start_input_timers,value,pool);
			break;
		case RECOGNIZER_HEADER_SPEECH_COMPLETE_TIMEOUT:
			apt_size_value_generate(recog_header->speech_complete_timeout,value,pool);
			break;
		case RECOGNIZER_HEADER_SPEECH_INCOMPLETE_TIMEOUT:
			apt_size_value_generate(recog_header->speech_incomplete_timeout,value,pool);
			break;
		case RECOGNIZER_HEADER_DTMF_INTERDIGIT_TIMEOUT:
			apt_size_value_generate(recog_header->dtmf_interdigit_timeout,value,pool);
			break;
		case RECOGNIZER_HEADER_DTMF_TERM_TIMEOUT:
			apt_size_value_generate(recog_header->dtmf_term_timeout,value,pool);
			break;
		case RECOGNIZER_HEADER_DTMF_TERM_CHAR:
			value->length = 1;
			value->buf = apr_palloc(pool,value->length);
			*value->buf	= recog_header->dtmf_term_char;
			break;
		case RECOGNIZER_HEADER_FAILED_URI:
			*value = recog_header->failed_uri;
			break;
		case RECOGNIZER_HEADER_FAILED_URI_CAUSE:
			*value = recog_header->failed_uri_cause;
			break;
		case RECOGNIZER_HEADER_SAVE_WAVEFORM:
			apt_boolean_value_generate(recog_header->save_waveform,value,pool);
			break;
		case RECOGNIZER_HEADER_NEW_AUDIO_CHANNEL:
			apt_boolean_value_generate(recog_header->new_audio_channel,value,pool);
			break;
		case RECOGNIZER_HEADER_SPEECH_LANGUAGE:
			*value = recog_header->speech_language;
			break;
		case RECOGNIZER_HEADER_INPUT_TYPE:
			*value = recog_header->input_type;
			break;
		case RECOGNIZER_HEADER_INPUT_WAVEFORM_URI:
			*value = recog_header->input_waveform_uri;
			break;
		case RECOGNIZER_HEADER_COMPLETION_REASON:
			*value = recog_header->completion_reason;
			break;
		case RECOGNIZER_HEADER_MEDIA_TYPE:
			*value = recog_header->media_type;
			break;
		case RECOGNIZER_HEADER_VER_BUFFER_UTTERANCE:
			apt_boolean_value_generate(recog_header->ver_buffer_utterance,value,pool);
			break;
		case RECOGNIZER_HEADER_RECOGNITION_MODE:
			*value = recog_header->recognition_mode;
			break;
		case RECOGNIZER_HEADER_CANCEL_IF_QUEUE:
			apt_boolean_value_generate(recog_header->cancel_if_queue,value,pool);
			break;
		case RECOGNIZER_HEADER_HOTWORD_MAX_DURATION:
			apt_size_value_generate(recog_header->hotword_max_duration,value,pool);
			break;
		case RECOGNIZER_HEADER_HOTWORD_MIN_DURATION:
			apt_size_value_generate(recog_header->hotword_min_duration,value,pool);
			break;
		case RECOGNIZER_HEADER_INTERPRET_TEXT:
			*value = recog_header->interpret_text;
			break;
		case RECOGNIZER_HEADER_DTMF_BUFFER_TIME:
			apt_size_value_generate(recog_header->dtmf_buffer_time,value,pool);
			break;
		case RECOGNIZER_HEADER_CLEAR_DTMF_BUFFER:
			apt_boolean_value_generate(recog_header->clear_dtmf_buffer,value,pool);
			break;
		case RECOGNIZER_HEADER_EARLY_NO_MATCH:
			apt_boolean_value_generate(recog_header->early_no_match,value,pool);
			break;
		case RECOGNIZER_HEADER_NUM_MIN_CONSISTENT_PRONUNCIATIONS:
			apt_size_value_generate(recog_header->num_min_consistent_pronunciations,value,pool);
			break;
		case RECOGNIZER_HEADER_CONSISTENCY_THRESHOLD:
			apt_float_value_generate(recog_header->consistency_threshold,value,pool);
			break;
		case RECOGNIZER_HEADER_CLASH_THRESHOLD:
			apt_float_value_generate(recog_header->clash_threshold,value,pool);
			break;
		case RECOGNIZER_HEADER_PERSONAL_GRAMMAR_URI:
			*value = recog_header->personal_grammar_uri;
			break;
		case RECOGNIZER_HEADER_ENROLL_UTTERANCE:
			apt_boolean_value_generate(recog_header->enroll_utterance,value,pool);
			break;
		case RECOGNIZER_HEADER_PHRASE_ID:
			*value = recog_header->phrase_id;
			break;
		case RECOGNIZER_HEADER_PHRASE_NL:
			*value = recog_header->phrase_nl;
			break;
		case RECOGNIZER_HEADER_WEIGHT:
			apt_float_value_generate(recog_header->weight,value,pool);
			break;
		case RECOGNIZER_HEADER_SAVE_BEST_WAVEFORM:
			apt_boolean_value_generate(recog_header->save_best_waveform,value,pool);
			break;
		case RECOGNIZER_HEADER_NEW_PHRASE_ID:
			*value = recog_header->new_phrase_id;
			break;
		case RECOGNIZER_HEADER_CONFUSABLE_PHRASES_URI:
			*value = recog_header->confusable_phrases_uri;
			break;
		case RECOGNIZER_HEADER_ABORT_PHRASE_ENROLLMENT:
			apt_boolean_value_generate(recog_header->abort_phrase_enrollment,value,pool);
			break;
		default:
			break;
	}
	return TRUE;
}
/** Generate MRCP recorder header */
static apt_bool_t mrcp_recorder_header_generate(const mrcp_header_accessor_t *accessor, apr_size_t id, apt_str_t *value, apr_pool_t *pool)
{
	mrcp_recorder_header_t *recorder_header = accessor->data;
	switch(id) {
		case RECORDER_HEADER_SENSITIVITY_LEVEL:
			apt_float_value_generate(recorder_header->sensitivity_level,value,pool);
			break;
		case RECORDER_HEADER_NO_INPUT_TIMEOUT:
			apt_size_value_generate(recorder_header->no_input_timeout,value,pool);
			break;
		case RECORDER_HEADER_COMPLETION_CAUSE:
		{
			apt_completion_cause_generate(
				completion_cause_string_table,
				RECORDER_COMPLETION_CAUSE_COUNT,
				recorder_header->completion_cause,
				value,
				pool);
			break;
		}
		case RECORDER_HEADER_COMPLETION_REASON:
			*value = recorder_header->completion_reason;
			break;
		case RECORDER_HEADER_FAILED_URI:
			*value = recorder_header->failed_uri;
			break;
		case RECORDER_HEADER_FAILED_URI_CAUSE:
			*value = recorder_header->failed_uri_cause;
			break;
		case RECORDER_HEADER_RECORD_URI:
			*value = recorder_header->record_uri;
			break;
		case RECORDER_HEADER_MEDIA_TYPE:
			*value = recorder_header->media_type;
			break;
		case RECORDER_HEADER_MAX_TIME:
			apt_size_value_generate(recorder_header->max_time,value,pool);
			break;
		case RECORDER_HEADER_TRIM_LENGTH:
			apt_size_value_generate(recorder_header->trim_length,value,pool);
			break;
		case RECORDER_HEADER_FINAL_SILENCE:
			apt_size_value_generate(recorder_header->final_silence,value,pool);
			break;
		case RECORDER_HEADER_CAPTURE_ON_SPEECH:
			apt_boolean_value_generate(recorder_header->capture_on_speech,value,pool);
			break;
		case RECORDER_HEADER_VER_BUFFER_UTTERANCE:
			apt_boolean_value_generate(recorder_header->ver_buffer_utterance,value,pool);
			break;
		case RECORDER_HEADER_START_INPUT_TIMERS:
			apt_boolean_value_generate(recorder_header->start_input_timers,value,pool);
			break;
		case RECORDER_HEADER_NEW_AUDIO_CHANNEL:
			apt_boolean_value_generate(recorder_header->new_audio_channel,value,pool);
			break;
		default:
			break;
	}
	return TRUE;
}