[Freeswitch-svn] [commit] r10460 - in freeswitch/trunk: conf/autoload_configs src/mod/xml_int/mod_xml_cdr
FreeSWITCH SVN
anthm at freeswitch.org
Wed Nov 19 09:37:10 PST 2008
Author: anthm
Date: Wed Nov 19 12:37:10 2008
New Revision: 10460
Log:
close MDXMLINT-39
Modified:
freeswitch/trunk/conf/autoload_configs/xml_cdr.conf.xml
freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
Modified: freeswitch/trunk/conf/autoload_configs/xml_cdr.conf.xml
==============================================================================
--- freeswitch/trunk/conf/autoload_configs/xml_cdr.conf.xml (original)
+++ freeswitch/trunk/conf/autoload_configs/xml_cdr.conf.xml Wed Nov 19 12:37:10 2008
@@ -20,6 +20,9 @@
<!-- true or false if we should create a cdr for the b leg of a call-->
<param name="log-b-leg" value="false"/>
+ <!-- optional: if not present, all filenames are the uuid of the call -->
+ <!-- true or false if a leg files are prefixed "a_" -->
+ <param name="prefix-a-leg" value="true"/>
<!-- encode the post data may be 'true' for url encoding, 'false' for no encoding or 'base64' for base64 encoding -->
<param name="encode" value="true"/>
Modified: freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c
==============================================================================
--- freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c (original)
+++ freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Wed Nov 19 12:37:10 2008
@@ -45,6 +45,7 @@
uint32_t ignore_cacert_check;
int encode;
int log_b;
+ int prefix_a;
int disable100continue;
} globals;
@@ -77,14 +78,18 @@
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;
}
- if (!globals.log_b && channel && switch_channel_get_originator_caller_profile(channel)) {
+ 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");
@@ -103,7 +108,7 @@
}
if (!switch_strlen_zero(logdir)) {
- if ((path = switch_mprintf("%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)))) {
+ if ((path = switch_mprintf("%s%s%s%s.cdr.xml", logdir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
int wrote;
wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
@@ -203,7 +208,7 @@
/* 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");
- if ((path = switch_mprintf("%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, switch_core_session_get_uuid(session)))) {
+ if ((path = switch_mprintf("%s%s%s%s.cdr.xml", globals.err_log_dir, SWITCH_PATH_SEPARATOR, a_prefix, switch_core_session_get_uuid(session)))) {
if ((fd = open(path, O_WRONLY | O_CREAT | O_TRUNC, S_IRUSR | S_IWUSR)) > -1) {
int wrote;
wrote = write(fd, xml_text, (unsigned) strlen(xml_text));
@@ -285,6 +290,8 @@
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") && !switch_strlen_zero(val)) {
More information about the Freeswitch-svn
mailing list