mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-04-16 16:58:35 +00:00
FS-6159 -resolve mod_rayo: prompt, input, output components return hangup cause if stopped by hangup
This commit is contained in:
parent
915e8eaba1
commit
5be81aef74
@ -114,8 +114,6 @@ struct rayo_actor {
|
|||||||
struct rayo_component {
|
struct rayo_component {
|
||||||
/** base actor class */
|
/** base actor class */
|
||||||
struct rayo_actor base;
|
struct rayo_actor base;
|
||||||
/** component type (input/output/prompt/etc) */
|
|
||||||
const char *type;
|
|
||||||
/** parent to this component */
|
/** parent to this component */
|
||||||
struct rayo_actor *parent;
|
struct rayo_actor *parent;
|
||||||
/** owning client JID */
|
/** owning client JID */
|
||||||
|
@ -1,6 +1,6 @@
|
|||||||
/*
|
/*
|
||||||
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
* mod_rayo for FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
|
||||||
* Copyright (C) 2013, Grasshopper
|
* Copyright (C) 2013-2014, Grasshopper
|
||||||
*
|
*
|
||||||
* Version: MPL 1.1
|
* Version: MPL 1.1
|
||||||
*
|
*
|
||||||
@ -360,7 +360,7 @@ static switch_bool_t input_handler_bug_callback(switch_media_bug_t *bug, void *u
|
|||||||
const void *jid;
|
const void *jid;
|
||||||
void *component;
|
void *component;
|
||||||
switch_core_hash_this(hi, &jid, NULL, &component);
|
switch_core_hash_this(hi, &jid, NULL, &component);
|
||||||
rayo_component_send_complete(RAYO_COMPONENT(component), COMPONENT_COMPLETE_STOP);
|
rayo_component_send_complete(RAYO_COMPONENT(component), COMPONENT_COMPLETE_HANGUP);
|
||||||
}
|
}
|
||||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Removing DTMF callback\n");
|
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Removing DTMF callback\n");
|
||||||
switch_core_event_hook_remove_recv_dtmf(session, input_handler_on_dtmf);
|
switch_core_event_hook_remove_recv_dtmf(session, input_handler_on_dtmf);
|
||||||
|
@ -516,9 +516,26 @@ static switch_status_t rayo_file_close(switch_file_handle_t *handle)
|
|||||||
if (output->stop) {
|
if (output->stop) {
|
||||||
rayo_component_send_complete(context->component, COMPONENT_COMPLETE_STOP);
|
rayo_component_send_complete(context->component, COMPONENT_COMPLETE_STOP);
|
||||||
} else {
|
} else {
|
||||||
rayo_component_send_complete(context->component, OUTPUT_FINISH);
|
if (!strcmp(RAYO_ACTOR(context->component)->type, RAT_CALL_COMPONENT)) {
|
||||||
|
/* call output... check for hangup */
|
||||||
|
switch_core_session_t *session = switch_core_session_locate(context->component->parent->id);
|
||||||
|
if (session) {
|
||||||
|
if (switch_channel_get_state(switch_core_session_get_channel(session)) >= CS_HANGUP) {
|
||||||
|
rayo_component_send_complete(context->component, COMPONENT_COMPLETE_HANGUP);
|
||||||
|
} else {
|
||||||
|
rayo_component_send_complete(context->component, OUTPUT_FINISH);
|
||||||
|
}
|
||||||
|
switch_core_session_rwunlock(session);
|
||||||
|
} else {
|
||||||
|
/* session is gone */
|
||||||
|
rayo_component_send_complete(context->component, COMPONENT_COMPLETE_HANGUP);
|
||||||
|
}
|
||||||
|
} else {
|
||||||
|
/* mixer output... finished */
|
||||||
|
rayo_component_send_complete(context->component, OUTPUT_FINISH);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
/* TODO hangup / timed out */
|
/* TODO timed out */
|
||||||
|
|
||||||
/* cleanup internals */
|
/* cleanup internals */
|
||||||
switch_safe_free(context->ssml);
|
switch_safe_free(context->ssml);
|
||||||
|
@ -192,14 +192,12 @@ static iks *prompt_component_handle_input_start(struct rayo_actor *prompt, struc
|
|||||||
PROMPT_COMPONENT(prompt)->state = PCS_INPUT_OUTPUT;
|
PROMPT_COMPONENT(prompt)->state = PCS_INPUT_OUTPUT;
|
||||||
/* send ref to client */
|
/* send ref to client */
|
||||||
rayo_component_send_start(RAYO_COMPONENT(prompt), PROMPT_COMPONENT(prompt)->iq);
|
rayo_component_send_start(RAYO_COMPONENT(prompt), PROMPT_COMPONENT(prompt)->iq);
|
||||||
iks_delete(PROMPT_COMPONENT(prompt)->iq);
|
|
||||||
break;
|
break;
|
||||||
case PCS_START_INPUT_TIMERS:
|
case PCS_START_INPUT_TIMERS:
|
||||||
PROMPT_COMPONENT(prompt)->input_jid = switch_core_strdup(RAYO_POOL(prompt), msg->from_jid);
|
PROMPT_COMPONENT(prompt)->input_jid = switch_core_strdup(RAYO_POOL(prompt), msg->from_jid);
|
||||||
PROMPT_COMPONENT(prompt)->state = PCS_INPUT;
|
PROMPT_COMPONENT(prompt)->state = PCS_INPUT;
|
||||||
/* send ref to client */
|
/* send ref to client */
|
||||||
rayo_component_send_start(RAYO_COMPONENT(prompt), PROMPT_COMPONENT(prompt)->iq);
|
rayo_component_send_start(RAYO_COMPONENT(prompt), PROMPT_COMPONENT(prompt)->iq);
|
||||||
iks_delete(PROMPT_COMPONENT(prompt)->iq);
|
|
||||||
start_input_timers(PROMPT_COMPONENT(prompt));
|
start_input_timers(PROMPT_COMPONENT(prompt));
|
||||||
break;
|
break;
|
||||||
case PCS_DONE:
|
case PCS_DONE:
|
||||||
@ -272,16 +270,22 @@ static iks *prompt_component_handle_input_error(struct rayo_actor *prompt, struc
|
|||||||
RAYO_SEND_REPLY(prompt, RAYO_COMPONENT(prompt)->client_jid, iq);
|
RAYO_SEND_REPLY(prompt, RAYO_COMPONENT(prompt)->client_jid, iq);
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
|
iks_delete(PROMPT_COMPONENT(prompt)->iq);
|
||||||
RAYO_UNLOCK(prompt);
|
RAYO_UNLOCK(prompt);
|
||||||
RAYO_DESTROY(prompt);
|
RAYO_DESTROY(prompt);
|
||||||
|
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case PCS_START_INPUT:
|
case PCS_START_INPUT:
|
||||||
/* send presence error to client */
|
|
||||||
PROMPT_COMPONENT(prompt)->state = PCS_DONE;
|
PROMPT_COMPONENT(prompt)->state = PCS_DONE;
|
||||||
iks_delete(PROMPT_COMPONENT(prompt)->iq);
|
iks_delete(PROMPT_COMPONENT(prompt)->iq);
|
||||||
rayo_component_send_complete(RAYO_COMPONENT(prompt), COMPONENT_COMPLETE_ERROR);
|
if (iks_find(error, "item-not-found")) {
|
||||||
|
/* call is gone (hangup) */
|
||||||
|
rayo_component_send_complete(RAYO_COMPONENT(prompt), COMPONENT_COMPLETE_HANGUP);
|
||||||
|
} else {
|
||||||
|
/* send presence error to client */
|
||||||
|
rayo_component_send_complete(RAYO_COMPONENT(prompt), COMPONENT_COMPLETE_ERROR);
|
||||||
|
}
|
||||||
break;
|
break;
|
||||||
case PCS_START_INPUT_OUTPUT:
|
case PCS_START_INPUT_OUTPUT:
|
||||||
PROMPT_COMPONENT(prompt)->state = PCS_DONE_STOP_OUTPUT;
|
PROMPT_COMPONENT(prompt)->state = PCS_DONE_STOP_OUTPUT;
|
||||||
@ -335,6 +339,7 @@ static iks *prompt_component_handle_output_error(struct rayo_actor *prompt, stru
|
|||||||
RAYO_SEND_REPLY(prompt, RAYO_COMPONENT(prompt)->client_jid, iq);
|
RAYO_SEND_REPLY(prompt, RAYO_COMPONENT(prompt)->client_jid, iq);
|
||||||
|
|
||||||
/* done */
|
/* done */
|
||||||
|
iks_delete(PROMPT_COMPONENT(prompt)->iq);
|
||||||
RAYO_UNLOCK(prompt);
|
RAYO_UNLOCK(prompt);
|
||||||
RAYO_DESTROY(prompt);
|
RAYO_DESTROY(prompt);
|
||||||
|
|
||||||
@ -421,6 +426,7 @@ static iks *prompt_component_handle_input_complete(struct rayo_actor *prompt, st
|
|||||||
presence = iks_copy(presence);
|
presence = iks_copy(presence);
|
||||||
iks_insert_attrib(presence, "from", RAYO_JID(prompt));
|
iks_insert_attrib(presence, "from", RAYO_JID(prompt));
|
||||||
iks_insert_attrib(presence, "to", RAYO_COMPONENT(prompt)->client_jid);
|
iks_insert_attrib(presence, "to", RAYO_COMPONENT(prompt)->client_jid);
|
||||||
|
iks_delete(PROMPT_COMPONENT(prompt)->iq);
|
||||||
rayo_component_send_complete_event(RAYO_COMPONENT(prompt), presence);
|
rayo_component_send_complete_event(RAYO_COMPONENT(prompt), presence);
|
||||||
break;
|
break;
|
||||||
case PCS_OUTPUT:
|
case PCS_OUTPUT:
|
||||||
@ -466,7 +472,6 @@ static iks *prompt_component_handle_output_complete(struct rayo_actor *prompt, s
|
|||||||
PROMPT_COMPONENT(prompt)->state = PCS_START_INPUT;
|
PROMPT_COMPONENT(prompt)->state = PCS_START_INPUT;
|
||||||
/* start input with timers enabled and barge events disabled */
|
/* start input with timers enabled and barge events disabled */
|
||||||
start_input(PROMPT_COMPONENT(prompt), 1, 0);
|
start_input(PROMPT_COMPONENT(prompt), 1, 0);
|
||||||
iks_delete(PROMPT_COMPONENT(prompt)->iq);
|
|
||||||
break;
|
break;
|
||||||
case PCS_START_INPUT_OUTPUT:
|
case PCS_START_INPUT_OUTPUT:
|
||||||
/* output finished before input started */
|
/* output finished before input started */
|
||||||
@ -482,6 +487,7 @@ static iks *prompt_component_handle_output_complete(struct rayo_actor *prompt, s
|
|||||||
break;
|
break;
|
||||||
case PCS_DONE_STOP_OUTPUT:
|
case PCS_DONE_STOP_OUTPUT:
|
||||||
if (PROMPT_COMPONENT(prompt)->complete) {
|
if (PROMPT_COMPONENT(prompt)->complete) {
|
||||||
|
iks_delete(PROMPT_COMPONENT(prompt)->iq);
|
||||||
rayo_component_send_complete_event(RAYO_COMPONENT(prompt), PROMPT_COMPONENT(prompt)->complete);
|
rayo_component_send_complete_event(RAYO_COMPONENT(prompt), PROMPT_COMPONENT(prompt)->complete);
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user