add import vars to fifo

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@12722 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-03-23 16:06:32 +00:00
parent 8c1dee5ac9
commit a000f0bc89
3 changed files with 82 additions and 79 deletions

View File

@ -799,6 +799,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_digit_stream_parser_set_terminator(sw
SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name); SWITCH_DECLARE(switch_say_type_t) switch_ivr_get_say_type_by_name(const char *name);
SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data); SWITCH_DECLARE(switch_status_t) switch_ivr_set_user(switch_core_session_t *session, const char *data);
SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session); SWITCH_DECLARE(switch_status_t) switch_ivr_sound_test(switch_core_session_t *session);
SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname);
/** @} */ /** @} */
SWITCH_END_EXTERN_C SWITCH_END_EXTERN_C

View File

@ -1253,6 +1253,8 @@ SWITCH_STANDARD_APP(fifo_function)
switch_core_media_bug_resume(session); switch_core_media_bug_resume(session);
switch_core_media_bug_resume(other_session); switch_core_media_bug_resume(other_session);
switch_process_import(session, other_channel, "fifo_caller_consumer_import");
switch_process_import(other_session, channel, "fifo_consumer_caller_import");
switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session); switch_ivr_multi_threaded_bridge(session, other_session, on_dtmf, other_session, session);
switch_core_media_bug_pause(session); switch_core_media_bug_pause(session);
switch_core_media_bug_pause(other_session); switch_core_media_bug_pause(other_session);

View File

@ -841,7 +841,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
return (!caller_channel || switch_channel_ready(caller_channel)) ? status : SWITCH_STATUS_FALSE; return (!caller_channel || switch_channel_ready(caller_channel)) ? status : SWITCH_STATUS_FALSE;
} }
static void process_import(switch_core_session_t *session, switch_channel_t *peer_channel) SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname)
{ {
const char *import, *val; const char *import, *val;
switch_channel_t *caller_channel; switch_channel_t *caller_channel;
@ -849,7 +849,7 @@ static void process_import(switch_core_session_t *session, switch_channel_t *pee
switch_assert(session && peer_channel); switch_assert(session && peer_channel);
caller_channel = switch_core_session_get_channel(session); caller_channel = switch_core_session_get_channel(session);
if ((import = switch_channel_get_variable(caller_channel, "import"))) { if ((import = switch_channel_get_variable(caller_channel, varname))) {
char *mydata = switch_core_session_strdup(session, import); char *mydata = switch_core_session_strdup(session, import);
int i, argc; int i, argc;
char *argv[64] = { 0 }; char *argv[64] = { 0 };
@ -1956,7 +1956,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
} else { } else {
status = SWITCH_STATUS_FALSE; status = SWITCH_STATUS_FALSE;
if (caller_channel && peer_channel) { if (caller_channel && peer_channel) {
process_import(oglobals.session, peer_channel); switch_process_import(oglobals.session, peer_channel, "import");
} }
peer_channel = NULL; peer_channel = NULL;
goto done; goto done;
@ -2007,7 +2007,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
if (caller_channel) { if (caller_channel) {
switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted"); switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted");
if (peer_channel) { if (peer_channel) {
process_import(oglobals.session, peer_channel); switch_process_import(oglobals.session, peer_channel, "import");
} }
} }
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", switch_channel_get_name(peer_channel)); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n", switch_channel_get_name(peer_channel));