fix bug in xml cdr

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@5787 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Anthony Minessale 2007-10-03 18:15:20 +00:00
parent 8beac81a46
commit c7d1ce48b0
2 changed files with 24 additions and 31 deletions

View File

@ -4,7 +4,6 @@ applications/mod_commands
applications/mod_conference applications/mod_conference
applications/mod_dptools applications/mod_dptools
applications/mod_enum applications/mod_enum
applications/mod_fifo
#applications/mod_ivrtest #applications/mod_ivrtest
#applications/mod_soundtouch #applications/mod_soundtouch
#applications/mod_rss #applications/mod_rss
@ -24,12 +23,12 @@ codecs/mod_l16
#dialplans/mod_dialplan_directory #dialplans/mod_dialplan_directory
dialplans/mod_dialplan_xml dialplans/mod_dialplan_xml
#directories/mod_ldap #directories/mod_ldap
endpoints/mod_dingaling #endpoints/mod_dingaling
endpoints/mod_iax #endpoints/mod_iax
endpoints/mod_portaudio #endpoints/mod_portaudio
endpoints/mod_sofia endpoints/mod_sofia
#endpoints/mod_wanpipe #endpoints/mod_wanpipe
endpoints/mod_woomera #endpoints/mod_woomera
#../../libs/openzap/mod_openzap #../../libs/openzap/mod_openzap
#event_handlers/mod_cdr #event_handlers/mod_cdr
#event_handlers/mod_event_multicast #event_handlers/mod_event_multicast
@ -42,15 +41,15 @@ formats/mod_native_file
formats/mod_sndfile formats/mod_sndfile
#formats/mod_shout #formats/mod_shout
#formats/mod_local_stream #formats/mod_local_stream
#languages/mod_java
#languages/mod_perl #languages/mod_perl
#languages/mod_python #languages/mod_python
#languages/mod_spidermonkey languages/mod_spidermonkey
#languages/mod_spidermonkey_teletone languages/mod_spidermonkey_teletone
#languages/mod_spidermonkey_core_db languages/mod_spidermonkey_core_db
#languages/mod_spidermonkey_odbc languages/mod_spidermonkey_odbc
#languages/mod_spidermonkey_etpan #languages/mod_spidermonkey_etpan
#xml_int/mod_xml_rpc xml_int/mod_xml_rpc
#xml_int/mod_xml_curl #xml_int/mod_xml_curl
#xml_int/mod_xml_cdr xml_int/mod_xml_cdr
say/mod_say_en say/mod_say_en

View File

@ -65,11 +65,10 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
char *logdir = NULL; char *logdir = NULL;
char *xml_text_escaped = NULL; char *xml_text_escaped = NULL;
int fd = -1; int fd = -1;
uint32_t curTry; uint32_t cur_try;
long httpRes; long httpRes;
CURL *curl_handle = NULL; CURL *curl_handle = NULL;
switch_channel_t *channel = switch_core_session_get_channel(session); switch_channel_t *channel = switch_core_session_get_channel(session);
uint32_t i;
switch_status_t status = SWITCH_STATUS_FALSE; switch_status_t status = SWITCH_STATUS_FALSE;
if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) { if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
@ -139,7 +138,10 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level 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_perform(curl_handle);
curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes); curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
if (httpRes == 200) { if (httpRes == 200) {
@ -148,17 +150,9 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Got error [%ld] posting to web server [%s]\n",httpRes, globals.url); 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<globals.delay && (curTry != (globals.retries));i++) {
switch_sleep(1000);
if(globals.shutdown) {
/* we are shutting down so dont try to webpost any more */
i=globals.delay;
curTry=globals.retries;
}
}
} }
curl_easy_cleanup(curl_handle); curl_easy_cleanup(curl_handle);
curl_handle = NULL;
/* if we are here the web post failed for some reason */ /* if we are here the web post failed for some reason */
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n"); switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Unable to post to web server, writing to file\n");