allow process_import to specify a prefix
This commit is contained in:
parent
f69f4a7747
commit
e0c37c1f6e
|
@ -840,7 +840,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_say_ip(switch_core_session_t *session
|
|||
|
||||
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(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname);
|
||||
SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname, const char *prefix);
|
||||
SWITCH_DECLARE(switch_bool_t) switch_ivr_uuid_exists(const char *uuid);
|
||||
|
||||
|
||||
|
|
|
@ -998,8 +998,10 @@ static switch_status_t messagehook (switch_core_session_t *session, switch_core_
|
|||
|
||||
if (caller_channel) {
|
||||
switch_channel_set_variable(caller_channel, "fifo_role", "caller");
|
||||
switch_process_import(consumer_session, caller_channel, "fifo_caller_consumer_import");
|
||||
switch_process_import(caller_session, consumer_channel, "fifo_consumer_caller_import");
|
||||
switch_process_import(consumer_session, caller_channel, "fifo_caller_consumer_import",
|
||||
switch_channel_get_variable(consumer_channel, "fifo_import_prefix"));
|
||||
switch_process_import(caller_session, consumer_channel, "fifo_consumer_caller_import",
|
||||
switch_channel_get_variable(caller_channel, "fifo_import_prefix"));
|
||||
}
|
||||
|
||||
|
||||
|
@ -2846,8 +2848,8 @@ SWITCH_STANDARD_APP(fifo_function)
|
|||
|
||||
switch_core_media_bug_resume(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_process_import(session, other_channel, "fifo_caller_consumer_import", switch_channel_get_variable(channel, "fifo_import_prefix"));
|
||||
switch_process_import(other_session, channel, "fifo_consumer_caller_import", switch_channel_get_variable(other_channel, "fifo_import_prefix"));
|
||||
if (switch_event_create_subclass(&event, SWITCH_EVENT_CUSTOM, FIFO_EVENT) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_event_set_data(channel, event);
|
||||
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "FIFO-Name", argv[0]);
|
||||
|
|
|
@ -1038,7 +1038,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_wait_for_answer(switch_core_session_t
|
|||
return status;
|
||||
}
|
||||
|
||||
SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname)
|
||||
SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switch_channel_t *peer_channel, const char *varname, const char *prefix)
|
||||
{
|
||||
const char *import, *val;
|
||||
switch_channel_t *caller_channel;
|
||||
|
@ -1054,7 +1054,13 @@ SWITCH_DECLARE(void) switch_process_import(switch_core_session_t *session, switc
|
|||
if ((argc = switch_separate_string(mydata, ',', argv, (sizeof(argv) / sizeof(argv[0]))))) {
|
||||
for (i = 0; i < argc; i++) {
|
||||
if ((val = switch_channel_get_variable(peer_channel, argv[i]))) {
|
||||
switch_channel_set_variable(caller_channel, argv[i], val);
|
||||
if (prefix) {
|
||||
char *var = switch_mprintf("%s%s", prefix, argv[i]);
|
||||
switch_channel_set_variable(caller_channel, var, val);
|
||||
free(var);
|
||||
} else {
|
||||
switch_channel_set_variable(caller_channel, argv[i], val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
@ -3296,7 +3302,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
} else {
|
||||
status = SWITCH_STATUS_FALSE;
|
||||
if (caller_channel && peer_channel) {
|
||||
switch_process_import(oglobals.session, peer_channel, "import");
|
||||
switch_process_import(oglobals.session, peer_channel, "import", NULL);
|
||||
}
|
||||
peer_channel = NULL;
|
||||
goto done;
|
||||
|
@ -3347,7 +3353,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_originate(switch_core_session_t *sess
|
|||
if (caller_channel) {
|
||||
switch_channel_set_variable(caller_channel, "originate_disposition", "call accepted");
|
||||
if (peer_channel) {
|
||||
switch_process_import(oglobals.session, peer_channel, "import");
|
||||
switch_process_import(oglobals.session, peer_channel, "import", NULL);
|
||||
}
|
||||
}
|
||||
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(oglobals.session), SWITCH_LOG_DEBUG, "Originate Resulted in Success: [%s]\n",
|
||||
|
|
Loading…
Reference in New Issue