diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index 0c1f755c79..6012c6b4ca 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -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; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 31bdfaf575..589b694321 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -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); diff --git a/src/mod/endpoints/mod_sofia/sofia_presence.c b/src/mod/endpoints/mod_sofia/sofia_presence.c index b5abae202d..f25f5eb52d 100644 --- a/src/mod/endpoints/mod_sofia/sofia_presence.c +++ b/src/mod/endpoints/mod_sofia/sofia_presence.c @@ -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); } diff --git a/src/switch_ivr_play_say.c b/src/switch_ivr_play_say.c index c13c13feb0..b07aee0ef0 100644 --- a/src/switch_ivr_play_say.c +++ b/src/switch_ivr_play_say.c @@ -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); } }