From eab6464f6253be086ad1c378b50929fee9316c37 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Thu, 8 Oct 2009 14:55:16 +0000 Subject: [PATCH] fix the crash that was caused by fixing the leak that was preventing the crash in the previous revision git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@15115 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/mod/endpoints/mod_sofia/mod_sofia.c | 4 ++++ src/mod/endpoints/mod_sofia/mod_sofia.h | 3 +++ src/mod/endpoints/mod_sofia/sofia.c | 2 ++ src/mod/endpoints/mod_sofia/sofia_glue.c | 1 + src/switch_core_file.c | 11 ++++++----- 5 files changed, 16 insertions(+), 5 deletions(-) diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.c b/src/mod/endpoints/mod_sofia/mod_sofia.c index 6c922781a0..b44a26bccd 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.c +++ b/src/mod/endpoints/mod_sofia/mod_sofia.c @@ -483,6 +483,7 @@ 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(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)), + SIPTAG_HEADER_STR("X-Actually-Support: "SOFIA_ACTUALLY_SUPPORT), TAG_END()); switch_log_printf(SWITCH_CHANNEL_SESSION_LOG(session), SWITCH_LOG_DEBUG, "3PCC-PROXY, Sent a 200 OK, waiting for ACK\n"); @@ -571,6 +572,7 @@ 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(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)), + SIPTAG_HEADER_STR("X-Actually-Support: "SOFIA_ACTUALLY_SUPPORT), TAG_END()); switch_safe_free(extra_headers); sofia_set_flag_locked(tech_pvt, TFLAG_ANS); @@ -1491,6 +1493,7 @@ 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(!switch_strlen_zero(extra_header), SIPTAG_HEADER_STR(extra_header)), + SIPTAG_HEADER_STR("X-Actually-Support: "SOFIA_ACTUALLY_SUPPORT), TAG_END()); switch_safe_free(extra_header); switch_channel_mark_ring_ready(channel); @@ -1576,6 +1579,7 @@ 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(!switch_strlen_zero(extra_header), SIPTAG_HEADER_STR(extra_header)), + SIPTAG_HEADER_STR("X-Actually-Support: "SOFIA_ACTUALLY_SUPPORT), TAG_END()); switch_safe_free(extra_header); } diff --git a/src/mod/endpoints/mod_sofia/mod_sofia.h b/src/mod/endpoints/mod_sofia/mod_sofia.h index ded096607a..d33ea704ff 100644 --- a/src/mod/endpoints/mod_sofia/mod_sofia.h +++ b/src/mod/endpoints/mod_sofia/mod_sofia.h @@ -96,6 +96,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 SOFIA_ACTUALLY_SUPPORT "UPDATE" #include #include @@ -580,6 +581,8 @@ struct private_object { char *extrtpip; char *stun_ip; char *route_uri; + char *x_actually_supported_remote; + char *x_actually_supported_local; switch_port_t stun_port; uint32_t stun_flags; unsigned long rm_rate; diff --git a/src/mod/endpoints/mod_sofia/sofia.c b/src/mod/endpoints/mod_sofia/sofia.c index 58cff55069..f5186b14be 100644 --- a/src/mod/endpoints/mod_sofia/sofia.c +++ b/src/mod/endpoints/mod_sofia/sofia.c @@ -5491,6 +5491,8 @@ void sofia_handle_sip_i_invite(nua_t *nua, sofia_profile_t *profile, nua_handle_ } } else if (!strncasecmp(un->un_name, "History-Info", 12)) { switch_channel_set_variable(channel, "sip_history_info", un->un_value); + } else if (!strcasecmp(un->un_name, "X-Actually-Supported")) { + tech_pvt->x_actually_supported_remote = switch_core_session_strdup(session, un->un_value); } else if (!strncasecmp(un->un_name, "X-", 2) || !strncasecmp(un->un_name, "P-", 2)) { if (!switch_strlen_zero(un->un_value)) { char new_name[512] = ""; diff --git a/src/mod/endpoints/mod_sofia/sofia_glue.c b/src/mod/endpoints/mod_sofia/sofia_glue.c index 36ef420366..becf2e4fef 100644 --- a/src/mod/endpoints/mod_sofia/sofia_glue.c +++ b/src/mod/endpoints/mod_sofia/sofia_glue.c @@ -1767,6 +1767,7 @@ switch_status_t sofia_glue_do_invite(switch_core_session_t *session) TAG_IF(!switch_strlen_zero(tech_pvt->privacy), SIPTAG_PRIVACY_STR(tech_pvt->privacy)), TAG_IF(!switch_strlen_zero(alert_info), SIPTAG_HEADER_STR(alert_info)), TAG_IF(!switch_strlen_zero(extra_headers), SIPTAG_HEADER_STR(extra_headers)), + SIPTAG_HEADER_STR("X-Actually-Support: UPDATE"), TAG_IF(!switch_strlen_zero(max_forwards), SIPTAG_MAX_FORWARDS_STR(max_forwards)), TAG_IF(!switch_strlen_zero(route_uri), NUTAG_PROXY(route_uri)), TAG_IF(!switch_strlen_zero(route), SIPTAG_ROUTE_STR(route)), diff --git a/src/switch_core_file.c b/src/switch_core_file.c index dac692e44d..da63956bbd 100644 --- a/src/switch_core_file.c +++ b/src/switch_core_file.c @@ -104,7 +104,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, if ((ext = strrchr(file_path, '.')) == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unknown file Format [%s]\n", file_path); - switch_goto_status(SWITCH_STATUS_FALSE, end); + switch_goto_status(SWITCH_STATUS_FALSE, fail); } ext++; fh->file_path = switch_core_strdup(fh->memory_pool, file_path); @@ -114,7 +114,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, if ((fh->file_interface = switch_loadable_module_get_file_interface(ext)) == 0) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Invalid file format [%s] for [%s]!\n", ext, file_path); - switch_goto_status(SWITCH_STATUS_GENERR, end); + switch_goto_status(SWITCH_STATUS_GENERR, fail); } fh->file = file; @@ -155,7 +155,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_WARNING, "Spool dir is set. Make sure [%s] is also a valid path\n", fh->spool_path); } UNPROTECT_INTERFACE(fh->file_interface); - switch_goto_status(status, end); + switch_goto_status(status, fail); } @@ -164,7 +164,7 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "File [%s] not created!\n", file_path); fh->file_interface->file_close(fh); UNPROTECT_INTERFACE(fh->file_interface); - switch_goto_status(status, end); + switch_goto_status(status, fail); } if ((flags & SWITCH_FILE_FLAG_READ)) { @@ -191,8 +191,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_perform_file_open(const char *file, } switch_set_flag(fh, SWITCH_FILE_OPEN); + return status; - end: + fail: if (switch_test_flag(fh, SWITCH_FILE_FLAG_FREE_POOL)) { switch_core_destroy_memory_pool(&fh->memory_pool);