]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
add enable-chat sofia profile param which defaults to true when not present, set...
authorAnthony Minessale <anthm@freeswitch.org>
Sat, 19 Apr 2014 17:29:00 +0000 (12:29 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Sat, 19 Apr 2014 17:29:10 +0000 (12:29 -0500)
src/mod/endpoints/mod_sofia/mod_sofia.h
src/mod/endpoints/mod_sofia/sofia.c
src/mod/endpoints/mod_sofia/sofia_presence.c
src/switch_ivr_play_say.c

index 0c1f755c79dc3ec19bcf1924ab6a302c4fd3139e..6012c6b4ca8bacfb240f0cd479b8bcf4b15d8a2f 100644 (file)
@@ -273,6 +273,7 @@ typedef enum {
        PFLAG_TCP_UNREG_ON_SOCKET_CLOSE,
        PFLAG_TLS_ALWAYS_NAT,
        PFLAG_TCP_ALWAYS_NAT,
+       PFLAG_ENABLE_CHAT,
        /* No new flags below this line */
        PFLAG_MAX
 } PFLAGS;
index 31bdfaf575e14b274dfead8785693f8c2fa47ab2..589b694321194ca715c05f3b9f7f6ef82754632f 100644 (file)
@@ -3982,6 +3982,7 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                        profile->client_rport_level = 1;
                                        profile->tls_cert_dir = SWITCH_GLOBAL_dirs.certs_dir;
                                        sofia_set_pflag(profile, PFLAG_DISABLE_100REL);
+                                       sofia_set_pflag(profile, PFLAG_ENABLE_CHAT);
                                        profile->auto_restart = 1;
                                        sofia_set_media_flag(profile, SCMF_AUTOFIX_TIMING);
                                        sofia_set_media_flag(profile, SCMF_RENEG_ON_REINVITE);
@@ -4179,6 +4180,12 @@ switch_status_t config_sofia(sofia_config_t reload, char *profile_name)
                                                } else {
                                                        sofia_clear_pflag(profile, PFLAG_IN_DIALOG_CHAT);
                                                }
+                                       } else if (!strcasecmp(var, "enable-chat")) {
+                                               if (switch_true(val)) {
+                                                       sofia_set_pflag(profile, PFLAG_ENABLE_CHAT);
+                                               } else {
+                                                       sofia_clear_pflag(profile, PFLAG_ENABLE_CHAT);
+                                               }
                                        } else if (!strcasecmp(var, "fire-message-events")) {
                                                if (switch_true(val)) {
                                                        sofia_set_pflag(profile, PFLAG_FIRE_MESSAGE_EVENTS);
index b5abae202dd007be7f5fa5e94e75b9c7deba3980..f25f5eb52d9c8580909a78f91c167489774536b5 100644 (file)
@@ -150,7 +150,7 @@ switch_status_t sofia_presence_chat_send(switch_event_t *message_event)
        network_port = switch_event_get_header(message_event, "to_sip_port");
 
        extra_headers = sofia_glue_get_extra_headers_from_event(message_event, SOFIA_SIP_HEADER_PREFIX);
-
+       abort();
        if (!to) {
                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Missing To: header.\n");
                goto end;
@@ -4649,6 +4649,11 @@ void sofia_presence_handle_sip_i_message(int status,
                switch_channel_t *channel = NULL;
 
 
+               if (!sofia_test_pflag(profile, PFLAG_ENABLE_CHAT)) {
+                       goto end;
+               }
+
+
                if (session) {
                        channel = switch_core_session_get_channel(session);
                }
index c13c13feb0c2950c1bc9d1fda26071c78f5f5bd0..b07aee0ef00b3be33de4814456636eb20b73a7cf 100644 (file)
@@ -1434,6 +1434,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_play_file(switch_core_session_t *sess
                                                if (ostatus != SWITCH_STATUS_SUCCESS) {
                                                        status = ostatus;
                                                }
+                                               
                                                switch_event_destroy(&event);
                                        }
                                }