]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
finishing touches for commit: b9e28f85cb35db7dd72b6760310fa3ad18e5aa2d
authorAnthony Minessale <anthm@freeswitch.org>
Tue, 29 Nov 2011 22:23:49 +0000 (16:23 -0600)
committerAnthony Minessale <anthm@freeswitch.org>
Tue, 29 Nov 2011 22:23:49 +0000 (16:23 -0600)
src/mod/endpoints/mod_sofia/mod_sofia.c
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c

index 52c2b3cb542e098eed6cd04aede8237b088e146f..31ef7884d947eea14a2a67bd63f87d86887c647d 100644 (file)
@@ -1932,24 +1932,39 @@ static switch_status_t sofia_receive_message(switch_core_session_t *session, swi
                }
        case SWITCH_MESSAGE_INDICATE_INFO:
                {
-                       char *headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_INFO_HEADER_PREFIX);
                        char *ct = "freeswitch/data";
-                       const char *pl = NULL;
+                       int ok = 0;
 
                        if (!zstr(msg->string_array_arg[0]) && !zstr(msg->string_array_arg[1])) {
                                ct = switch_core_session_sprintf(session, "%s/%s", msg->string_array_arg[0], msg->string_array_arg[1]);
+                               ok = 1;
                        }
 
-                       if (!zstr(msg->string_array_arg[2])) {
-                               pl = msg->string_array_arg[2];
+                       if (switch_stristr("send_info", tech_pvt->x_freeswitch_support_remote)) {
+                               ok = 1;
                        }
 
-                       nua_info(tech_pvt->nh,
-                                        SIPTAG_CONTENT_TYPE_STR(ct),
-                                        TAG_IF(!zstr(headers), SIPTAG_HEADER_STR(headers)),
-                                        TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), 
-                                        TAG_IF(pl, SIPTAG_PAYLOAD_STR(pl)),
-                                        TAG_END());
+                       if (switch_true(switch_channel_get_variable(channel, "fs_send_unspported_info"))) {
+                               ok = 1;
+                       }
+                       
+                       if (ok) {
+                               char *headers = sofia_glue_get_extra_headers(channel, SOFIA_SIP_INFO_HEADER_PREFIX);
+                               const char *pl = NULL;
+                               
+                               if (!zstr(msg->string_array_arg[2])) {
+                                       pl = msg->string_array_arg[2];
+                               }
+                               
+                               nua_info(tech_pvt->nh,
+                                                SIPTAG_CONTENT_TYPE_STR(ct),
+                                                TAG_IF(!zstr(headers), SIPTAG_HEADER_STR(headers)),
+                                                TAG_IF(!zstr(tech_pvt->user_via), SIPTAG_VIA_STR(tech_pvt->user_via)), 
+                                                TAG_IF(pl, SIPTAG_PAYLOAD_STR(pl)),
+                                                TAG_END());
+                       } else {
+                               switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "%s send_info is not supported.\n", switch_channel_get_name(channel));
+                       }
                }
                break;
        case SWITCH_MESSAGE_INDICATE_SIMPLIFY:
index 6b4d938c11c4ac5d79852db07850e801bb0f9bf0..a95aa9d1cb8875f6cafee4bc6cac0c8d6f038762 100644 (file)
@@ -111,7 +111,7 @@ typedef struct private_object private_object_t;
 #define SOFIA_SECURE_MEDIA_CONFIRMED_VARIABLE "sip_secure_media_confirmed"
 #define SOFIA_HAS_CRYPTO_VARIABLE "sip_has_crypto"
 #define SOFIA_CRYPTO_MANDATORY_VARIABLE "sip_crypto_mandatory"
-#define FREESWITCH_SUPPORT "update_display"
+#define FREESWITCH_SUPPORT "update_display,send_info"
 
 #include <switch_stun.h>
 #include <sofia-sip/nua.h>
index 3804d69942a852b8656189f46308681f4a183dd7..20b48f77b44060a888becd03c3c162144b21336b 100644 (file)
@@ -6967,31 +6967,37 @@ void sofia_handle_sip_i_info(nua_t *nua, sofia_profile_t *profile, nua_handle_t
 
                sofia_glue_set_extra_headers(session, sip, SOFIA_SIP_INFO_HEADER_PREFIX);
 
-               if (!(vval = switch_channel_get_variable(channel, "sip_copy_custom_headers")) || switch_true(vval)) { 
-                       switch_core_session_t *nsession = NULL; 
 
-                       switch_core_session_get_partner(session, &nsession); 
+
+               if (sip && sip->sip_content_type && sip->sip_content_type->c_type && !strcasecmp(sip->sip_content_type->c_type, "freeswitch/data")) {
+                       char *data = NULL;
                        
-                       if (nsession) { 
-                               switch_core_session_message_t *msg;
+                       if (sip->sip_payload && sip->sip_payload->pl_data) {
+                               data = sip->sip_payload->pl_data;
+                       }
+
+                       if ((vval = switch_channel_get_variable(channel, "sip_copy_custom_headers")) && switch_true(vval)) { 
+                               switch_core_session_t *nsession = NULL; 
                                
-                               switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_INFO_HEADER_PREFIX_T); 
-                               msg = switch_core_session_alloc(nsession, sizeof(*msg));
-                               MESSAGE_STAMP_FFL(msg);
-                               msg->message_id = SWITCH_MESSAGE_INDICATE_INFO;
+                               switch_core_session_get_partner(session, &nsession); 
+                       
+                               if (nsession) { 
+                                       switch_core_session_message_t *msg;
                                
-                               if (sip && sip->sip_content_type && sip->sip_content_type->c_type && sip->sip_content_type->c_subtype &&
-                                       sip->sip_payload && sip->sip_payload->pl_data) {
-                                       msg->string_array_arg[0] = switch_core_session_strdup(nsession, sip->sip_content_type->c_type);
-                                       msg->string_array_arg[1] = switch_core_session_strdup(nsession, sip->sip_content_type->c_subtype);
-                                       msg->string_array_arg[0] = switch_core_session_strdup(nsession, sip->sip_payload->pl_data);
-                               }
-                               msg->from = __FILE__;
-                               switch_core_session_queue_message(nsession, msg);
+                                       switch_ivr_transfer_variable(session, nsession, SOFIA_SIP_INFO_HEADER_PREFIX_T); 
+                                       msg = switch_core_session_alloc(nsession, sizeof(*msg));
+                                       MESSAGE_STAMP_FFL(msg);
+                                       msg->message_id = SWITCH_MESSAGE_INDICATE_INFO;
+                                       
+                                       msg->string_array_arg[2] = switch_core_session_strdup(nsession, data);
+                                       
+                                       msg->from = __FILE__;
+                                       switch_core_session_queue_message(nsession, msg);
                                
-                               switch_core_session_rwunlock(nsession);
+                                       switch_core_session_rwunlock(nsession);
+                               } 
                        } 
-               } 
+               }
                
                if (sip && sip->sip_content_type && sip->sip_content_type->c_subtype && sip->sip_content_type->c_type &&
                        !strncasecmp(sip->sip_content_type->c_type, "message", 7) &&