git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15154 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2009-10-13 21:52:47 +00:00
parent 0fe0604f90
commit f70d980a9d
4 changed files with 38 additions and 30 deletions

View File

@ -1280,7 +1280,6 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
}
if (!switch_strlen_zero(name)) {
char message[256] = "";
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
@ -1290,32 +1289,39 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
number = tech_pvt->caller_profile->destination_number;
}
if (ua && switch_stristr("snom", ua)) {
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", name, number);
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
SIPTAG_PAYLOAD_STR(message), TAG_END());
} else if ((ua && (switch_stristr("polycom", ua) ||
switch_stristr("UPDATE", tech_pvt->x_actually_support_remote)))) {
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", name, number);
nua_update(tech_pvt->nh,
TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
TAG_END());
}
if (switch_strlen_zero(tech_pvt->last_sent_callee_id_name) || strcmp(tech_pvt->last_sent_callee_id_name, name) ||
switch_strlen_zero(tech_pvt->last_sent_callee_id_number) || strcmp(tech_pvt->last_sent_callee_id_number, number)) {
if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "SEND");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Name", name);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Number", number);
if (uuid) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
if (ua && switch_stristr("snom", ua)) {
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", name, number);
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
SIPTAG_PAYLOAD_STR(message), TAG_END());
} else if ((ua && (switch_stristr("polycom", ua) ||
switch_stristr("UPDATE", tech_pvt->x_actually_support_remote)))) {
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", name, number);
nua_update(tech_pvt->nh,
TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
TAG_END());
}
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
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);
if (switch_event_create(&event, SWITCH_EVENT_CALL_UPDATE) == SWITCH_STATUS_SUCCESS) {
const char *uuid = switch_channel_get_variable(channel, SWITCH_SIGNAL_BOND_VARIABLE);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Direction", "SEND");
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Name", name);
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Callee-Number", number);
if (uuid) {
switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "Bridged-To", uuid);
}
switch_channel_event_set_data(channel, event);
switch_event_fire(&event);
}
} else {
switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "Not sending same id again \"%s\" <%s>\n", name, number);
}

View File

@ -583,6 +583,8 @@ struct private_object {
char *route_uri;
char *x_actually_support_remote;
char *x_actually_support_local;
char *last_sent_callee_id_name;
char *last_sent_callee_id_number;
switch_port_t stun_port;
uint32_t stun_flags;
unsigned long rm_rate;

View File

@ -432,9 +432,7 @@ SWITCH_STANDARD_APP(socket_function)
switch_ivr_park(session, NULL);
if (switch_core_session_private_event_count(session)) {
switch_ivr_parse_all_events(session);
}
switch_ivr_parse_all_events(session);
if (switch_test_flag(listener, LFLAG_RESUME) || ((var = switch_channel_get_variable(channel, "socket_resume")) && switch_true(var))) {
switch_channel_set_state(channel, CS_EXECUTE);

View File

@ -298,6 +298,8 @@ static void *audio_bridge_thread(switch_thread_t *thread, void *obj)
switch_core_session_kill_channel(session_b, SWITCH_SIG_BREAK);
}
switch_ivr_parse_all_messages(session_a);
if (!inner_bridge && (switch_channel_test_flag(chan_a, CF_SUSPEND) || switch_channel_test_flag(chan_b, CF_SUSPEND))) {
status = switch_core_session_read_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, stream_id);