]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add pass-callee-id (defaults to true) disable by setting it to false if you encounter...
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 26 Oct 2009 18:16:38 +0000 (18:16 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 26 Oct 2009 18:16:38 +0000 (18:16 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15230 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_glue.c

index cbf6830a385737866a908db307ca9f01c65982b4..4d4818595fbc1f466bdef6d8e87e7fdb3b29ec59 100644 (file)
@@ -179,6 +179,7 @@ char *generate_pai_str(switch_core_session_t *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 *ua = switch_channel_get_variable(tech_pvt->channel, "sip_user_agent");
        char *pai = NULL;
 
        if (!(callee_name = switch_channel_get_variable(tech_pvt->channel, "sip_callee_id_name"))) {
@@ -195,9 +196,19 @@ char *generate_pai_str(switch_core_session_t *session)
                callee_name = callee_number;
        }
 
+       if (ua && !zstr(callee_number) && !switch_stristr("polycom", ua)) {
+               callee_number = switch_core_session_sprintf(session, "sip:%s@%s", callee_number, tech_pvt->profile->sipip);
+       }
+       
+
        if (!zstr(callee_name) && !zstr(callee_number)) {
-               pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>\nX-FS-Display-Name: %s\nX-FS-Display-Number: %s\n", 
-                                                                                 callee_name, callee_number, callee_name, callee_number);
+               if (switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote)) {
+                       pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>\nX-FS-Display-Name: %s\nX-FS-Display-Number: %s\n", 
+                                                                                         callee_name, callee_number, callee_name, callee_number);
+               } else {
+                       pai = switch_core_session_sprintf(tech_pvt->session, "P-Asserted-Identity: \"%s\" <%s>\n", 
+                                                                                         callee_name, callee_number, callee_name, callee_number);
+               }
        }
        return pai;
 }
@@ -496,7 +507,8 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                                                        SOATAG_REUSE_REJECTED(1),
                                                        SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), 
                                                        TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-                                                       SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
+                                                       TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), 
+                                                                  SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
                                                        TAG_END());
 
                                switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n");
@@ -586,7 +598,8 @@ static switch_status_t sofia_answer_channel(switch_core_session_t *session)
                                        SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str),
                                        SOATAG_REUSE_REJECTED(1), SOATAG_ORDERED_USER(1), SOATAG_AUDIO_AUX("cn telephone-event"), NUTAG_INCLUDE_EXTRA_SDP(1), 
                                        TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-                                       SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
+                                       TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), 
+                                                  SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
                                        TAG_END());
                switch_safe_free(extra_headers);
                sofia_set_flag_locked(tech_pvt, TFLAG_ANS);
@@ -1568,7 +1581,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                SIPTAG_CONTACT_STR(tech_pvt->reply_contact),
                                                SIPTAG_HEADER_STR(generate_pai_str(session)), 
                                                TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
-                                               SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
+                                               TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), 
+                                                          SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
                                                TAG_END());
                        switch_safe_free(extra_header);
                        switch_channel_mark_ring_ready(channel);
@@ -1665,7 +1679,8 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                                                                SOATAG_ADDRESS(tech_pvt->adv_sdp_audio_ip),
                                                                SOATAG_USER_SDP_STR(tech_pvt->local_sdp_str), SOATAG_AUDIO_AUX("cn telephone-event"), 
                                                                TAG_IF(!zstr(extra_header), SIPTAG_HEADER_STR(extra_header)),
-                                                               SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
+                                                               TAG_IF(switch_stristr("update_display", tech_pvt->x_freeswitch_support_remote), 
+                                                                          SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
                                                                TAG_END());
                                        switch_safe_free(extra_header);
                                }
index d44a7bc94734def329be91699026f96988467f59..e03802079f772b2080f2a8e7c167bd6bbd64bf23 100644 (file)
@@ -199,6 +199,7 @@ typedef enum {
        PFLAG_AUTO_NAT,
        PFLAG_SIPCOMPACT,
        PFLAG_SQL_IN_TRANS,
+       PFLAG_PASS_CALLEE_ID,
        /* No new flags below this line */
        PFLAG_MAX
 } PFLAGS;
index 65c2fcbc0a262bd8425a9b0185270a2c1e71e28e..0afc1873986e8ee978c899fe99dfbd857243ae39 100644 (file)
@@ -1830,6 +1830,7 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
                        profile->reg_acl_count = 0;
                        profile->proxy_acl_count = 0;
                        sofia_set_pflag(profile, PFLAG_STUN_ENABLED);
+                       sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
                        profile->ib_calls = 0;
                        profile->ob_calls = 0;
                        profile->ib_failed_calls = 0;
@@ -1847,6 +1848,12 @@ switch_status_t reconfig_sofia(sofia_profile_t *profile)
                                                profile->debug = atoi(val);
                                        } else if (!strcasecmp(var, "tracelevel")) {
                                                mod_sofia_globals.tracelevel = switch_log_str2level(val);
+                                       } else if (!strcasecmp(var, "pass-callee-id")) {
+                                               if (switch_true(val)) {
+                                                       sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
+                                               } else {
+                                                       sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID);
+                                               }
                                        } else if (!strcasecmp(var, "sip-trace")) {
                                                if (switch_true(val)) {
                                                        sofia_set_flag(profile, TFLAG_TPORT_LOG);
@@ -2386,6 +2393,7 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                sofia_set_pflag(profile, PFLAG_MESSAGE_QUERY_ON_REGISTER);
                                sofia_set_pflag(profile, PFLAG_RTP_AUTOFLUSH_DURING_BRIDGE);
                                profile->contact_user = SOFIA_DEFAULT_CONTACT_USER;
+                               sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
 
                                for (param = switch_xml_child(settings, "param"); param; param = param->next) {
                                        char *var = (char *) switch_xml_attr_soft(param, "name");
@@ -2773,6 +2781,12 @@ switch_status_t config_sofia(int reload, char *profile_name)
                                                if (switch_true(val)) {
                                                        sofia_set_pflag(profile, PFLAG_SIPCOMPACT);
                                                }
+                                       } else if (!strcasecmp(var, "pass-callee-id")) {
+                                               if (switch_true(val)) {
+                                                       sofia_set_pflag(profile, PFLAG_PASS_CALLEE_ID);
+                                               } else {
+                                                       sofia_clear_pflag(profile, PFLAG_PASS_CALLEE_ID);
+                                               }
                                        } else if (!strcasecmp(var, "sql-in-transactions")) {
                                                if (switch_true(val)) {
                                                        sofia_set_pflag(profile, PFLAG_SQL_IN_TRANS);
index fda5df79e2aaee8d58e6fd661feca615070343a5..97d34e9e2a9b4061d76f8e11f35e713b82d76742 100644 (file)
@@ -1773,7 +1773,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session)
                           TAG_IF(!zstr(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)),
                           TAG_IF(!zstr(alert_info), SIPTAG_HEADER_STR(alert_info)),
                           TAG_IF(!zstr(extra_headers), SIPTAG_HEADER_STR(extra_headers)),
-                          SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT),
+                          TAG_IF(sofia_test_pflag(tech_pvt->profile, PFLAG_PASS_CALLEE_ID), SIPTAG_HEADER_STR("X-FS-Support: "FREESWITCH_SUPPORT)),
                           TAG_IF(!zstr(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)),
                           TAG_IF(!zstr(route_uri), NUTAG_PROXY(route_uri)),
                           TAG_IF(!zstr(route), SIPTAG_ROUTE_STR(route)),