sigh, guess we can only do this on snom and polycom right now to be safe
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13527 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
parent
082385c1da
commit
dd1e4b2d23
|
@ -179,16 +179,21 @@ char * generate_pai_str(switch_core_session_t *session)
|
||||||
{
|
{
|
||||||
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
private_object_t *tech_pvt = (private_object_t *) switch_core_session_get_private(session);
|
||||||
const char *callee_name = NULL, *callee_number = NULL;
|
const char *callee_name = NULL, *callee_number = NULL;
|
||||||
|
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
|
||||||
|
|
||||||
if (!(callee_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name"))) {
|
if (ua && switch_stristr("polycom", ua)) {
|
||||||
callee_name = "";
|
if (!(callee_name = switch_channel_get_variable(tech_pvt->channel, "callee_id_name"))) {
|
||||||
|
callee_name = "";
|
||||||
|
}
|
||||||
|
|
||||||
|
if (!(callee_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number"))) {
|
||||||
|
callee_number = tech_pvt->caller_profile->destination_number;
|
||||||
|
}
|
||||||
|
|
||||||
|
return switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!(callee_number = switch_channel_get_variable(tech_pvt->channel, "callee_id_number"))) {
|
return NULL;
|
||||||
callee_number = tech_pvt->caller_profile->destination_number;
|
|
||||||
}
|
|
||||||
|
|
||||||
return switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>", callee_name, callee_number);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/* map QSIG cause codes to SIP from RFC4497 section 8.4.1 */
|
/* map QSIG cause codes to SIP from RFC4497 section 8.4.1 */
|
||||||
|
@ -1258,7 +1263,7 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||||
if (ua && switch_stristr("snom", ua)) {
|
if (ua && switch_stristr("snom", ua)) {
|
||||||
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
||||||
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
||||||
} else {
|
} else if (ua && switch_stristr("polycom", ua)) {
|
||||||
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
||||||
nua_update(tech_pvt->nh,
|
nua_update(tech_pvt->nh,
|
||||||
TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
|
TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
|
||||||
|
@ -1274,8 +1279,17 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
|
||||||
sofia_glue_do_invite(session);
|
sofia_glue_do_invite(session);
|
||||||
if (!switch_strlen_zero(msg->string_arg)) {
|
if (!switch_strlen_zero(msg->string_arg)) {
|
||||||
char message[256] = "";
|
char message[256] = "";
|
||||||
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\"\r\n", msg->string_arg);
|
const char *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
|
||||||
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
|
||||||
|
if (ua && switch_stristr("snom", ua)) {
|
||||||
|
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
||||||
|
nua_info(tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
||||||
|
} else if (ua && switch_stristr("polycom", ua)) {
|
||||||
|
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", msg->string_arg, tech_pvt->caller_profile->destination_number);
|
||||||
|
nua_update(tech_pvt->nh,
|
||||||
|
TAG_IF(!switch_strlen_zero_buf(message), SIPTAG_HEADER_STR(message)),
|
||||||
|
TAG_END());
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
break;
|
break;
|
||||||
|
|
|
@ -5072,7 +5072,7 @@ static void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_ses
|
||||||
snprintf(message, sizeof(message), "From:\r\nTo: \"%s\" %s\r\n", acp->caller_id_name, acp->caller_id_number);
|
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"), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
nua_info(b_tech_pvt->nh, SIPTAG_CONTENT_TYPE_STR("message/sipfrag"), SIPTAG_PAYLOAD_STR(message), TAG_END());
|
||||||
} else {
|
} else if (ua && switch_stristr("polycom", ua)) {
|
||||||
if (switch_strlen_zero(acp->caller_id_name)) {
|
if (switch_strlen_zero(acp->caller_id_name)) {
|
||||||
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_number, acp->caller_id_number);
|
snprintf(message, sizeof(message), "P-Asserted-Identity: \"%s\" <%s>", acp->caller_id_number, acp->caller_id_number);
|
||||||
} else {
|
} else {
|
||||||
|
|
Loading…
Reference in New Issue