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:
parent
371a80e76a
commit
1cd7e6c5cc
|
@ -16,6 +16,11 @@
|
||||||
<!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank value will default to ${prefix}/logs/xml_cdr -->
|
<!-- 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=""/>
|
<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 -->
|
<!-- encode the post data may be 'true' for url encoding, 'false' for no encoding or 'base64' for base64 encoding -->
|
||||||
<param name="encode" value="true"/>
|
<param name="encode" value="true"/>
|
||||||
|
|
||||||
|
|
|
@ -44,6 +44,7 @@ static struct {
|
||||||
uint32_t shutdown;
|
uint32_t shutdown;
|
||||||
uint32_t ignore_cacert_check;
|
uint32_t ignore_cacert_check;
|
||||||
int encode;
|
int encode;
|
||||||
|
int log_b;
|
||||||
} globals;
|
} globals;
|
||||||
|
|
||||||
SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load);
|
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_channel_t *channel = switch_core_session_get_channel(session);
|
||||||
switch_status_t status = SWITCH_STATUS_FALSE;
|
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) {
|
if (switch_ivr_generate_xml_cdr(session, &cdr) != SWITCH_STATUS_SUCCESS) {
|
||||||
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
|
switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Error Generating Data!\n");
|
||||||
return SWITCH_STATUS_FALSE;
|
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);
|
*module_interface = switch_loadable_module_create_module_interface(pool, modname);
|
||||||
|
|
||||||
memset(&globals,0,sizeof(globals));
|
memset(&globals,0,sizeof(globals));
|
||||||
|
globals.log_b = 1;
|
||||||
|
|
||||||
/* parse the config */
|
/* parse the config */
|
||||||
if (!(xml = switch_xml_open_cfg(cf, &cfg, NULL))) {
|
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);
|
globals.url = strdup(val);
|
||||||
} else if (!strcasecmp(var, "delay")) {
|
} else if (!strcasecmp(var, "delay")) {
|
||||||
globals.delay = (uint32_t) atoi(val);
|
globals.delay = (uint32_t) atoi(val);
|
||||||
|
} else if (!strcasecmp(var, "log-b-leg")) {
|
||||||
|
globals.log_b = switch_true(val);
|
||||||
} else if (!strcasecmp(var, "encode")) {
|
} else if (!strcasecmp(var, "encode")) {
|
||||||
if (!strcasecmp(val, "base64")) {
|
if (!strcasecmp(val, "base64")) {
|
||||||
globals.encode = 2;
|
globals.encode = 2;
|
||||||
|
|
Loading…
Reference in New Issue