From 24a27c6ed5ffea511eab03f64ae0b35c8dfe9b11 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Fri, 6 Jun 2008 19:20:01 +0000 Subject: [PATCH] tweak git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@8785 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- src/switch_cpp.cpp | 31 ++++--------------------------- 1 file changed, 4 insertions(+), 27 deletions(-) diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 07cea5c2fc..3c4eef977c 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -342,34 +342,13 @@ SWITCH_DECLARE(const char *)Stream::get_data() SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession() { - session = NULL; - channel = NULL; - uuid = NULL; - tts_name = NULL; - voice_name = NULL; - memset(&args, 0, sizeof(args)); - ap = NULL; - on_hangup = NULL; - cb_state.function = NULL; - - memset(&caller_profile, 0, sizeof(caller_profile)); - caller_profile.source = "mod_unknown"; - caller_profile.dialplan = ""; - caller_profile.context = ""; - caller_profile.caller_id_name = ""; - caller_profile.caller_id_number = ""; - caller_profile.network_addr = ""; - caller_profile.ani = ""; - caller_profile.aniii = ""; - caller_profile.rdnis = ""; - caller_profile.username = ""; - + init_vars(); } SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid) { - memset(&caller_profile, 0, sizeof(caller_profile)); init_vars(); + if (!strchr(nuuid, '/') && (session = switch_core_session_locate(nuuid))) { uuid = strdup(nuuid); channel = switch_core_session_get_channel(session); @@ -388,8 +367,8 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(char *nuuid) SWITCH_DECLARE_CONSTRUCTOR CoreSession::CoreSession(switch_core_session_t *new_session) { - memset(&caller_profile, 0, sizeof(caller_profile)); init_vars(); + if (new_session) { session = new_session; channel = switch_core_session_get_channel(session); @@ -403,14 +382,12 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::~CoreSession() switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_DEBUG, "CoreSession::~CoreSession desctructor\n"); switch_channel_t *channel = NULL; - init_vars(); this_check_void(); - switch_safe_free(xml_cdr_text); switch_safe_free(uuid); switch_safe_free(tts_name); switch_safe_free(voice_name); - + if (session) { channel = switch_core_session_get_channel(session); if (switch_test_flag(this, S_HUP) && !switch_channel_test_flag(channel, CF_TRANSFER)) {