[Freeswitch-svn] [commit] r5545 - in freeswitch/trunk/src: . include
Freeswitch SVN
anthm at freeswitch.org
Wed Jul 25 20:49:03 EDT 2007
Author: anthm
Date: Wed Jul 25 20:49:02 2007
New Revision: 5545
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/switch_core_state_machine.c
freeswitch/trunk/src/switch_ivr.c
freeswitch/trunk/src/switch_ivr_bridge.c
Log:
add exec_after_bridge_app and exec_after_bridge_arg and fix the hangup command in event parse
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Wed Jul 25 20:49:02 2007
@@ -117,6 +117,8 @@
#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_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 @@
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;
Modified: freeswitch/trunk/src/switch_core_state_machine.c
==============================================================================
--- freeswitch/trunk/src/switch_core_state_machine.c (original)
+++ freeswitch/trunk/src/switch_core_state_machine.c Wed Jul 25 20:49:02 2007
@@ -120,6 +120,9 @@
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 @@
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;
}
Modified: freeswitch/trunk/src/switch_ivr.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr.c (original)
+++ freeswitch/trunk/src/switch_ivr.c Wed Jul 25 20:49:02 2007
@@ -283,7 +283,6 @@
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);
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Wed Jul 25 20:49:02 2007
@@ -56,6 +56,7 @@
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 @@
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 @@
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));
}
More information about the Freeswitch-svn
mailing list