optionally log b leg (note default config changes previous behavior, but old configs without the entry will continue to log the b leg) (MODEVENT-9)

git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6986 d0543943-73ff-0310-b7d9-9358b9ac24b2
This commit is contained in:
Michael Jerris 2007-12-26 21:01:59 +00:00
parent 371a80e76a
commit 1cd7e6c5cc
2 changed files with 13 additions and 0 deletions

View File

@ -15,7 +15,12 @@
<!-- optional: if not present we do not log every record to disk -->
<!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank value will default to ${prefix}/logs/xml_cdr -->
<param name="log-dir" value=""/>
<!-- optional: if not present we do log the b leg -->
<!-- true or false if we should create a cdr for the b leg of a call-->
<param name="log-b-leg" value="false"/>
<!-- encode the post data may be 'true' for url encoding, 'false' for no encoding or 'base64' for base64 encoding -->
<param name="encode" value="true"/>

View File

@ -44,6 +44,7 @@ static struct {
uint32_t shutdown;
uint32_t ignore_cacert_check;
int encode;
int log_b;
} globals;
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load);
@ -74,6 +75,10 @@ static switch_status_t my_on_hangup(switch_core_session_t *session)
switch_channel_t *channel = switch_core_session_get_channel(session);
switch_status_t status = SWITCH_STATUS_FALSE;
if (!globals.log_b && channel && switch_channel_get_originator_caller_profile(channel)) {
return SWITCH_STATUS_SUCCESS;
}
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;
@ -242,6 +247,7 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
memset(&globals,0,sizeof(globals));
globals.log_b = 1;
/* parse the config */
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
@ -260,6 +266,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
globals.url = strdup(val);
} else if (!strcasecmp(var, "delay")) {
globals.delay = (uint32_t) atoi(val);
} else if (!strcasecmp(var, "log-b-leg")) {
globals.log_b = switch_true(val);
} else if (!strcasecmp(var, "encode")) {
if (!strcasecmp(val, "base64")) {
globals.encode = 2;