This commit is contained in:
Brian West 2012-01-19 19:43:48 -06:00
parent 122766c735
commit edd6562ce3
1 changed files with 27 additions and 3 deletions

View File

@ -8501,11 +8501,35 @@ void sofia_info_send_sipfrag(switch_core_session_t *aleg, switch_core_session_t
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());