From c7d1ce48b033889ca6a40f02c661a84146fd6e03 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Wed, 3 Oct 2007 18:15:20 +0000 Subject: [PATCH] fix bug in xml cdr git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5787 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- build/modules.conf.in | 23 ++++++++-------- src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c | 32 +++++++++-------------- 2 files changed, 24 insertions(+), 31 deletions(-) diff --git a/build/modules.conf.in b/build/modules.conf.in index 3ea8316b83..51db0f1535 100644 --- a/build/modules.conf.in +++ b/build/modules.conf.in @@ -4,7 +4,6 @@ applications/mod_commands applications/mod_conference applications/mod_dptools applications/mod_enum -applications/mod_fifo #applications/mod_ivrtest #applications/mod_soundtouch #applications/mod_rss @@ -24,12 +23,12 @@ codecs/mod_l16 #dialplans/mod_dialplan_directory dialplans/mod_dialplan_xml #directories/mod_ldap -endpoints/mod_dingaling -endpoints/mod_iax -endpoints/mod_portaudio +#endpoints/mod_dingaling +#endpoints/mod_iax +#endpoints/mod_portaudio endpoints/mod_sofia #endpoints/mod_wanpipe -endpoints/mod_woomera +#endpoints/mod_woomera #../../libs/openzap/mod_openzap #event_handlers/mod_cdr #event_handlers/mod_event_multicast @@ -42,15 +41,15 @@ formats/mod_native_file formats/mod_sndfile #formats/mod_shout #formats/mod_local_stream -#languages/mod_java #languages/mod_perl #languages/mod_python -#languages/mod_spidermonkey -#languages/mod_spidermonkey_teletone -#languages/mod_spidermonkey_core_db -#languages/mod_spidermonkey_odbc +languages/mod_spidermonkey +languages/mod_spidermonkey_teletone +languages/mod_spidermonkey_core_db +languages/mod_spidermonkey_odbc #languages/mod_spidermonkey_etpan -#xml_int/mod_xml_rpc +xml_int/mod_xml_rpc #xml_int/mod_xml_curl -#xml_int/mod_xml_cdr +xml_int/mod_xml_cdr say/mod_say_en + 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 4a79d1ab54..9a1c61a7bb 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 @@ -65,17 +65,16 @@ static switch_status_t my_on_hangup(switch_core_session_t *session) char *logdir = NULL; char *xml_text_escaped = NULL; int fd = -1; - uint32_t curTry; + uint32_t cur_try; long httpRes; CURL *curl_handle = NULL; switch_channel_t *channel = switch_core_session_get_channel(session); - uint32_t i; switch_status_t status = SWITCH_STATUS_FALSE; if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) { /* build the XML */ - if(!(xml_text = switch_xml_toxml(cdr))) { + if (!(xml_text = switch_xml_toxml(cdr))) { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n"); goto error; } @@ -87,7 +86,7 @@ static switch_status_t my_on_hangup(switch_core_session_t *session) logdir = globals.log_dir; } - if(!switch_strlen_zero(logdir)) { + if (!switch_strlen_zero(logdir)) { if ((path = switch_mprintf("%s/%s.cdr.xml", logdir, switch_core_session_get_uuid(session)))) { if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) { int wrote; @@ -139,26 +138,21 @@ static switch_status_t my_on_hangup(switch_core_session_t *session) curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level */ - for (curTry=0;curTry<=globals.retries;curTry++) { + for (cur_try = 0; cur_try < globals.retries; cur_try++) { + if (cur_try > 0) { + sleep(globals.delay); + } curl_easy_perform(curl_handle); - curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE,&httpRes); - if (httpRes==200) { + curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes); + if (httpRes == 200) { goto success; } else { switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n",httpRes, globals.url); } - - /* make sure we dont sleep on the last try */ - for (i=0;i