mirror of
https://github.com/signalwire/freeswitch.git
synced 2025-03-12 12:18:18 +00:00
add exec_after_bridge_app and exec_after_bridge_arg and fix the hangup command in event parse
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5545 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
d571f9020e
commit
189802c555
@ -117,6 +117,8 @@ SWITCH_BEGIN_EXTERN_C
|
||||
#define SWITCH_LOCAL_VIDEO_IP_VARIABLE "local_video_ip"
|
||||
#define SWITCH_LOCAL_VIDEO_PORT_VARIABLE "local_video_port"
|
||||
#define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE "hangup_after_bridge"
|
||||
#define SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE "exec_after_bridge_app"
|
||||
#define SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE "exec_after_bridge_arg"
|
||||
#define SWITCH_MAX_FORWARDS_VARIABLE "max_forwards"
|
||||
#define SWITCH_SPEECH_KEY "speech"
|
||||
#define SWITCH_UUID_BRIDGE "uuid_bridge"
|
||||
@ -576,6 +578,7 @@ CF_BROADCAST = (1 << 20) - Channel is broadcasting
|
||||
CF_UNICAST = (1 << 21) - Channel has a unicast connection
|
||||
CF_VIDEO = (1 << 22) - Channel has video
|
||||
CF_EVENT_LOCK = (1 << 23) - Don't parse events
|
||||
CF_RESET = (1 << 24) - Tell extension parser to reset
|
||||
</pre>
|
||||
*/
|
||||
|
||||
@ -603,7 +606,8 @@ typedef enum {
|
||||
CF_BROADCAST = (1 << 20),
|
||||
CF_UNICAST = (1 << 21),
|
||||
CF_VIDEO = (1 << 22),
|
||||
CF_EVENT_LOCK = (1 << 23)
|
||||
CF_EVENT_LOCK = (1 << 23),
|
||||
CF_RESET = (1 << 24)
|
||||
} switch_channel_flag_t;
|
||||
|
||||
|
||||
|
@ -120,6 +120,9 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
|
||||
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Standard EXECUTE\n");
|
||||
|
||||
top:
|
||||
switch_channel_clear_flag(session->channel, CF_RESET);
|
||||
|
||||
if ((extension = switch_channel_get_caller_extension(session->channel)) == 0) {
|
||||
switch_channel_hangup(session->channel, SWITCH_CAUSE_NORMAL_CLEARING);
|
||||
return;
|
||||
@ -169,6 +172,11 @@ static void switch_core_standard_on_execute(switch_core_session_t *session)
|
||||
if (expanded != extension->current_application->application_data) {
|
||||
switch_safe_free(expanded);
|
||||
}
|
||||
|
||||
if (switch_channel_test_flag(session->channel, CF_RESET)) {
|
||||
goto top;
|
||||
}
|
||||
|
||||
extension->current_application = extension->current_application->next;
|
||||
}
|
||||
|
||||
|
@ -283,7 +283,6 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_parse_event(switch_core_session_t *se
|
||||
return SWITCH_STATUS_FALSE;
|
||||
}
|
||||
|
||||
hlen = (switch_size_t) strlen(cmd);
|
||||
cmd_hash = switch_hashfunc_default(cmd, &hlen);
|
||||
|
||||
switch_channel_set_flag(channel, CF_EVENT_PARSE);
|
||||
|
@ -56,6 +56,7 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
|
||||
switch_frame_t *read_frame;
|
||||
switch_core_session_t *session_a, *session_b;
|
||||
uint32_t loop_count = 0;
|
||||
char *app_name = NULL, *app_arg = NULL;
|
||||
|
||||
session_a = data->session;
|
||||
if (!(session_b = switch_core_session_locate(data->b_uuid))) {
|
||||
@ -186,6 +187,27 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
|
||||
msg.from = __FILE__;
|
||||
switch_core_session_receive_message(session_a, &msg);
|
||||
|
||||
|
||||
if ((app_name = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_APP_VARIABLE))) {
|
||||
switch_caller_extension_t *extension = NULL;
|
||||
if ((extension = switch_caller_extension_new(session_a, app_name, app_name)) == 0) {
|
||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "memory error!\n");
|
||||
goto end;
|
||||
}
|
||||
app_arg = switch_channel_get_variable(chan_a, SWITCH_EXEC_AFTER_BRIDGE_ARG_VARIABLE);
|
||||
|
||||
switch_caller_extension_add_application(session_a, extension, (char *) app_name, app_arg);
|
||||
switch_channel_set_caller_extension(chan_a, extension);
|
||||
|
||||
if (switch_channel_get_state(chan_a) == CS_EXECUTE) {
|
||||
switch_channel_set_flag(chan_a, CF_RESET);
|
||||
} else {
|
||||
switch_channel_set_state(chan_a, CS_EXECUTE);
|
||||
}
|
||||
}
|
||||
|
||||
end:
|
||||
|
||||
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
|
||||
switch_core_session_reset(session_a);
|
||||
switch_channel_set_variable(chan_a, SWITCH_BRIDGE_VARIABLE, NULL);
|
||||
@ -641,8 +663,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses
|
||||
|
||||
done:
|
||||
|
||||
if (switch_channel_get_state(caller_channel) < CS_HANGUP
|
||||
&& switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
|
||||
if (switch_channel_get_state(caller_channel) < CS_HANGUP &&
|
||||
switch_true(switch_channel_get_variable(caller_channel, SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE))) {
|
||||
switch_channel_hangup(caller_channel, switch_channel_get_cause(peer_channel));
|
||||
}
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user