<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.1//EN"
"http://www.w3.org/TR/xhtml11/DTD/xhtml11.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head><meta http-equiv="content-type" content="text/html; charset=utf-8" />
<title>[Freeswitch-trunk][16686] </title>
</head>
<body>
<style type="text/css"><!--
#msg dl.meta { border: 1px #006 solid; background: #369; padding: 6px; color: #fff; }
#msg dl.meta dt { float: left; width: 6em; font-weight: bold; }
#msg dt:after { content:':';}
#msg dl, #msg dt, #msg ul, #msg li, #header, #footer, #logmsg { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; }
#msg dl a { font-weight: bold}
#msg dl a:link { color:#fc3; }
#msg dl a:active { color:#ff0; }
#msg dl a:visited { color:#cc6; }
h3 { font-family: verdana,arial,helvetica,sans-serif; font-size: 10pt; font-weight: bold; }
#msg pre { overflow: auto; background: #ffc; border: 1px #fa0 solid; padding: 6px; }
#logmsg { background: #ffc; border: 1px #fa0 solid; padding: 1em 1em 0 1em; }
#logmsg p, #logmsg pre, #logmsg blockquote { margin: 0 0 1em 0; }
#logmsg p, #logmsg li, #logmsg dt, #logmsg dd { line-height: 14pt; }
#logmsg h1, #logmsg h2, #logmsg h3, #logmsg h4, #logmsg h5, #logmsg h6 { margin: .5em 0; }
#logmsg h1:first-child, #logmsg h2:first-child, #logmsg h3:first-child, #logmsg h4:first-child, #logmsg h5:first-child, #logmsg h6:first-child { margin-top: 0; }
#logmsg ul, #logmsg ol { padding: 0; list-style-position: inside; margin: 0 0 0 1em; }
#logmsg ul { text-indent: -1em; padding-left: 1em; }#logmsg ol { text-indent: -1.5em; padding-left: 1.5em; }
#logmsg > ul, #logmsg > ol { margin: 0 0 1em 0; }
#logmsg pre { background: #eee; padding: 1em; }
#logmsg blockquote { border: 1px solid #fa0; border-left-width: 10px; padding: 1em 1em 0 1em; background: white;}
#logmsg dl { margin: 0; }
#logmsg dt { font-weight: bold; }
#logmsg dd { margin: 0; padding: 0 0 0.5em 0; }
#logmsg dd:before { content:'\00bb';}
#logmsg table { border-spacing: 0px; border-collapse: collapse; border-top: 4px solid #fa0; border-bottom: 1px solid #fa0; background: #fff; }
#logmsg table th { text-align: left; font-weight: normal; padding: 0.2em 0.5em; border-top: 1px dotted #fa0; }
#logmsg table td { text-align: right; border-top: 1px dotted #fa0; padding: 0.2em 0.5em; }
#logmsg table thead th { text-align: center; border-bottom: 1px solid #fa0; }
#logmsg table th.Corner { text-align: left; }
#logmsg hr { border: none 0; border-top: 2px dashed #fa0; height: 1px; }
#header, #footer { color: #fff; background: #636; border: 1px #300 solid; padding: 6px; }
#patch { width: 100%; }
#patch h4 {font-family: verdana,arial,helvetica,sans-serif;font-size:10pt;padding:8px;background:#369;color:#fff;margin:0;}
#patch .propset h4, #patch .binary h4 {margin:0;}
#patch pre {padding:0;line-height:1.2em;margin:0;}
#patch .diff {width:100%;background:#eee;padding: 0 0 10px 0;overflow:auto;}
#patch .propset .diff, #patch .binary .diff {padding:10px 0;}
#patch span {display:block;padding:0 10px;}
#patch .modfile, #patch .addfile, #patch .delfile, #patch .propset, #patch .binary, #patch .copfile {border:1px solid #ccc;margin:10px 0;}
#patch ins {background:#dfd;text-decoration:none;display:block;padding:0 10px;}
#patch del {background:#fdd;text-decoration:none;display:block;padding:0 10px;}
#patch .lines, .info {color:#888;background:#fff;}
--></style>
<div id="msg">
<div id="header">FreeSWITCH Subversion</div>
<dl class="meta">
<dt>Revision</dt> <dd><a href="http://fisheye.freeswitch.org/changelog/FreeSWITCH?cs=16686">16686</a></dd>
<dt>Author</dt> <dd>cseket</dd>
<dt>Date</dt> <dd>2010-02-18 09:45:04 -0600 (Thu, 18 Feb 2010)</dd>
</dl>
<h3>Log Message</h3>
<pre>merge svn trunk</pre>
<h3>Modified Paths</h3>
<ul>
<li><a href="#freeswitchbranchescseketsrcmodxml_intmod_xml_cdrmod_xml_cdrc">freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c</a></li>
<li><a href="#freeswitchbranchescseketsrcmodxml_intmod_xml_cdrmod_xml_cdrvcproj">freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.vcproj</a></li>
</ul>
<h3>Added Paths</h3>
<ul>
<li><a href="#freeswitchbranchescseketsrcmodxml_intmod_xml_cdrMakefile">freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/Makefile</a></li>
<li><a href="#freeswitchbranchescseketsrcmodxml_intmod_xml_cdrmod_xml_cdr2008vcproj">freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.2008.vcproj</a></li>
</ul>
<h3>Property Changed</h3>
<ul>
<li><a href="#freeswitchbranchescseketsrcmodxml_intmod_xml_cdr">freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/</a></li>
<li><a href="#freeswitchbranchescseketsrcmodxml_intmod_xml_cdrmod_xml_cdrc">freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c</a></li>
<li><a href="#freeswitchbranchescseketsrcmodxml_intmod_xml_cdrmod_xml_cdrvcproj">freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.vcproj</a></li>
</ul>
</div>
<div id="patch">
<h3>Diff</h3>
<a id="freeswitchbranchescseketsrcmodxml_intmod_xml_cdr"></a>
<div class="propset"><h4>Property changes: freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr</h4>
<pre class="diff"><span>
<span class="cx">Name: svn:ignore
</span><span class="cx"> + Release
</span><span class="cx">Debug
</span><span class="cx">*.user
</span><span class="cx">*.so
</span><span class="cx">*.pdb
</span><span class="cx">*.dylib
</span><span class="cx">*.o
</span><span class="cx">.libs
</span><span class="cx">Makefile
</span><span class="cx">debug
</span><span class="cx">Win32
</span><span class="cx">x64
</span></span></pre></div>
<a id="freeswitchbranchescseketsrcmodxml_intmod_xml_cdrMakefilefromrev16685freeswitchtrunksrcmodxml_intmod_xml_cdrMakefile"></a>
<div class="copfile"><h4>Copied: freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/Makefile (from rev 16685, freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/Makefile) (0 => 16686)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/Makefile         (rev 0)
+++ freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/Makefile        2010-02-18 15:45:04 UTC (rev 16686)
</span><span class="lines">@@ -0,0 +1,2 @@
</span><ins>+WANT_CURL=yes
+include ../../../../build/modmake.rules
</ins></span></pre></div>
<a id="freeswitchbranchescseketsrcmodxml_intmod_xml_cdrmod_xml_cdr2008vcprojfromrev16685freeswitchtrunksrcmodxml_intmod_xml_cdrmod_xml_cdr2008vcproj"></a>
<div class="copfile"><h4>Copied: freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.2008.vcproj (from rev 16685, freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.2008.vcproj) (0 => 16686)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.2008.vcproj         (rev 0)
+++ freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.2008.vcproj        2010-02-18 15:45:04 UTC (rev 16686)
</span><span class="lines">@@ -0,0 +1,289 @@
</span><ins>+<?xml version="1.0" encoding="Windows-1252"?>
+<VisualStudioProject
+        ProjectType="Visual C++"
+        Version="9.00"
+        Name="mod_xml_cdr"
+        ProjectGUID="{08DAD348-9E0A-4A2E-97F1-F1E7E24A7836}"
+        RootNamespace="mod_xml_cdr"
+        Keyword="Win32Proj"
+        TargetFrameworkVersion="131072"
+        >
+        <Platforms>
+                <Platform
+                        Name="Win32"
+                />
+                <Platform
+                        Name="x64"
+                />
+        </Platforms>
+        <ToolFiles>
+        </ToolFiles>
+        <Configurations>
+                <Configuration
+                        Name="Debug|Win32"
+                        ConfigurationType="2"
+                        InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\curl.vsprops"
+                        CharacterSet="2"
+                        >
+                        <Tool
+                                Name="VCPreBuildEventTool"
+                        />
+                        <Tool
+                                Name="VCCustomBuildTool"
+                        />
+                        <Tool
+                                Name="VCXMLDataGeneratorTool"
+                        />
+                        <Tool
+                                Name="VCWebServiceProxyGeneratorTool"
+                        />
+                        <Tool
+                                Name="VCMIDLTool"
+                        />
+                        <Tool
+                                Name="VCCLCompilerTool"
+                                AdditionalIncludeDirectories=""
+                                UsePrecompiledHeader="0"
+                        />
+                        <Tool
+                                Name="VCManagedResourceCompilerTool"
+                        />
+                        <Tool
+                                Name="VCResourceCompilerTool"
+                        />
+                        <Tool
+                                Name="VCPreLinkEventTool"
+                        />
+                        <Tool
+                                Name="VCLinkerTool"
+                                RandomizedBaseAddress="1"
+                                DataExecutionPrevention="0"
+                        />
+                        <Tool
+                                Name="VCALinkTool"
+                        />
+                        <Tool
+                                Name="VCManifestTool"
+                        />
+                        <Tool
+                                Name="VCXDCMakeTool"
+                        />
+                        <Tool
+                                Name="VCBscMakeTool"
+                        />
+                        <Tool
+                                Name="VCFxCopTool"
+                        />
+                        <Tool
+                                Name="VCAppVerifierTool"
+                        />
+                        <Tool
+                                Name="VCPostBuildEventTool"
+                        />
+                </Configuration>
+                <Configuration
+                        Name="Debug|x64"
+                        ConfigurationType="2"
+                        InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\curl.vsprops"
+                        CharacterSet="2"
+                        >
+                        <Tool
+                                Name="VCPreBuildEventTool"
+                        />
+                        <Tool
+                                Name="VCCustomBuildTool"
+                        />
+                        <Tool
+                                Name="VCXMLDataGeneratorTool"
+                        />
+                        <Tool
+                                Name="VCWebServiceProxyGeneratorTool"
+                        />
+                        <Tool
+                                Name="VCMIDLTool"
+                                TargetEnvironment="3"
+                        />
+                        <Tool
+                                Name="VCCLCompilerTool"
+                                AdditionalIncludeDirectories=""
+                                UsePrecompiledHeader="0"
+                        />
+                        <Tool
+                                Name="VCManagedResourceCompilerTool"
+                        />
+                        <Tool
+                                Name="VCResourceCompilerTool"
+                        />
+                        <Tool
+                                Name="VCPreLinkEventTool"
+                        />
+                        <Tool
+                                Name="VCLinkerTool"
+                                OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+                                RandomizedBaseAddress="1"
+                                DataExecutionPrevention="0"
+                                TargetMachine="17"
+                        />
+                        <Tool
+                                Name="VCALinkTool"
+                        />
+                        <Tool
+                                Name="VCManifestTool"
+                        />
+                        <Tool
+                                Name="VCXDCMakeTool"
+                        />
+                        <Tool
+                                Name="VCBscMakeTool"
+                        />
+                        <Tool
+                                Name="VCFxCopTool"
+                        />
+                        <Tool
+                                Name="VCAppVerifierTool"
+                        />
+                        <Tool
+                                Name="VCPostBuildEventTool"
+                        />
+                </Configuration>
+                <Configuration
+                        Name="Release|Win32"
+                        ConfigurationType="2"
+                        InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
+                        CharacterSet="2"
+                        >
+                        <Tool
+                                Name="VCPreBuildEventTool"
+                        />
+                        <Tool
+                                Name="VCCustomBuildTool"
+                        />
+                        <Tool
+                                Name="VCXMLDataGeneratorTool"
+                        />
+                        <Tool
+                                Name="VCWebServiceProxyGeneratorTool"
+                        />
+                        <Tool
+                                Name="VCMIDLTool"
+                        />
+                        <Tool
+                                Name="VCCLCompilerTool"
+                                AdditionalIncludeDirectories=""
+                                UsePrecompiledHeader="0"
+                        />
+                        <Tool
+                                Name="VCManagedResourceCompilerTool"
+                        />
+                        <Tool
+                                Name="VCResourceCompilerTool"
+                        />
+                        <Tool
+                                Name="VCPreLinkEventTool"
+                        />
+                        <Tool
+                                Name="VCLinkerTool"
+                                AdditionalLibraryDirectories=""
+                                RandomizedBaseAddress="1"
+                                DataExecutionPrevention="0"
+                        />
+                        <Tool
+                                Name="VCALinkTool"
+                        />
+                        <Tool
+                                Name="VCManifestTool"
+                        />
+                        <Tool
+                                Name="VCXDCMakeTool"
+                        />
+                        <Tool
+                                Name="VCBscMakeTool"
+                        />
+                        <Tool
+                                Name="VCFxCopTool"
+                        />
+                        <Tool
+                                Name="VCAppVerifierTool"
+                        />
+                        <Tool
+                                Name="VCPostBuildEventTool"
+                        />
+                </Configuration>
+                <Configuration
+                        Name="Release|x64"
+                        ConfigurationType="2"
+                        InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
+                        CharacterSet="2"
+                        >
+                        <Tool
+                                Name="VCPreBuildEventTool"
+                        />
+                        <Tool
+                                Name="VCCustomBuildTool"
+                        />
+                        <Tool
+                                Name="VCXMLDataGeneratorTool"
+                        />
+                        <Tool
+                                Name="VCWebServiceProxyGeneratorTool"
+                        />
+                        <Tool
+                                Name="VCMIDLTool"
+                                TargetEnvironment="3"
+                        />
+                        <Tool
+                                Name="VCCLCompilerTool"
+                                AdditionalIncludeDirectories=""
+                                UsePrecompiledHeader="0"
+                        />
+                        <Tool
+                                Name="VCManagedResourceCompilerTool"
+                        />
+                        <Tool
+                                Name="VCResourceCompilerTool"
+                        />
+                        <Tool
+                                Name="VCPreLinkEventTool"
+                        />
+                        <Tool
+                                Name="VCLinkerTool"
+                                OutputFile="$(SolutionDir)$(PlatformName)\$(ConfigurationName)/mod/$(ProjectName).dll"
+                                AdditionalLibraryDirectories=""
+                                RandomizedBaseAddress="1"
+                                DataExecutionPrevention="0"
+                                TargetMachine="17"
+                        />
+                        <Tool
+                                Name="VCALinkTool"
+                        />
+                        <Tool
+                                Name="VCManifestTool"
+                        />
+                        <Tool
+                                Name="VCXDCMakeTool"
+                        />
+                        <Tool
+                                Name="VCBscMakeTool"
+                        />
+                        <Tool
+                                Name="VCFxCopTool"
+                        />
+                        <Tool
+                                Name="VCAppVerifierTool"
+                        />
+                        <Tool
+                                Name="VCPostBuildEventTool"
+                        />
+                </Configuration>
+        </Configurations>
+        <References>
+        </References>
+        <Files>
+                <File
+                        RelativePath=".\mod_xml_cdr.c"
+                        >
+                </File>
+        </Files>
+        <Globals>
+        </Globals>
+</VisualStudioProject>
</ins></span></pre></div>
<a id="freeswitchbranchescseketsrcmodxml_intmod_xml_cdrmod_xml_cdrc"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (16685 => 16686)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c        2010-02-18 11:03:12 UTC (rev 16685)
+++ freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c        2010-02-18 15:45:04 UTC (rev 16686)
</span><span class="lines">@@ -1,6 +1,6 @@
</span><span class="cx"> /*
</span><span class="cx"> * FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
</span><del>- * Copyright (C) 2005/2006, Anthony Minessale II <anthmct@yahoo.com>
</del><ins>+ * Copyright (C) 2005-2010, Anthony Minessale II <anthm@freeswitch.org>
</ins><span class="cx"> *
</span><span class="cx"> * Version: MPL 1.1
</span><span class="cx"> *
</span><span class="lines">@@ -17,97 +17,590 @@
</span><span class="cx"> * The Original Code is FreeSWITCH Modular Media Switching Software Library / Soft-Switch Application
</span><span class="cx"> *
</span><span class="cx"> * The Initial Developer of the Original Code is
</span><del>- * Anthony Minessale II <anthmct@yahoo.com>
</del><ins>+ * Anthony Minessale II <anthm@freeswitch.org>
</ins><span class="cx"> * Portions created by the Initial Developer are Copyright (C)
</span><span class="cx"> * the Initial Developer. All Rights Reserved.
</span><span class="cx"> *
</span><span class="cx"> * Contributor(s):
</span><span class="cx"> *
</span><del>- * Brian West <brian.west@mac.com>
</del><ins>+ * Brian West <brian@freeswitch.org>
+ * Bret McDanel <trixter AT 0xdecafbad.com>
+ * Justin Cassidy <xachenant@hotmail.com>
</ins><span class="cx"> *
</span><ins>+ * mod_xml_cdr.c -- XML CDR Module to files or curl
</ins><span class="cx"> *
</span><del>- * mod_xml_cdr.c -- XML CDR Module
- *
</del><span class="cx"> */
</span><span class="cx"> #include <sys/stat.h>
</span><span class="cx"> #include <switch.h>
</span><ins>+#include <curl/curl.h>
+#define MAX_URLS 20
</ins><span class="cx">
</span><del>-static const char modname[] = "mod_xml_cdr";
</del><ins>+#define ENCODING_NONE 0
+#define ENCODING_DEFAULT 1
+#define ENCODING_BASE64 2
+#define ENCODING_TEXTXML 2
</ins><span class="cx">
</span><del>-static switch_status_t my_on_hangup(switch_core_session_t *session)
</del><ins>+static struct {
+        char *cred;
+        char *urls[MAX_URLS + 1];
+        int url_count;
+        int url_index;
+        switch_thread_rwlock_t *log_path_lock;
+        char *base_log_dir;
+        char *base_err_log_dir;
+        char *log_dir;
+        char *err_log_dir;
+        uint32_t delay;
+        uint32_t retries;
+        uint32_t shutdown;
+        uint32_t enable_cacert_check;
+        char *ssl_cert_file;
+        char *ssl_key_file;
+        char *ssl_key_password;
+        char *ssl_version;
+        char *ssl_cacert_file;
+        uint32_t enable_ssl_verifyhost;
+        int encode;
+        int log_http_and_disk;
+        int log_b;
+        int prefix_a;
+        int disable100continue;
+        int rotate;
+        int auth_scheme;
+        switch_memory_pool_t *pool;
+} globals;
+
+SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load);
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_cdr_shutdown);
+SWITCH_MODULE_DEFINITION(mod_xml_cdr, mod_xml_cdr_load, mod_xml_cdr_shutdown, NULL);
+
+/* this function would have access to the HTML returned by the webserver, we don't need it
+ * and the default curl activity is to print to stdout, something not as desirable
+ * so we have a dummy function here
+ */
+static size_t httpCallBack(char *buffer, size_t size, size_t nitems, void *outstream)
</ins><span class="cx"> {
</span><del>-        switch_xml_t cdr;
-        
-        if (switch_ivr_generate_xml_cdr(session, &cdr) == SWITCH_STATUS_SUCCESS) {
-                switch_channel_t *channel = switch_core_session_get_channel(session);
-                char *xml_text;
-                char *path;
-                int fd = -1;
-                const char *header = "<?xml version=\"1.0\"?>\n";
-                char *uuid_str = switch_core_session_get_uuid(session);
-                char *logdir = SWITCH_GLOBAL_dirs.log_dir;
-                char *alt;
</del><ins>+        return size * nitems;
+}
</ins><span class="cx">
</span><del>-                if ((alt = switch_channel_get_variable(channel, "xml_cdr_base"))) {
-                        logdir = alt;
</del><ins>+static switch_status_t set_xml_cdr_log_dirs()
+{
+        switch_time_exp_t tm;
+        char *path = NULL;
+        char date[80] = "";
+        switch_size_t retsize;
+        switch_status_t status = SWITCH_STATUS_SUCCESS, dir_status;
+
+        switch_time_exp_lt(&tm, switch_micro_time_now());
+        switch_strftime_nocheck(date, &retsize, sizeof(date), "%Y-%m-%d-%H-%M-%S", &tm);
+
+        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating log file paths\n");
+
+        if (!zstr(globals.base_log_dir)) {
+                if (globals.rotate) {
+                        if ((path = switch_mprintf("%s%s%s", globals.base_log_dir, SWITCH_PATH_SEPARATOR, date))) {
+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating log file path to %s\n", path);
+
+                                dir_status = SWITCH_STATUS_SUCCESS;
+                                if (switch_directory_exists(path, globals.pool) != SWITCH_STATUS_SUCCESS) {
+                                        dir_status = switch_dir_make(path, SWITCH_FPROT_OS_DEFAULT, globals.pool);
+                                }
+
+                                if (dir_status == SWITCH_STATUS_SUCCESS) {
+                                        switch_thread_rwlock_wrlock(globals.log_path_lock);
+                                        switch_safe_free(globals.log_dir);
+                                        globals.log_dir = path;
+                                        switch_thread_rwlock_unlock(globals.log_path_lock);
+                                } else {
+                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new mod_xml_cdr log_dir path\n");
+                                        switch_safe_free(path);
+                                        status = SWITCH_STATUS_FALSE;
+                                }
+                        } else {
+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to generate new mod_xml_cdr log_dir path\n");
+                                status = SWITCH_STATUS_FALSE;
+                        }
+                } else {
+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Setting log file path to %s\n", globals.base_log_dir);
+                        if ((path = switch_safe_strdup(globals.base_log_dir))) {
+                                switch_thread_rwlock_wrlock(globals.log_path_lock);
+                                switch_safe_free(globals.log_dir);
+                                globals.log_dir = path;
+                                switch_thread_rwlock_unlock(globals.log_path_lock);
+                        } else {
+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set log_dir path\n");
+                                status = SWITCH_STATUS_FALSE;
+                        }
</ins><span class="cx">                 }
</span><del>-                
-                if ((path = switch_mprintf("%s/xml_cdr/%s.cdr.xml", logdir, uuid_str))) {
-                        if ((xml_text = switch_xml_toxml(cdr))) {
-                                if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
-                                        write(fd, header, (unsigned)strlen(header));
-                                        write(fd, xml_text, (unsigned)strlen(xml_text));
-                                        close(fd);
-                                        fd = -1;
</del><ins>+        }
+
+        if (!zstr(globals.base_err_log_dir)) {
+                if (globals.rotate) {
+                        if ((path = switch_mprintf("%s%s%s", globals.base_err_log_dir, SWITCH_PATH_SEPARATOR, date))) {
+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Rotating err log file path to %s\n", path);
+
+                                dir_status = SWITCH_STATUS_SUCCESS;
+                                if (switch_directory_exists(path, globals.pool) != SWITCH_STATUS_SUCCESS) {
+                                        dir_status = switch_dir_make(path, SWITCH_FPROT_OS_DEFAULT, globals.pool);
+                                }
+
+                                if (dir_status == SWITCH_STATUS_SUCCESS) {
+                                        switch_thread_rwlock_wrlock(globals.log_path_lock);
+                                        switch_safe_free(globals.err_log_dir);
+                                        globals.err_log_dir = path;
+                                        switch_thread_rwlock_unlock(globals.log_path_lock);
</ins><span class="cx">                                 } else {
</span><del>-                                        char ebuf[512] = {0};
</del><ins>+                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to create new mod_xml_cdr err_log_dir path\n");
+                                        switch_safe_free(path);
+                                        status = SWITCH_STATUS_FALSE;
+                                }
+                        } else {
+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to generate new mod_xml_cdr err_log_dir path\n");
+                                status = SWITCH_STATUS_FALSE;
+                        }
+                } else {
+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_NOTICE, "Setting err log file path to %s\n", globals.base_err_log_dir);
+                        if ((path = switch_safe_strdup(globals.base_err_log_dir))) {
+                                switch_thread_rwlock_wrlock(globals.log_path_lock);
+                                switch_safe_free(globals.err_log_dir);
+                                globals.err_log_dir = path;
+                                switch_thread_rwlock_unlock(globals.log_path_lock);
+                        } else {
+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Failed to set err_log_dir path\n");
+                                status = SWITCH_STATUS_FALSE;
+                        }
+                }
+        }
+
+        return status;
+}
+
+static switch_status_t my_on_reporting(switch_core_session_t *session)
+{
+        switch_xml_t cdr;
+        char *xml_text = NULL;
+        char *path = NULL;
+        char *curl_xml_text = NULL;
+        const char *logdir = NULL;
+        char *xml_text_escaped = NULL;
+        int fd = -1;
+        uint32_t cur_try;
+        long httpRes;
+        CURL *curl_handle = NULL;
+        struct curl_slist *headers = NULL;
+        struct curl_slist *slist = NULL;
+        switch_channel_t *channel = switch_core_session_get_channel(session);
+        switch_status_t status = SWITCH_STATUS_FALSE;
+        int is_b;
+        const char *a_prefix = "";
+
+        if (globals.shutdown) {
+                return SWITCH_STATUS_SUCCESS;
+        }
+
+        is_b = channel && switch_channel_get_originator_caller_profile(channel);
+        if (!globals.log_b && is_b) {
+                return SWITCH_STATUS_SUCCESS;
+        }
+        if (!is_b && globals.prefix_a)
+                a_prefix = "a_";
+
+        if (switch_ivr_generate_xml_cdr(session, &cdr) != SWITCH_STATUS_SUCCESS) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
+                return SWITCH_STATUS_FALSE;
+        }
+
+        /* build the XML */
+        xml_text = switch_xml_toxml(cdr, SWITCH_TRUE);
+        if (!xml_text) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+                goto error;
+        }
+
+        switch_thread_rwlock_rdlock(globals.log_path_lock);
+
+        if (!(logdir = switch_channel_get_variable(channel, "xml_cdr_base"))) {
+                logdir = globals.log_dir;
+        }
+
+        if (!zstr(logdir) && (globals.log_http_and_disk || !globals.url_count)) {
+                path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session));
+                switch_thread_rwlock_unlock(globals.log_path_lock);
+                if (path) {
+#ifdef _MSC_VER
+                        if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
+#else
+                        if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) {
+#endif
+                                int wrote;
+                                wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
+                                close(fd);
+                                fd = -1;
+                        } else {
+                                char ebuf[512] = { 0 };
</ins><span class="cx"> #ifdef WIN32
</span><del>-                                        strerror_s(ebuf, sizeof(ebuf), errno);
</del><ins>+                                strerror_s(ebuf, sizeof(ebuf), errno);
</ins><span class="cx"> #else
</span><del>-                                        strerror_r(errno, ebuf, sizeof(ebuf));
</del><ins>+                                strerror_r(errno, ebuf, sizeof(ebuf));
</ins><span class="cx"> #endif
</span><del>-                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
</del><ins>+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error writing [%s][%s]\n", path, ebuf);
+                        }
+                        switch_safe_free(path);
+                }
+        } else {
+                switch_thread_rwlock_unlock(globals.log_path_lock);
+        }
+
+        /* try to post it to the web server */
+        if (globals.url_count) {
+                char *destUrl = NULL;
+                curl_handle = curl_easy_init();
+
+                if (globals.encode == ENCODING_TEXTXML) {
+                        headers = curl_slist_append(headers, "Content-Type: text/xml");
+                } else if (globals.encode) {
+                        switch_size_t need_bytes = strlen(xml_text) * 3;
+
+                        xml_text_escaped = malloc(need_bytes);
+                        switch_assert(xml_text_escaped);
+                        memset(xml_text_escaped, 0, need_bytes);
+                        if (globals.encode == ENCODING_DEFAULT) {
+                                headers = curl_slist_append(headers, "Content-Type: application/x-www-form-urlencoded");
+                                switch_url_encode(xml_text, xml_text_escaped, need_bytes);
+                        } else {
+                                headers = curl_slist_append(headers, "Content-Type: application/x-www-form-base64-encoded");
+                                switch_b64_encode((unsigned char *) xml_text, need_bytes / 3, (unsigned char *) xml_text_escaped, need_bytes);
+                        }
+                        switch_safe_free(xml_text);
+                        xml_text = xml_text_escaped;
+                } else {
+                        headers = curl_slist_append(headers, "Content-Type: application/x-www-form-plaintext");
+                }
+
+                if (globals.encode == ENCODING_TEXTXML) {
+                        curl_xml_text = xml_text;
+                } else if (!(curl_xml_text = switch_mprintf("cdr=%s", xml_text))) {
+                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_CRIT, "Memory Error!\n");
+                        goto error;
+                }
+
+                if (!zstr(globals.cred)) {
+                        curl_easy_setopt(curl_handle, CURLOPT_HTTPAUTH, globals.auth_scheme);
+                        curl_easy_setopt(curl_handle, CURLOPT_USERPWD, globals.cred);
+                }
+
+                curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, headers);
+                curl_easy_setopt(curl_handle, CURLOPT_POST, 1);
+                curl_easy_setopt(curl_handle, CURLOPT_POSTFIELDS, curl_xml_text);
+                curl_easy_setopt(curl_handle, CURLOPT_USERAGENT, "freeswitch-xml/1.0");
+                curl_easy_setopt(curl_handle, CURLOPT_WRITEFUNCTION, httpCallBack);
+
+                if (globals.disable100continue) {
+                        slist = curl_slist_append(slist, "Expect:");
+                        curl_easy_setopt(curl_handle, CURLOPT_HTTPHEADER, slist);
+                }
+
+                if (globals.ssl_cert_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSLCERT, globals.ssl_cert_file);
+                }
+
+                if (globals.ssl_key_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSLKEY, globals.ssl_key_file);
+                }
+
+                if (globals.ssl_key_password) {
+                        curl_easy_setopt(curl_handle, CURLOPT_SSLKEYPASSWD, globals.ssl_key_password);
+                }
+
+                if (globals.ssl_version) {
+                        if (!strcasecmp(globals.ssl_version, "SSLv3")) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_SSLv3);
+                        } else if (!strcasecmp(globals.ssl_version, "TLSv1")) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1);
+                        }
+                }
+
+                if (globals.ssl_cacert_file) {
+                        curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file);
+                }
+
+                /* these were used for testing, optionally they may be enabled if someone desires
+                 curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
+                 curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
+                 */
+
+                for (cur_try = 0; cur_try < globals.retries; cur_try++) {
+                        if (cur_try > 0) {
+                                switch_yield(globals.delay * 1000000);
+                        }
+
+                        destUrl = switch_mprintf("%s?uuid=%s", globals.urls[globals.url_index], switch_core_session_get_uuid(session));
+                        curl_easy_setopt(curl_handle, CURLOPT_URL, destUrl);
+
+                        if (!strncasecmp(destUrl, "https", 5)) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, 0);
+                                curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 0);
+                        }
+
+                        if (globals.enable_cacert_check) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYPEER, TRUE);
+                        }
+
+                        if (globals.enable_ssl_verifyhost) {
+                                curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2);
+                        }
+
+                        curl_easy_perform(curl_handle);
+                        curl_easy_getinfo(curl_handle, CURLINFO_RESPONSE_CODE, &httpRes);
+                        switch_safe_free(destUrl);
+                        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.urls[globals.url_index]);
+                                globals.url_index++;
+                                switch_assert(globals.url_count <= MAX_URLS);
+                                if (globals.url_index >= globals.url_count) {
+                                        globals.url_index = 0;
</ins><span class="cx">                                 }
</span><del>-                                free(xml_text);
</del><ins>+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Retry will be with url [%s]\n", globals.urls[globals.url_index]);
</ins><span class="cx">                         }
</span><del>-                        free(path);
</del><span class="cx">                 }
</span><ins>+                curl_easy_cleanup(curl_handle);
+                curl_slist_free_all(headers);
+                curl_slist_free_all(slist);
+                slist = NULL;
+                headers = NULL;
+                curl_handle = NULL;
</ins><span class="cx">
</span><del>-                switch_xml_free(cdr);
-        } else {
-                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
</del><ins>+                /* 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_thread_rwlock_rdlock(globals.log_path_lock);
+                path = switch_mprintf("%s%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session));
+                switch_thread_rwlock_unlock(globals.log_path_lock);
+                if (path) {
+#ifdef _MSC_VER
+                        if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
+#else
+                        if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR | S_IRGRP | S_IWGRP | S_IROTH | S_IWOTH)) > -1) {
+#endif
+                                int wrote;
+                                wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
+                                close(fd);
+                                fd = -1;
+                        } else {
+                                char ebuf[512] = { 0 };
+#ifdef WIN32
+                                strerror_s(ebuf, sizeof(ebuf), errno);
+#else
+                                strerror_r(errno, ebuf, sizeof(ebuf));
+#endif
+                                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error![%s]\n", ebuf);
+                        }
+                }
</ins><span class="cx">         }
</span><del>-        
-        return SWITCH_STATUS_SUCCESS;
</del><ins>+
+ success:
+        status = SWITCH_STATUS_SUCCESS;
+
+ error:
+        if (curl_handle) {
+                curl_easy_cleanup(curl_handle);
+        }
+        if (headers) {
+                curl_slist_free_all(headers);
+        }
+        if (slist) {
+                curl_slist_free_all(slist);
+        }
+        if (curl_xml_text != xml_text) {
+                switch_safe_free(curl_xml_text);
+        }
+        switch_safe_free(xml_text);
+        switch_safe_free(path);
+        switch_xml_free(cdr);
+
+        return status;
</ins><span class="cx"> }
</span><span class="cx">
</span><del>-static const switch_state_handler_table_t state_handlers = {
</del><ins>+static void event_handler(switch_event_t *event)
+{
+        const char *sig = switch_event_get_header(event, "Trapped-Signal");
+
+        if (sig && !strcmp(sig, "HUP")) {
+                if (globals.rotate) {
+                        set_xml_cdr_log_dirs();
+                }
+        }
+}
+
+static switch_state_handler_table_t state_handlers = {
</ins><span class="cx">         /*.on_init */ NULL,
</span><del>-        /*.on_ring */ NULL,
</del><ins>+        /*.on_routing */ NULL,
</ins><span class="cx">         /*.on_execute */ NULL,
</span><del>-        /*.on_hangup */ my_on_hangup,
-        /*.on_loopback */ NULL,
-        /*.on_transmit */ NULL
</del><ins>+        /*.on_hangup */ NULL,
+        /*.on_exchange_media */ NULL,
+        /*.on_soft_execute */ NULL,
+        /*.on_consume_media */ NULL,
+        /*.on_hibernate */ NULL,
+        /*.on_reset */ NULL,
+        /*.on_park */ NULL,
+        /*.on_reporting */ my_on_reporting
</ins><span class="cx"> };
</span><span class="cx">
</span><ins>+SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
+{
+        char *cf = "xml_cdr.conf";
+        switch_xml_t cfg, xml, settings, param;
+        switch_status_t status = SWITCH_STATUS_SUCCESS;
</ins><span class="cx">
</span><del>-static const switch_loadable_module_interface_t mod_xml_cdr_module_interface = {
-        /*.module_name = */ modname,
-        /*.endpoint_interface = */ NULL,
-        /*.timer_interface = */ NULL,
-        /*.dialplan_interface = */ NULL,
-        /*.codec_interface = */ NULL,
-        /*.application_interface */ NULL
-};
-
-SWITCH_MOD_DECLARE(switch_status_t) switch_module_load(const switch_loadable_module_interface_t **module_interface, char *filename)
-{
</del><span class="cx">         /* test global state handlers */
</span><span class="cx">         switch_core_add_state_handler(&state_handlers);
</span><span class="cx">
</span><del>-        *module_interface = &mod_xml_cdr_module_interface;
</del><ins>+        *module_interface = switch_loadable_module_create_module_interface(pool, modname);
</ins><span class="cx">
</span><del>-        /* indicate that the module should continue to be loaded */
</del><ins>+        if (switch_event_bind(modname, SWITCH_EVENT_TRAP, SWITCH_EVENT_SUBCLASS_ANY, event_handler, NULL) != SWITCH_STATUS_SUCCESS) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Couldn't bind!\n");
+                return SWITCH_STATUS_GENERR;
+        }
+
+        memset(&globals, 0, sizeof(globals));
+        globals.log_http_and_disk = 0;
+        globals.log_b = 1;
+        globals.disable100continue = 0;
+        globals.pool = pool;
+        globals.auth_scheme = CURLAUTH_BASIC;
+
+        switch_thread_rwlock_create(&globals.log_path_lock, pool);
+
+        /* parse the config */
+        if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Open of %s failed\n", cf);
+                return SWITCH_STATUS_TERM;
+        }
+
+        if ((settings = switch_xml_child(cfg, "settings"))) {
+                for (param = switch_xml_child(settings, "param"); param; param = param->next) {
+                        char *var = (char *) switch_xml_attr_soft(param, "name");
+                        char *val = (char *) switch_xml_attr_soft(param, "value");
+
+                        if (!strcasecmp(var, "cred") && !zstr(val)) {
+                                globals.cred = switch_core_strdup(globals.pool, val);
+                        } else if (!strcasecmp(var, "url") && !zstr(val)) {
+                                if (globals.url_count >= MAX_URLS) {
+                                        switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "maximum urls configured!\n");
+                                } else {
+                                        globals.urls[globals.url_count++] = switch_core_strdup(globals.pool, val);
+                                }
+                        } else if (!strcasecmp(var, "log-http-and-disk")) {
+                                globals.log_http_and_disk = switch_true(val);
+                        } else if (!strcasecmp(var, "delay") && !zstr(val)) {
+                                globals.delay = (uint32_t) atoi(val);
+                        } else if (!strcasecmp(var, "log-b-leg")) {
+                                globals.log_b = switch_true(val);
+                        } else if (!strcasecmp(var, "prefix-a-leg")) {
+                                globals.prefix_a = switch_true(val);
+                        } else if (!strcasecmp(var, "disable-100-continue") && switch_true(val)) {
+                                globals.disable100continue = 1;
+                        } else if (!strcasecmp(var, "encode") && !zstr(val)) {
+                                if (!strcasecmp(val, "base64")) {
+                                        globals.encode = ENCODING_BASE64;
+                                } else if (!strcasecmp(val, "textxml")) {
+                                        globals.encode = ENCODING_TEXTXML;
+                                } else {
+                                        globals.encode = switch_true(val) ? ENCODING_DEFAULT : ENCODING_NONE;
+                                }
+                        } else if (!strcasecmp(var, "retries") && !zstr(val)) {
+                                globals.retries = (uint32_t) atoi(val);
+                        } else if (!strcasecmp(var, "rotate") && !zstr(val)) {
+                                globals.rotate = switch_true(val);
+                        } else if (!strcasecmp(var, "log-dir")) {
+                                if (zstr(val)) {
+                                        globals.base_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
+                                } else {
+                                        if (switch_is_file_path(val)) {
+                                                globals.base_log_dir = switch_core_strdup(globals.pool, val);
+                                        } else {
+                                                globals.base_log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
+                                        }
+                                }
+                        } else if (!strcasecmp(var, "err-log-dir")) {
+                                if (zstr(val)) {
+                                        globals.base_err_log_dir = switch_mprintf("%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
+                                } else {
+                                        if (switch_is_file_path(val)) {
+                                                globals.base_err_log_dir = switch_core_strdup(globals.pool, val);
+                                        } else {
+                                                globals.base_err_log_dir = switch_mprintf("%s%s%s", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR, val);
+                                        }
+                                }
+                        } else if (!strcasecmp(var, "enable-cacert-check") && switch_true(val)) {
+                                globals.enable_cacert_check = 1;
+                        } else if (!strcasecmp(var, "ssl-cert-path")) {
+                                globals.ssl_cert_file = val;
+                        } else if (!strcasecmp(var, "ssl-key-path")) {
+                                globals.ssl_key_file = val;
+                        } else if (!strcasecmp(var, "ssl-key-password")) {
+                                globals.ssl_key_password = val;
+                        } else if (!strcasecmp(var, "ssl-version")) {
+                                globals.ssl_version = val;
+                        } else if (!strcasecmp(var, "ssl-cacert-file")) {
+                                globals.ssl_cacert_file = val;
+                        } else if (!strcasecmp(var, "enable-ssl-verifyhost") && switch_true(val)) {
+                                globals.enable_ssl_verifyhost = 1;
+                        } else if (!strcasecmp(var, "auth-scheme")) {
+                                if (*val == '=') {
+                                        globals.auth_scheme = 0;
+                                        val++;
+                                }
+
+                                if (!strcasecmp(val, "basic")) {
+                                        globals.auth_scheme |= CURLAUTH_BASIC;
+                                } else if (!strcasecmp(val, "digest")) {
+                                        globals.auth_scheme |= CURLAUTH_DIGEST;
+                                } else if (!strcasecmp(val, "NTLM")) {
+                                        globals.auth_scheme |= CURLAUTH_NTLM;
+                                } else if (!strcasecmp(val, "GSS-NEGOTIATE")) {
+                                        globals.auth_scheme |= CURLAUTH_GSSNEGOTIATE;
+                                } else if (!strcasecmp(val, "any")) {
+                                        globals.auth_scheme = CURLAUTH_ANY;
+                                }
+                        }
+
+                        if (zstr(globals.base_err_log_dir)) {
+                                if (!zstr(globals.base_log_dir)) {
+                                        globals.base_err_log_dir = switch_core_strdup(globals.pool, globals.base_log_dir);
+                                } else {
+                                        globals.base_err_log_dir = switch_core_sprintf(globals.pool, "%s%sxml_cdr", SWITCH_GLOBAL_dirs.log_dir, SWITCH_PATH_SEPARATOR);
+                                }
+                        }
+                }
+        }
+        if (globals.retries < 0) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Retries is negative, setting to 0\n");
+                globals.retries = 0;
+        }
+
+        if (globals.retries && globals.delay <= 0) {
+                switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Retries set but delay 0 setting to 5000ms\n");
+                globals.delay = 5000;
+        }
+
+        globals.retries++;
+
+        set_xml_cdr_log_dirs();
+
+        switch_xml_free(xml);
+        return status;
+}
+
+SWITCH_MODULE_SHUTDOWN_FUNCTION(mod_xml_cdr_shutdown)
+{
+
+        globals.shutdown = 1;
+
+        switch_core_remove_state_handler(&state_handlers);
</ins><span class="cx">         return SWITCH_STATUS_SUCCESS;
</span><span class="cx"> }
</span><span class="cx">
</span><span class="lines">@@ -119,5 +612,5 @@
</span><span class="cx"> * c-basic-offset:4
</span><span class="cx"> * End:
</span><span class="cx"> * For VIM:
</span><del>- * vim:set softtabstop=4 shiftwidth=4 tabstop=4 expandtab:
</del><ins>+ * vim:set softtabstop=4 shiftwidth=4 tabstop=4:
</ins><span class="cx"> */
</span><span class="cx">Property changes on: freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + native
</span></span></pre></div>
<a id="freeswitchbranchescseketsrcmodxml_intmod_xml_cdrmod_xml_cdrvcproj"></a>
<div class="modfile"><h4>Modified: freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.vcproj (16685 => 16686)</h4>
<pre class="diff"><span>
<span class="info">--- freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.vcproj        2010-02-18 11:03:12 UTC (rev 16685)
+++ freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.vcproj        2010-02-18 15:45:04 UTC (rev 16686)
</span><span class="lines">@@ -17,193 +17,43 @@
</span><span class="cx">         <Configurations>
</span><span class="cx">                 <Configuration
</span><span class="cx">                         Name="Debug|Win32"
</span><del>-                        OutputDirectory="$(ConfigurationName)"
-                        IntermediateDirectory="$(ConfigurationName)"
</del><span class="cx">                         ConfigurationType="2"
</span><del>-                        InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
</del><ins>+                        InheritedPropertySheets="..\..\..\..\w32\module_debug.vsprops;..\..\..\..\w32\curl.vsprops"
</ins><span class="cx">                         CharacterSet="2"
</span><span class="cx">                         >
</span><span class="cx">                         <Tool
</span><del>-                                Name="VCPreBuildEventTool"
-                        />
-                        <Tool
-                                Name="VCCustomBuildTool"
-                        />
-                        <Tool
-                                Name="VCXMLDataGeneratorTool"
-                        />
-                        <Tool
-                                Name="VCWebServiceProxyGeneratorTool"
-                        />
-                        <Tool
-                                Name="VCMIDLTool"
-                        />
-                        <Tool
</del><span class="cx">                                 Name="VCCLCompilerTool"
</span><del>-                                Optimization="0"
-                                AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;"
-                                PreprocessorDefinitions="WIN32;_DEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
-                                MinimalRebuild="true"
-                                BasicRuntimeChecks="3"
-                                RuntimeLibrary="3"
</del><ins>+                                AdditionalIncludeDirectories=""
</ins><span class="cx">                                 UsePrecompiledHeader="0"
</span><del>-                                WarningLevel="4"
-                                WarnAsError="true"
-                                Detect64BitPortabilityProblems="true"
-                                DebugInformationFormat="3"
</del><span class="cx">                         />
</span><span class="cx">                         <Tool
</span><del>-                                Name="VCManagedResourceCompilerTool"
-                        />
-                        <Tool
-                                Name="VCResourceCompilerTool"
-                        />
-                        <Tool
-                                Name="VCPreLinkEventTool"
-                        />
-                        <Tool
</del><span class="cx">                                 Name="VCLinkerTool"
</span><del>-                                OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
-                                LinkIncremental="1"
-                                AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
-                                GenerateDebugInformation="true"
-                                ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
-                                SubSystem="2"
-                                ImportLibrary="$(OutDir)/mod_xml_cdr.lib"
-                                TargetMachine="1"
</del><span class="cx">                         />
</span><del>-                        <Tool
-                                Name="VCALinkTool"
-                        />
-                        <Tool
-                                Name="VCManifestTool"
-                        />
-                        <Tool
-                                Name="VCXDCMakeTool"
-                        />
-                        <Tool
-                                Name="VCBscMakeTool"
-                        />
-                        <Tool
-                                Name="VCFxCopTool"
-                        />
-                        <Tool
-                                Name="VCAppVerifierTool"
-                        />
-                        <Tool
-                                Name="VCWebDeploymentTool"
-                        />
-                        <Tool
-                                Name="VCPostBuildEventTool"
-                        />
</del><span class="cx">                 </Configuration>
</span><span class="cx">                 <Configuration
</span><span class="cx">                         Name="Release|Win32"
</span><del>-                        OutputDirectory="$(ConfigurationName)"
-                        IntermediateDirectory="$(ConfigurationName)"
</del><span class="cx">                         ConfigurationType="2"
</span><del>-                        InheritedPropertySheets="$(VCInstallDir)VCProjectDefaults\UpgradeFromVC71.vsprops"
</del><ins>+                        InheritedPropertySheets="..\..\..\..\w32\module_release.vsprops;..\..\..\..\w32\curl.vsprops"
</ins><span class="cx">                         CharacterSet="2"
</span><span class="cx">                         >
</span><span class="cx">                         <Tool
</span><del>-                                Name="VCPreBuildEventTool"
-                        />
-                        <Tool
-                                Name="VCCustomBuildTool"
-                        />
-                        <Tool
-                                Name="VCXMLDataGeneratorTool"
-                        />
-                        <Tool
-                                Name="VCWebServiceProxyGeneratorTool"
-                        />
-                        <Tool
-                                Name="VCMIDLTool"
-                        />
-                        <Tool
</del><span class="cx">                                 Name="VCCLCompilerTool"
</span><del>-                                AdditionalIncludeDirectories="&quot;$(InputDir)..\..\..\include&quot;;&quot;$(InputDir)include&quot;;&quot;$(InputDir)..\..\..\..\libs\include&quot;"
-                                PreprocessorDefinitions="WIN32;NDEBUG;_WINDOWS;_USRDLL;MOD_EXPORTS"
-                                RuntimeLibrary="2"
</del><ins>+                                AdditionalIncludeDirectories=""
</ins><span class="cx">                                 UsePrecompiledHeader="0"
</span><del>-                                WarningLevel="4"
-                                WarnAsError="true"
-                                Detect64BitPortabilityProblems="true"
-                                DebugInformationFormat="3"
</del><span class="cx">                         />
</span><span class="cx">                         <Tool
</span><del>-                                Name="VCManagedResourceCompilerTool"
-                        />
-                        <Tool
-                                Name="VCResourceCompilerTool"
-                        />
-                        <Tool
-                                Name="VCPreLinkEventTool"
-                        />
-                        <Tool
</del><span class="cx">                                 Name="VCLinkerTool"
</span><del>-                                OutputFile="$(SolutionDir)$(OutDir)/mod/$(InputName).dll"
-                                LinkIncremental="1"
-                                AdditionalLibraryDirectories="..\..\..\..\w32\vsnet\$(OutDir)"
-                                GenerateDebugInformation="true"
-                                ProgramDatabaseFile="$(OutDir)$(TargetName).pdb"
-                                SubSystem="2"
-                                OptimizeReferences="2"
-                                EnableCOMDATFolding="2"
-                                ImportLibrary="$(OutDir)/mod_xml_cdr.lib"
-                                TargetMachine="1"
</del><ins>+                                AdditionalLibraryDirectories=""
</ins><span class="cx">                         />
</span><del>-                        <Tool
-                                Name="VCALinkTool"
-                        />
-                        <Tool
-                                Name="VCManifestTool"
-                        />
-                        <Tool
-                                Name="VCXDCMakeTool"
-                        />
-                        <Tool
-                                Name="VCBscMakeTool"
-                        />
-                        <Tool
-                                Name="VCFxCopTool"
-                        />
-                        <Tool
-                                Name="VCAppVerifierTool"
-                        />
-                        <Tool
-                                Name="VCWebDeploymentTool"
-                        />
-                        <Tool
-                                Name="VCPostBuildEventTool"
-                        />
</del><span class="cx">                 </Configuration>
</span><span class="cx">         </Configurations>
</span><span class="cx">         <References>
</span><span class="cx">         </References>
</span><span class="cx">         <Files>
</span><del>-                <Filter
-                        Name="Source Files"
-                        Filter="cpp;c;cxx;def;odl;idl;hpj;bat;asm;asmx"
-                        UniqueIdentifier="{4FC737F1-C7A5-4376-A066-2A32D752A2FF}"
</del><ins>+                <File
+                        RelativePath=".\mod_xml_cdr.c"
</ins><span class="cx">                         >
</span><del>-                        <File
-                                RelativePath=".\mod_xml_cdr.c"
-                                >
-                        </File>
-                </Filter>
-                <Filter
-                        Name="Header Files"
-                        Filter="h;hpp;hxx;hm;inl;inc;xsd"
-                        UniqueIdentifier="{93995380-89BD-4b04-88EB-625FBE52EBFB}"
-                        >
-                </Filter>
-                <Filter
-                        Name="Resource Files"
-                        Filter="rc;ico;cur;bmp;dlg;rc2;rct;bin;rgs;gif;jpg;jpeg;jpe;resx"
-                        UniqueIdentifier="{67DA6AB6-F800-4c08-8B7A-83BB121AAD01}"
-                        >
-                </Filter>
</del><ins>+                </File>
</ins><span class="cx">         </Files>
</span><span class="cx">         <Globals>
</span><span class="cx">         </Globals>
</span><span class="cx">Property changes on: freeswitch/branches/cseket/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.vcproj
</span><span class="cx">___________________________________________________________________
</span><span class="cx">Name: svn:eol-style
</span><span class="cx"> + CRLF
</span></span></pre>
</div>
</div>
<div id="footer">See you at ClueCon</div>
</body>
</html>