From: Anthony Minessale Date: Thu, 1 Jul 2010 20:22:13 +0000 (-0500) Subject: passing non-null value to generate_xml_cdr now implies its an initalized xml object X-Git-Tag: v1.2-rc1~563^2~38 X-Git-Url: http://git.ipfire.org/cgi-bin/gitweb.cgi?a=commitdiff_plain;h=3a6bb506c07846151aa49022ca542e57062f602f;p=thirdparty%2Ffreeswitch.git passing non-null value to generate_xml_cdr now implies its an initalized xml object --- diff --git a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c index 2edbb6f490..71159654c0 100644 --- a/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c +++ b/src/mod/event_handlers/mod_radius_cdr/mod_radius_cdr.c @@ -133,7 +133,7 @@ static rc_handle *my_radius_init(void) static switch_status_t my_on_routing(switch_core_session_t *session) { - switch_xml_t cdr; + switch_xml_t cdr = NULL; switch_channel_t *channel = switch_core_session_get_channel(session); rc_handle *rad_config; switch_status_t retval = SWITCH_STATUS_TERM; @@ -377,7 +377,7 @@ static switch_status_t my_on_routing(switch_core_session_t *session) static switch_status_t my_on_reporting(switch_core_session_t *session) { - switch_xml_t cdr; + switch_xml_t cdr = NULL; switch_channel_t *channel = switch_core_session_get_channel(session); rc_handle *rad_config; switch_status_t retval = SWITCH_STATUS_TERM; diff --git a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c index 4f6c7aadc4..ccaba559fd 100644 --- a/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c +++ b/src/mod/languages/mod_spidermonkey/mod_spidermonkey.c @@ -2090,7 +2090,7 @@ static JSBool session_pre_answer(JSContext * cx, JSObject * obj, uintN argc, jsv static JSBool session_cdr(JSContext * cx, JSObject * obj, uintN argc, jsval * argv, jsval * rval) { struct js_session *jss = JS_GetPrivate(cx, obj); - switch_xml_t cdr; + switch_xml_t cdr = NULL; /*Always a pessimist... sheesh! */ *rval = BOOLEAN_TO_JSVAL(JS_FALSE); diff --git a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c index 5f04b11800..83f9f72c09 100644 --- a/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c +++ b/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c @@ -179,7 +179,7 @@ static switch_status_t set_xml_cdr_log_dirs() static switch_status_t my_on_reporting(switch_core_session_t *session) { - switch_xml_t cdr; + switch_xml_t cdr = NULL; char *xml_text = NULL; char *path = NULL; char *curl_xml_text = NULL; diff --git a/src/switch_cpp.cpp b/src/switch_cpp.cpp index 3c71d35370..ec4c9c40b4 100644 --- a/src/switch_cpp.cpp +++ b/src/switch_cpp.cpp @@ -542,7 +542,7 @@ SWITCH_DECLARE_CONSTRUCTOR CoreSession::~CoreSession() SWITCH_DECLARE(char *) CoreSession::getXMLCDR() { - switch_xml_t cdr; + switch_xml_t cdr = NULL; this_check((char *)""); sanity_check((char *)""); diff --git a/src/switch_ivr.c b/src/switch_ivr.c index 14f874289a..f42b28ff57 100644 --- a/src/switch_ivr.c +++ b/src/switch_ivr.c @@ -1859,8 +1859,12 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_generate_xml_cdr(switch_core_session_ char tmp[512], *f; int cdr_off = 0, v_off = 0, cd_off = 0; - if (!(cdr = switch_xml_new("cdr"))) { - return SWITCH_STATUS_SUCCESS; + if (*xml_cdr) { + cdr = *xml_cdr; + } else { + if (!(cdr = switch_xml_new("cdr"))) { + return SWITCH_STATUS_SUCCESS; + } } if (!(x_channel_data = switch_xml_add_child_d(cdr, "channel_data", cdr_off++))) { diff --git a/src/switch_ivr_bridge.c b/src/switch_ivr_bridge.c index 34d53c2bcf..633d4fac34 100644 --- a/src/switch_ivr_bridge.c +++ b/src/switch_ivr_bridge.c @@ -1211,7 +1211,7 @@ SWITCH_DECLARE(switch_status_t) switch_ivr_multi_threaded_bridge(switch_core_ses } if (switch_channel_down(peer_channel) && switch_true(switch_channel_get_variable(peer_channel, SWITCH_COPY_XML_CDR_VARIABLE))) { - switch_xml_t cdr; + switch_xml_t cdr = NULL; char *xml_text; switch_channel_wait_for_state(peer_channel, caller_channel, CS_DESTROY);