/*
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2013, Grasshopper
+ * Copyright (C) 2013-2018, Grasshopper
*
* Version: MPL 1.1
*
ATTRIB(sensitivity, 0.5, decimal_between_zero_and_one)
ATTRIB(min-confidence, 0, decimal_between_zero_and_one)
ATTRIB(max-silence, -1, positive_or_neg_one)
- /* for now, only NLSML */
STRING_ATTRIB(match-content-type, application/nlsml+xml, "application/nlsml+xml")
/* internal attribs for prompt support */
ATTRIB(barge-event, false, bool)
ATTRIB(max-time, -1, positive_or_neg_one)
ATTRIB(renderer,, any)
ATTRIB(voice,, any)
+ STRING_ATTRIB(direction, out, "out,in")
ELEMENT_END
/**
if (!zstr(iks_find_attrib(grammar, "url"))) {
*error = "url not allowed with content-type";
return 0;
- } else if (strcmp("application/srgs+xml", content_type)) {
+ } else if (strcmp("application/srgs+xml", content_type) && strcmp("text/plain", content_type)) {
*error = "Unsupported content type";
return 0;
}
if (json_confidence && json_confidence->valuedouble > 0.0) {
*confidence = json_confidence->valuedouble;
} else {
- *confidence = 100.0;
+ *confidence = 0.99;
}
result_text = text;
} else if (error_text) {
result_text = get_detected_speech_result_text(json_result, &confidence, &error_text);
if (!zstr(result_text)) {
// got result... send as NLSML
- iks *result = nlsml_create_match(result_text, NULL, "speech", (int)confidence);
+ iks *result = nlsml_create_match(result_text, NULL, "speech", (int)(confidence * 100.0));
/* notify of match */
switch_log_printf(SWITCH_CHANNEL_UUID_LOG(uuid), SWITCH_LOG_DEBUG, "MATCH = %s\n", result_text);
send_match_event(RAYO_COMPONENT(component), result);
/*
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
- * Copyright (C) 2013-2016, Grasshopper
+ * Copyright (C) 2013-2018, Grasshopper
*
* Version: MPL 1.1
*
const char *renderer;
/** optional headers to pass to renderer */
const char *headers;
+ /** audio direction */
+ const char *direction;
};
#define OUTPUT_FINISH "finish", RAYO_OUTPUT_COMPLETE_NS
output_component->max_time_ms = iks_find_int_attrib(output, "max-time");
output_component->start_paused = iks_find_bool_attrib(output, "start-paused");
output_component->renderer = switch_core_strdup(RAYO_POOL(output_component), iks_find_attrib_soft(output, "renderer"));
+ output_component->direction = strcmp(iks_find_attrib_soft(output, "direction"), "in") ? "m" : "mr";
output_component->headers = NULL;
/* get custom headers */
{
}
stream.write_function(&stream, "}fileman://rayo://%s", RAYO_JID(component));
- if (switch_ivr_displace_session(session, stream.data, 0, "m") == SWITCH_STATUS_SUCCESS) {
+ if (switch_ivr_displace_session(session, stream.data, 0, OUTPUT_COMPONENT(component)->direction) == SWITCH_STATUS_SUCCESS) {
RAYO_RELEASE(component);
} else {
if (component->complete) {