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

@ -1279,8 +1279,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
number = argv[1]; number = argv[1];
} }
if (!switch_strlen_zero(name)) { if (!switch_strlen_zero(name)) {
char message[256] = ""; char message[256] = "";
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent"); 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; number = tech_pvt->caller_profile->destination_number;
} }
if (ua && switch_stristr("snom", ua)) { if (switch_strlen_zero(tech_pvt->last_sent_callee_id_name) || strcmp(tech_pvt->last_sent_callee_id_name, name) ||
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", name, number); switch_strlen_zero(tech_pvt->last_sent_callee_id_number) || strcmp(tech_pvt->last_sent_callee_id_number, 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)), if (ua && switch_stristr("snom", ua)) {
SIPTAG_PAYLOAD_STR(message), TAG_END()); snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", name, number);
} else if ((ua && (switch_stristr("polycom", ua) || nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"),
switch_stristr("UPDATE", tech_pvt->x_actually_support_remote)))) { TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)),
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", name, number); SIPTAG_PAYLOAD_STR(message), TAG_END());
nua_update(tech_pvt->nh, } else if ((ua && (switch_stristr("polycom", ua) ||
TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)), switch_stristr("UPDATE", tech_pvt->x_actually_support_remote)))) {
TAG_IF(!switch_strlen_zero(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", name, number);
TAG_END()); 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_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); 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 *route_uri;
char *x_actually_support_remote; char *x_actually_support_remote;
char *x_actually_support_local; char *x_actually_support_local;
char *last_sent_callee_id_name;
char *last_sent_callee_id_number;
switch_port_t stun_port; switch_port_t stun_port;
uint32_t stun_flags; uint32_t stun_flags;
unsigned long rm_rate; unsigned long rm_rate;

View File

@ -432,9 +432,7 @@ SWITCH_STANDARD_APP(socket_function)
switch_ivr_park(session, NULL); 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))) { 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); 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_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))) { 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); status = switch_core_session_read_frame(session_a, &read_frame, SWITCH_IO_FLAG_NONE, stream_id);