From: Chris Rienzo Date: Fri, 13 Jun 2014 16:34:19 +0000 (-0400) Subject: FS-6535 mod_rayo: close recognizer when input component is complete X-Git-Tag: v1.5.13~175 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=633dfe2a56fea01c41b610c5c6a2161ef2019176;p=thirdparty%2Ffreeswitch.git FS-6535 mod_rayo: close recognizer when input component is complete --- diff --git a/src/mod/event_handlers/mod_rayo/rayo_input_component.c b/src/mod/event_handlers/mod_rayo/rayo_input_component.c index cfada79370..76bffff055 100644 --- a/src/mod/event_handlers/mod_rayo/rayo_input_component.c +++ b/src/mod/event_handlers/mod_rayo/rayo_input_component.c @@ -720,6 +720,22 @@ static char *create_input_component_id(switch_core_session_t *session, iks *inpu return switch_core_session_sprintf(session, "%s-input-%s", switch_core_session_get_uuid(session), mode); } +/** + * Release any resources consumed by this input component + */ +static void input_component_cleanup(struct rayo_actor *component) +{ + switch_mutex_lock(component->mutex); + if (INPUT_COMPONENT(component)->speech_mode) { + switch_core_session_t *session = switch_core_session_locate(component->parent->id); + if (session) { + switch_ivr_stop_detect_speech(session); + switch_core_session_rwunlock(session); + } + } + switch_mutex_unlock(component->mutex); +} + /** * Start execution of input component */ @@ -745,7 +761,7 @@ static iks *start_call_input_component(struct rayo_actor *call, struct rayo_mess switch_core_new_memory_pool(&pool); input_component = switch_core_alloc(pool, sizeof(*input_component)); - input_component = INPUT_COMPONENT(rayo_component_init(RAYO_COMPONENT(input_component), pool, RAT_CALL_COMPONENT, "input", component_id, call, iks_find_attrib(iq, "from"))); + input_component = INPUT_COMPONENT(rayo_component_init_cleanup(RAYO_COMPONENT(input_component), pool, RAT_CALL_COMPONENT, "input", component_id, call, iks_find_attrib(iq, "from"), input_component_cleanup)); if (!input_component) { switch_core_destroy_memory_pool(&pool); return iks_new_error_detailed(iq, STANZA_ERROR_INTERNAL_SERVER_ERROR, "Failed to create input entity");