add enable-chat sofia profile param which defaults to true when not present, set to false to turn off the chat interface in sofia

This commit is contained in:
Anthony Minessale 2014-04-19 12:29:00 -05:00
parent f408dae2af
commit 79ebcb104b
4 changed files with 15 additions and 1 deletions

View 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;

View 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);

View 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);
}

View 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);
}
}