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)))) {
}
-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.