[Freeswitch-svn] [commit] r7866 - in freeswitch/trunk/src: . include mod/applications/mod_dptools
Freeswitch SVN
anthm at freeswitch.org
Tue Mar 11 18:19:18 EDT 2008
Author: anthm
Date: Tue Mar 11 18:19:17 2008
New Revision: 7866
Modified:
freeswitch/trunk/src/include/switch_ivr.h
freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
freeswitch/trunk/src/switch_ivr_async.c
freeswitch/trunk/src/switch_ivr_bridge.c
Log:
death star will be in firing range in 10 minutes
Modified: freeswitch/trunk/src/include/switch_ivr.h
==============================================================================
--- freeswitch/trunk/src/include/switch_ivr.h (original)
+++ freeswitch/trunk/src/include/switch_ivr.h Tue Mar 11 18:19:17 2008
@@ -747,7 +747,8 @@
uint32_t timeout,
const char *valid_terminators);
-SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key, const char *app);
+SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
+ switch_bool_t dial_b, switch_bool_t exec_b, const char *app);
SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_session_t *session);
Modified: freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c
==============================================================================
--- freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c (original)
+++ freeswitch/trunk/src/mod/applications/mod_dptools/mod_dptools.c Tue Mar 11 18:19:17 2008
@@ -79,19 +79,20 @@
}
}
-#define BIND_SYNTAX "<key> <app>"
+#define BIND_SYNTAX "<key> [a|b] [a|b] <app>"
SWITCH_STANDARD_APP(dtmf_bind_function)
{
- char *argv[2] = { 0 };
+ char *argv[4] = { 0 };
int argc;
char *lbuf = NULL;
if (!switch_strlen_zero(data) && (lbuf = switch_core_session_strdup(session, data))
- && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 2) {
+ && (argc = switch_separate_string(lbuf, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) == 4) {
int kval = atoi(argv[0]);
- if (switch_ivr_bind_dtmf_meta_session(session, kval, argv[1]) == SWITCH_STATUS_SUCCESS) {
- switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound: %s %s\n", argv[0], argv[1]);
- } else {
+ char a1 = tolower(*argv[1]);
+ char a2 = tolower(*argv[2]);
+
+ if (switch_ivr_bind_dtmf_meta_session(session, kval, a1 == 'b', a2 == 'b', argv[3]) != SWITCH_STATUS_SUCCESS) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Bind Error!\n");
}
} else {
@@ -207,7 +208,19 @@
if (!switch_strlen_zero(data) && (mydata = switch_core_session_strdup(session, data))) {
if ((argc = switch_separate_string(mydata, ' ', argv, (sizeof(argv) / sizeof(argv[0])))) >= 1) {
- switch_ivr_session_transfer(session, argv[0], argv[1], argv[2]);
+ if (!strcasecmp(argv[0], "-bleg")) {
+ const char *uuid;
+ switch_channel_t *channel = switch_core_session_get_channel(session);
+ if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE))) {
+ switch_core_session_t *b_session;
+ if ((b_session = switch_core_session_locate(uuid))) {
+ switch_ivr_session_transfer(b_session, argv[1], argv[2], argv[3]);
+ switch_core_session_rwunlock(b_session);
+ }
+ }
+ } else {
+ 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");
}
Modified: freeswitch/trunk/src/switch_ivr_async.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_async.c (original)
+++ freeswitch/trunk/src/switch_ivr_async.c Tue Mar 11 18:19:17 2008
@@ -1260,6 +1260,7 @@
typedef struct {
const char *app;
+ uint32_t flags;
} dtmf_meta_app_t;
typedef struct {
@@ -1307,7 +1308,7 @@
if (md->map[dval].app) {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Processing meta digit '%c' [%s]\n",
switch_channel_get_name(channel), dtmf->digit, md->map[dval].app);
- switch_ivr_broadcast(switch_core_session_get_uuid(session), md->map[dval].app, SMF_ECHO_ALEG);
+ switch_ivr_broadcast(switch_core_session_get_uuid(session), md->map[dval].app, md->map[dval].flags);
} else {
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "%s Ignoring meta digit '%c' not mapped\n",
switch_channel_get_name(channel), dtmf->digit);
@@ -1329,7 +1330,8 @@
return SWITCH_STATUS_SUCCESS;
}
-SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key, const char *app)
+SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_session_t *session, uint32_t key,
+ switch_bool_t dial_b, switch_bool_t exec_b, const char *app)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
dtmf_meta_data_t *md = switch_channel_get_private(channel, SWITCH_META_VAR_KEY);
@@ -1342,12 +1344,19 @@
if (!md) {
md = switch_core_session_alloc(session, sizeof(*md));
switch_channel_set_private(channel, SWITCH_META_VAR_KEY, md);
- switch_core_event_hook_add_recv_dtmf(session, meta_on_dtmf);
+ if (dial_b) {
+ switch_core_event_hook_add_send_dtmf(session, meta_on_dtmf);
+ } else {
+ switch_core_event_hook_add_recv_dtmf(session, meta_on_dtmf);
+ }
}
if (!switch_strlen_zero(app)) {
md->map[key].app = switch_core_session_strdup(session, app);
+ md->map[key].flags = exec_b ? SMF_ECHO_BLEG : SMF_ECHO_ALEG;
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound: %d %s\n", key, app);
} else {
+ switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "UnBound: %d\n", key);
md->map[key].app = NULL;
}
Modified: freeswitch/trunk/src/switch_ivr_bridge.c
==============================================================================
--- freeswitch/trunk/src/switch_ivr_bridge.c (original)
+++ freeswitch/trunk/src/switch_ivr_bridge.c Tue Mar 11 18:19:17 2008
@@ -137,7 +137,7 @@
break;
}
- if (switch_channel_test_flag(chan_a, CF_TRANSFER)) {
+ if (switch_channel_test_flag(chan_a, CF_TRANSFER) || switch_channel_test_flag(chan_b, CF_TRANSFER)) {
switch_channel_clear_flag(chan_a, CF_HOLD);
switch_channel_clear_flag(chan_a, CF_SUSPEND);
break;
More information about the Freeswitch-svn
mailing list