and mux it with any audio from other channels. */
while (switch_test_flag(member, MFLAG_RUNNING) && switch_channel_ready(channel)) {
+
+ if (switch_channel_test_flag(channel, CF_SERVICE)) {
+ switch_yield(100000);
+ continue;
+ }
+
+
/* Read a frame. */
status = switch_core_session_read_frame(member->session, &read_frame, SWITCH_IO_FLAG_NONE, 0);
}
switch_clear_flag_locked(member, MFLAG_FLUSH_BUFFER);
}
-
+
switch_mutex_unlock(member->flag_mutex);
+
+ if (switch_core_session_private_event_count(member->session)) {
+ switch_channel_set_flag(channel, CF_SERVICE);
+ switch_ivr_parse_all_events(member->session);
+ switch_channel_clear_flag(channel, CF_SERVICE);
+ switch_set_flag_locked(member, MFLAG_FLUSH_BUFFER);
+ switch_core_session_set_read_codec(member->session, &member->read_codec);
+ }
+
if (use_timer) {
switch_core_timer_next(&timer);
} else {
/* print debug info */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "INFO DTMF(%c)\n", dtmf.digit);
+
+ if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
+ const char *uuid;
+ switch_core_session_t *session_b;
+
+ if ((uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE)) && (session_b = switch_core_session_locate(uuid))) {
+ while (switch_channel_has_dtmf(channel)) {
+ switch_dtmf_t idtmf = { 0, 0 };
+ if (switch_channel_dequeue_dtmf(channel, &idtmf) == SWITCH_STATUS_SUCCESS) {
+ switch_core_session_send_dtmf(session_b, &idtmf);
+ }
+ }
+
+ switch_core_session_rwunlock(session_b);
+ }
+ }
/* Send 200 OK response */
nua_respond(nh, SIP_200_OK, NUTAG_WITH_THIS(nua), TAG_END());
#define SWITCH_META_VAR_KEY "__dtmf_meta"
+typedef struct {
+ switch_core_session_t *session;
+ const char *app;
+ int flags;
+} bch_t;
+
+static void *SWITCH_THREAD_FUNC bcast_thread(switch_thread_t *thread, void *obj)
+{
+ bch_t *bch = (bch_t *) obj;
+
+ switch_ivr_broadcast(switch_core_session_get_uuid(bch->session), bch->app, bch->flags);
+
+ return NULL;
+
+}
+static void broadcast_in_thread(switch_core_session_t *session, const char *app, int flags)
+{
+ switch_thread_t *thread;
+ switch_threadattr_t *thd_attr = NULL;
+ switch_memory_pool_t *pool;
+ bch_t *bch;
+
+ switch_assert(session);
+
+ pool = switch_core_session_get_pool(session);
+
+ bch = switch_core_session_alloc(session, sizeof(*bch));
+ bch->session = session;
+ bch->app = app;
+ bch->flags = flags;
+
+
+ switch_threadattr_create(&thd_attr, pool);
+ switch_threadattr_detach_set(thd_attr, 1);
+ switch_threadattr_stacksize_set(thd_attr, SWITCH_THREAD_STACKSIZE);
+ switch_thread_create(&thread, thd_attr, bcast_thread, bch, pool);
+}
+
static switch_status_t meta_on_dtmf(switch_core_session_t *session, const switch_dtmf_t *dtmf, switch_dtmf_direction_t direction)
{
switch_channel_t *channel = switch_core_session_get_channel(session);
if (ok && md->sr[direction].map[dval].app) {
uint32_t flags = md->sr[direction].map[dval].flags;
-
+
if ((md->sr[direction].map[dval].bind_flags & SBF_EXEC_OPPOSITE)) {
if (direction == SWITCH_DTMF_SEND) {
flags |= SMF_ECHO_ALEG;
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "%s Processing meta digit '%c' [%s]\n",
switch_channel_get_name(channel), dtmf->digit, md->sr[direction].map[dval].app);
- switch_ivr_broadcast(switch_core_session_get_uuid(session), md->sr[direction].map[dval].app, flags);
+
+ if (switch_channel_test_flag(channel, CF_PROXY_MODE)) {
+ broadcast_in_thread(session, md->sr[direction].map[dval].app, flags | SMF_REBRIDGE);
+ } else {
+ switch_ivr_broadcast(switch_core_session_get_uuid(session), md->sr[direction].map[dval].app, flags);
+ }
if ((md->sr[direction].map[dval].bind_flags & SBF_ONCE)) {
memset(&md->sr[direction].map[dval], 0, sizeof(md->sr[direction].map[dval]));
md->sr[SWITCH_DTMF_RECV].map[key].app = switch_core_session_strdup(session, app);
md->sr[SWITCH_DTMF_RECV].map[key].flags |= SMF_HOLD_BLEG;
md->sr[SWITCH_DTMF_RECV].map[key].bind_flags = bind_flags;
-
+
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_INFO, "Bound A-Leg: %d %s\n", key, app);
}
if ((bind_flags & SBF_DIAL_BLEG)) {
other_session = NULL;
}
+ if (switch_stristr("record", app)) {
+ nomedia = 0;
+ }
+
if ((flags & SMF_ECHO_ALEG)) {
if (switch_event_create(&event, SWITCH_EVENT_COMMAND) == SWITCH_STATUS_SUCCESS) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "call-command", "execute");