[Freeswitch-trunk] [commit] r12691 - in freeswitch/trunk/src: . include
FreeSWITCH SVN
anthm at freeswitch.org
Fri Mar 20 13:40:30 PDT 2009
Author: anthm
Date: Fri Mar 20 15:40:30 2009
New Revision: 12691
Log:
add transfer_after_bridge magic var
Modified:
freeswitch/trunk/src/include/switch_types.h
freeswitch/trunk/src/switch_ivr_bridge.c
Modified: freeswitch/trunk/src/include/switch_types.h
==============================================================================
--- freeswitch/trunk/src/include/switch_types.h (original)
+++ freeswitch/trunk/src/include/switch_types.h Fri Mar 20 15:40:30 2009
@@ -160,6 +160,7 @@
#define SWITCH_LOCAL_VIDEO_PORT_VARIABLE "local_video_port"
#define SWITCH_HANGUP_AFTER_BRIDGE_VARIABLE "hangup_after_bridge"
#define SWITCH_PARK_AFTER_BRIDGE_VARIABLE "park_after_bridge"
+#define SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE "transfer_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"
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Fri Mar 20 15:40:30 2009
@@ -456,11 +456,27 @@
return NULL;
}
+static void transfer_after_bridge(switch_core_session_t *session, const char *where)
+{
+ int argc;
+ char *argv[4] = { 0 };
+ char *mydata;
+
+ if (!switch_strlen_zero(where) && (mydata = switch_core_session_strdup(session, where))) {
+ if ((argc = switch_separate_string(mydata, ':', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
+ switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
+ } else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "No extension specified.\n");
+ }
+ }
+}
+
static switch_status_t audio_bridge_on_exchange_media(switch_core_session_t *session)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_ivr_bridge_data_t *bd = switch_channel_get_private(channel, "_bridge_");
switch_channel_state_t state;
+ const char *var;
if (bd) {
switch_channel_set_private(channel, "_bridge_", NULL);
@@ -479,6 +495,8 @@
if (state < CS_HANGUP && switch_true(switch_channel_get_variable(channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
switch_ivr_park_session(session);
+ } else if (state < CS_HANGUP && (var = switch_channel_get_variable(channel, SWITCH_TRANSFER_AFTER_BRIDGE_VARIABLE))) {
+ transfer_after_bridge(session, var);
} else {
if (!switch_channel_test_flag(channel, CF_TRANSFER) && !switch_channel_test_flag(channel, CF_REDIRECT) && bd && !bd->clean_exit
&& state != CS_PARK && state != CS_ROUTING && !switch_channel_test_flag(channel, CF_INNER_BRIDGE)) {
@@ -808,6 +826,7 @@
switch_event_t *event;
int br = 0;
int inner_bridge = switch_channel_test_flag(caller_channel, CF_INNER_BRIDGE);
+ const char *var;
switch_channel_set_flag(caller_channel, CF_ORIGINATOR);
@@ -971,6 +990,8 @@
(switch_channel_test_flag(peer_channel, CF_ANSWERED) && state < CS_HANGUP)) {
if (switch_true(switch_channel_get_variable(caller_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
switch_ivr_park_session(session);
+ } else if ((var = switch_channel_get_variable(caller_channel, SWITCH_PARK_AFTER_BRIDGE_VARIABLE))) {
+ transfer_after_bridge(session, var);
} else if (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-trunk
mailing list