death star will be in firing range in 10 minutes
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@7866 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
495deafd32
commit
9c88a5ea45
|
@ -747,7 +747,8 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_read(switch_core_session_t *session,
|
|||
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);
|
||||
|
||||
|
||||
|
|
|
@ -79,19 +79,20 @@ SWITCH_STANDARD_APP(exe_function)
|
|||
}
|
||||
}
|
||||
|
||||
#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 @@ SWITCH_STANDARD_APP(transfer_function)
|
|||
|
||||
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");
|
||||
}
|
||||
|
|
|
@ -1260,6 +1260,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_tone_detect_session(switch_core_sessi
|
|||
|
||||
typedef struct {
|
||||
const char *app;
|
||||
uint32_t flags;
|
||||
} dtmf_meta_app_t;
|
||||
|
||||
typedef struct {
|
||||
|
@ -1307,7 +1308,7 @@ static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch
|
|||
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 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_unbind_dtmf_meta_session(switch_core_
|
|||
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 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_bind_dtmf_meta_session(switch_core_se
|
|||
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;
|
||||
}
|
||||
|
||||
|
|
|
@ -137,7 +137,7 @@ static void *audio_bridge_thread(switch_thread_t * thread, void *obj)
|
|||
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;
|
||||
|
|
Loading…
Reference in New Issue