forked from Mirrors/freeswitch
really fix FS-3726 this time
This commit is contained in:
parent
9675229dd4
commit
fbb99f60b4
@ -2333,7 +2333,37 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
||||
TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), TAG_END());
|
||||
} else if (ua && switch_stristr("snom", ua)) {
|
||||
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", name, number);
|
||||
const char *ver_str = NULL;
|
||||
int version = 0;
|
||||
|
||||
ver_str = switch_stristr( "/", ua);
|
||||
|
||||
if ( ver_str ) {
|
||||
char *argv[4] = { 0 };
|
||||
char *dotted = strdup( ver_str + 1 );
|
||||
if ( dotted ) {
|
||||
switch_separate_string(dotted, '.', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
if ( argv[0] && argv[1] && argv[2] ) {
|
||||
version = ( atoi(argv[0]) * 10000 ) + ( atoi(argv[1]) * 100 ) + atoi(argv[2]);
|
||||
}
|
||||
}
|
||||
switch_safe_free( dotted );
|
||||
}
|
||||
|
||||
if ( version >= 80424 ) {
|
||||
if (zstr(name)) {
|
||||
snprintf(message, sizeof(message), "From: %s\r\nTo:\r\n", number);
|
||||
} else {
|
||||
snprintf(message, sizeof(message), "From: \"%s\" %s\r\nTo:\r\n", name, number);
|
||||
}
|
||||
} else {
|
||||
if (zstr(name)) {
|
||||
snprintf(message, sizeof(message), "From:\r\nTo: %s\r\n", number);
|
||||
} else {
|
||||
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(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
||||
} else if ((ua && (switch_stristr("polycom", ua)))) {
|
||||
|
@ -1162,7 +1162,6 @@ switch_status_t sofia_glue_send_notify(sofia_profile_t *profile, const char *use
|
||||
char *sofia_glue_get_extra_headers(switch_channel_t *channel, const char *prefix);
|
||||
void sofia_glue_set_extra_headers(switch_core_session_t *session, sip_t const *sip, const char *prefix);
|
||||
char *sofia_glue_get_extra_headers_from_event(switch_event_t *event, const char *prefix);
|
||||
void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg);
|
||||
void sofia_update_callee_id(switch_core_session_t *session, sofia_profile_t *profile, sip_t const *sip, switch_bool_t send);
|
||||
void sofia_send_callee_id(switch_core_session_t *session, const char *name, const char *number);
|
||||
int sofia_sla_supported(sip_t const *sip);
|
||||
|
@ -9445,89 +9445,6 @@ void sofia_handle_sip_i_options(int status,
|
||||
|
||||
}
|
||||
|
||||
void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t *bleg)
|
||||
{
|
||||
private_object_t *b_tech_pvt = NULL, *a_tech_pvt = NULL;
|
||||
char message[256] = "";
|
||||
|
||||
if (aleg && bleg && switch_core_session_compare(aleg, bleg)) {
|
||||
switch_channel_t *channel = switch_core_session_get_channel(bleg);
|
||||
const char *ua = switch_channel_get_variable(channel, "sip_user_agent");
|
||||
|
||||
a_tech_pvt = (private_object_t *) switch_core_session_get_private(aleg);
|
||||
b_tech_pvt = (private_object_t *) switch_core_session_get_private(bleg);
|
||||
|
||||
if (b_tech_pvt && a_tech_pvt && a_tech_pvt->caller_profile) {
|
||||
switch_caller_profile_t *acp = a_tech_pvt->caller_profile;
|
||||
|
||||
if (ua && switch_stristr("snom", ua)) {
|
||||
const char *ver_str = NULL;
|
||||
int version = 0;
|
||||
|
||||
ver_str = switch_stristr( "/", ua);
|
||||
|
||||
if ( ver_str ) {
|
||||
char *argv[4] = { 0 };
|
||||
char *dotted = strdup( ver_str + 1 );
|
||||
if ( dotted ) {
|
||||
switch_separate_string(dotted, '.', argv, (sizeof(argv) / sizeof(argv[0])));
|
||||
if ( argv[0] && argv[1] && argv[2] ) {
|
||||
version = ( atoi(argv[0]) * 10000 ) + ( atoi(argv[1]) * 100 ) + atoi(argv[2]);
|
||||
}
|
||||
}
|
||||
switch_safe_free( dotted );
|
||||
}
|
||||
if ( version >= 80424 ) {
|
||||
if (zstr(acp->caller_id_name)) {
|
||||
snprintf(message, sizeof(message), "From: %s\r\nTo:\r\n", acp->caller_id_number);
|
||||
} else {
|
||||
snprintf(message, sizeof(message), "From: \"%s\" %s\r\nTo:\r\n", acp->caller_id_name, acp->caller_id_number);
|
||||
}
|
||||
} else {
|
||||
if (zstr(acp->caller_id_name)) {
|
||||
snprintf(message, sizeof(message), "From:\r\nTo: %s\r\n", acp->caller_id_number);
|
||||
} else {
|
||||
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", acp->caller_id_name, acp->caller_id_number);
|
||||
}
|
||||
}
|
||||
nua_info(b_tech_pvt->nh,
|
||||
SIPTAG_CONTENT_TYPE_STR("message/sipfrag;version=2.0"),
|
||||
TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
||||
} else if (ua && switch_stristr("polycom", ua)) {
|
||||
if (zstr(acp->caller_id_name)) {
|
||||
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_number, acp->caller_id_number);
|
||||
} else {
|
||||
check_decode(acp->caller_id_name, aleg);
|
||||
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_name, acp->caller_id_number);
|
||||
}
|
||||
|
||||
if (b_tech_pvt->local_crypto_key) {
|
||||
sofia_glue_set_local_sdp(b_tech_pvt, NULL, 0, NULL, 0);
|
||||
}
|
||||
|
||||
if (sofia_use_soa(b_tech_pvt)) {
|
||||
nua_update(b_tech_pvt->nh,
|
||||
SIPTAG_CONTACT_STR(b_tech_pvt->reply_contact),
|
||||
SOATAG_USER_SDP_STR(b_tech_pvt->local_sdp_str),
|
||||
SOATAG_REUSE_REJECTED(1),
|
||||
SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"),
|
||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
||||
TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)), TAG_END());
|
||||
} else {
|
||||
nua_update(b_tech_pvt->nh,
|
||||
NUTAG_MEDIA_ENABLE(0),
|
||||
SIPTAG_CONTACT_STR(b_tech_pvt->reply_contact),
|
||||
SIPTAG_CONTENT_TYPE_STR("application/sdp"),
|
||||
SIPTAG_PAYLOAD_STR(b_tech_pvt->local_sdp_str),
|
||||
TAG_IF(!zstr_buf(message), SIPTAG_HEADER_STR(message)),
|
||||
TAG_IF(!zstr(b_tech_pvt->user_via), SIPTAG_VIA_STR(b_tech_pvt->user_via)), TAG_END());
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
/*
|
||||
* This subroutine will take the a_params of a sip_addr_s structure and spin through them.
|
||||
* Each param will be used to create a channel variable.
|
||||
|
Loading…
Reference in New Issue
Block a user