]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-10387: [core] High memory usage with mod_sofia, osmo-nitb and DTX setting active...
authorAnthony Minessale <anthm@freeswitch.org>
Thu, 22 Jun 2017 20:48:20 +0000 (15:48 -0500)
committerAnthony Minessale <anthm@freeswitch.org>
Thu, 22 Jun 2017 20:48:20 +0000 (15:48 -0500)
src/include/switch_channel.h
src/switch_channel.c
src/switch_core_session.c

index bc37dd2e6c67beeee9b5360051afca303eb057c4..86d6769bc6ecc942b69eb314a179e899228f009c 100644 (file)
@@ -678,6 +678,7 @@ SWITCH_DECLARE(void) switch_channel_process_device_hangup(switch_channel_t *chan
 SWITCH_DECLARE(switch_caller_extension_t *) switch_channel_get_queued_extension(switch_channel_t *channel);
 SWITCH_DECLARE(void) switch_channel_transfer_to_extension(switch_channel_t *channel, switch_caller_extension_t *caller_extension);
 SWITCH_DECLARE(const char *) switch_channel_get_partner_uuid(switch_channel_t *channel);
+SWITCH_DECLARE(const char *) switch_channel_get_partner_uuid_copy(switch_channel_t *channel, char *buf, switch_size_t blen);
 SWITCH_DECLARE(switch_hold_record_t *) switch_channel_get_hold_record(switch_channel_t *channel);
 SWITCH_DECLARE(void) switch_channel_state_thread_lock(switch_channel_t *channel);
 SWITCH_DECLARE(void) switch_channel_state_thread_unlock(switch_channel_t *channel);
index 4cbe5890c7ed95b41fc5c5b82662d7ad37808b1f..09fefa1f2a4781a446f78fa1c7794419a11ba3f0 100644 (file)
@@ -4687,6 +4687,25 @@ SWITCH_DECLARE(switch_status_t) switch_channel_set_timestamps(switch_channel_t *
        return status;
 }
 
+SWITCH_DECLARE(const char *) switch_channel_get_partner_uuid_copy(switch_channel_t *channel, char *buf, switch_size_t blen)
+{
+       const char *uuid = NULL;
+
+       switch_mutex_lock(channel->profile_mutex);
+       if (!(uuid = switch_channel_get_variable_dup(channel, SWITCH_SIGNAL_BOND_VARIABLE, SWITCH_TRUE, -1))) {
+               uuid = switch_channel_get_variable_dup(channel, SWITCH_ORIGINATE_SIGNAL_BOND_VARIABLE, SWITCH_TRUE, -1);
+       }
+
+       if (uuid) {
+               strncpy(buf, uuid, blen);
+               uuid = (const char *) buf;
+       }
+       switch_mutex_unlock(channel->profile_mutex);
+
+       return uuid;
+}
+
+
 SWITCH_DECLARE(const char *) switch_channel_get_partner_uuid(switch_channel_t *channel)
 {
        const char *uuid = NULL;
index a810cc45cdcf994884e19c11b80249c99ec83a19..b57e239f92cb57127328a1f53e722b15792b5f57 100644 (file)
@@ -190,8 +190,9 @@ SWITCH_DECLARE(switch_status_t) switch_core_session_perform_get_partner(switch_c
                                                                                                                                                const char *file, const char *func, int line)
 {
        const char *uuid;
+       char uuid_str[SWITCH_UUID_FORMATTED_LENGTH + 1];
 
-       if ((uuid = switch_channel_get_partner_uuid(session->channel))) {
+       if ((uuid = switch_channel_get_partner_uuid_copy(session->channel, uuid_str, sizeof(uuid_str)))) {
                if ((*partner = switch_core_session_perform_locate(uuid, file, func, line))) {
                        return SWITCH_STATUS_SUCCESS;
                }