move relevant portion of display update code into the core and fix mod_loopback bug involving passing display updates across properly
This commit is contained in:
parent
e27a9c78c3
commit
19f441c6f4
|
@ -217,6 +217,7 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
|||
switch_core_session_t *b_session;
|
||||
char name[128];
|
||||
switch_caller_profile_t *caller_profile;
|
||||
switch_event_t *vars = NULL;
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
switch_assert(tech_pvt != NULL);
|
||||
|
@ -273,8 +274,18 @@ static switch_status_t channel_on_init(switch_core_session_t *session)
|
|||
|
||||
|
||||
switch_channel_set_flag(channel, CF_ACCEPT_CNG);
|
||||
//switch_ivr_transfer_variable(session, tech_pvt->other_session, "process_cdr");
|
||||
switch_ivr_transfer_variable(session, tech_pvt->other_session, NULL);
|
||||
|
||||
if ((vars = (switch_event_t *) switch_channel_get_private(channel, "__loopback_vars__"))) {
|
||||
switch_event_header_t *h;
|
||||
|
||||
switch_channel_set_private(channel, "__loopback_vars__", NULL);
|
||||
|
||||
for (h = vars->headers; h; h = h->next) {
|
||||
switch_channel_set_variable(tech_pvt->other_channel, h->name, h->value);
|
||||
}
|
||||
|
||||
switch_event_destroy(&vars);
|
||||
}
|
||||
|
||||
if (switch_test_flag(tech_pvt, TFLAG_APP)) {
|
||||
switch_set_flag(b_tech_pvt, TFLAG_APP);
|
||||
|
@ -382,12 +393,18 @@ static switch_status_t channel_on_destroy(switch_core_session_t *session)
|
|||
switch_channel_t *channel = NULL;
|
||||
private_t *tech_pvt = NULL;
|
||||
void *pop;
|
||||
switch_event_t *vars;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
||||
tech_pvt = switch_core_session_get_private(session);
|
||||
|
||||
if ((vars = (switch_event_t *) switch_channel_get_private(channel, "__loopback_vars__"))) {
|
||||
switch_channel_set_private(channel, "__loopback_vars__", NULL);
|
||||
switch_event_destroy(&vars);
|
||||
}
|
||||
|
||||
if (tech_pvt) {
|
||||
switch_core_timer_destroy(&tech_pvt->timer);
|
||||
|
||||
|
@ -741,7 +758,7 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
|||
{
|
||||
switch_channel_t *channel;
|
||||
private_t *tech_pvt;
|
||||
int done = 1;
|
||||
int done = 1, pass = 0;
|
||||
|
||||
channel = switch_core_session_get_channel(session);
|
||||
switch_assert(channel != NULL);
|
||||
|
@ -799,7 +816,27 @@ static switch_status_t channel_receive_message(switch_core_session_t *session, s
|
|||
}
|
||||
|
||||
|
||||
if (!done && tech_pvt->other_session && switch_test_flag(tech_pvt, TFLAG_RUNNING_APP)) {
|
||||
switch (msg->message_id) {
|
||||
case SWITCH_MESSAGE_INDICATE_DISPLAY:
|
||||
{
|
||||
|
||||
if (!zstr(msg->string_array_arg[0])) {
|
||||
switch_channel_set_profile_var(tech_pvt->other_channel, "callee_id_name", msg->string_array_arg[0]);
|
||||
}
|
||||
|
||||
if (!zstr(msg->string_array_arg[1])) {
|
||||
switch_channel_set_profile_var(tech_pvt->other_channel, "callee_id_number", msg->string_array_arg[1]);
|
||||
}
|
||||
|
||||
pass = 1;
|
||||
}
|
||||
break;
|
||||
default:
|
||||
break;
|
||||
}
|
||||
|
||||
|
||||
if (!done && tech_pvt->other_session && (pass || switch_test_flag(tech_pvt, TFLAG_RUNNING_APP))) {
|
||||
switch_status_t r = SWITCH_STATUS_FALSE;
|
||||
switch_core_session_t *other_session;
|
||||
|
||||
|
@ -889,6 +926,7 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
private_t *tech_pvt;
|
||||
switch_channel_t *channel;
|
||||
switch_caller_profile_t *caller_profile;
|
||||
switch_event_t *clone = NULL;
|
||||
|
||||
switch_core_session_add_stream(*new_session, NULL);
|
||||
|
||||
|
@ -906,6 +944,10 @@ static switch_call_cause_t channel_outgoing_channel(switch_core_session_t *sessi
|
|||
return SWITCH_CAUSE_DESTINATION_OUT_OF_ORDER;
|
||||
}
|
||||
|
||||
if (switch_event_dup(&clone, var_event) == SWITCH_STATUS_SUCCESS) {
|
||||
switch_channel_set_private(channel, "__loopback_vars__", clone);
|
||||
}
|
||||
|
||||
if (outbound_profile) {
|
||||
char *dialplan = NULL, *context = NULL;
|
||||
|
||||
|
|
|
@ -2082,20 +2082,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
case SWITCH_MESSAGE_INDICATE_DISPLAY:
|
||||
{
|
||||
const char *name = msg->string_array_arg[0], *number = msg->string_array_arg[1];
|
||||
char *arg = NULL;
|
||||
char *argv[2] = { 0 };
|
||||
//int argc;
|
||||
|
||||
if (zstr(name) && !zstr(msg->string_arg)) {
|
||||
arg = strdup(msg->string_arg);
|
||||
switch_assert(arg);
|
||||
|
||||
switch_separate_string(arg, '|', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
name = argv[0];
|
||||
number = argv[1];
|
||||
|
||||
}
|
||||
|
||||
|
||||
if (!zstr(name)) {
|
||||
char message[256] = "";
|
||||
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
|
||||
|
@ -2176,9 +2163,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
|
||||
tech_pvt->last_sent_callee_id_name = switch_core_session_strdup(tech_pvt->session, name);
|
||||
tech_pvt->last_sent_callee_id_number = switch_core_session_strdup(tech_pvt->session, number);
|
||||
|
||||
switch_channel_set_variable(channel, "last_sent_callee_id_name", name);
|
||||
switch_channel_set_variable(channel, "last_sent_callee_id_number", number);
|
||||
|
||||
|
||||
if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
|
||||
|
@ -2203,8 +2187,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
|||
}
|
||||
}
|
||||
}
|
||||
|
||||
switch_safe_free(arg);
|
||||
}
|
||||
break;
|
||||
|
||||
|
|
|
@ -681,12 +681,30 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_receive_message(swit
|
|||
switch_channel_clear_flag(session->channel, CF_EARLY_MEDIA);
|
||||
}
|
||||
|
||||
if (message->message_id == SWITCH_MESSAGE_INDICATE_DISPLAY &&
|
||||
switch_true(switch_channel_get_variable(session->channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line,
|
||||
switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG1, "Ignoring display update.\n");
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
goto end;
|
||||
if (message->message_id == SWITCH_MESSAGE_INDICATE_DISPLAY) {
|
||||
char *arg = NULL;
|
||||
|
||||
if (zstr(message->string_array_arg[0]) && !zstr(message->string_arg)) {
|
||||
arg = switch_core_session_strdup(session, message->string_arg);
|
||||
switch_separate_string(arg, '|', (char **)message->string_array_arg, 2);
|
||||
}
|
||||
|
||||
if (!zstr(message->string_array_arg[0])) {
|
||||
switch_channel_set_variable(session->channel, "last_sent_callee_id_name", message->string_array_arg[0]);
|
||||
}
|
||||
|
||||
if (!zstr(message->string_array_arg[1])) {
|
||||
switch_channel_set_variable(session->channel, "last_sent_callee_id_number", message->string_array_arg[1]);
|
||||
}
|
||||
|
||||
|
||||
if (switch_true(switch_channel_get_variable(session->channel, SWITCH_IGNORE_DISPLAY_UPDATES_VARIABLE))) {
|
||||
switch_log_printf(SWITCH_CHANNEL_ID_LOG, message->_file, message->_func, message->_line,
|
||||
switch_core_session_get_uuid(session), SWITCH_LOG_DEBUG1, "Ignoring display update.\n");
|
||||
status = SWITCH_STATUS_SUCCESS;
|
||||
goto end;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
if (switch_channel_down_nosig(session->channel) && message->message_id != SWITCH_MESSAGE_INDICATE_SIGNAL_DATA) {
|
||||
|
|
Loading…
Reference in New Issue