Author: mikej Date: Wed Dec 26 16:01:59 2007 New Revision: 6986 Modified: freeswitch/trunk/conf/autoload_configs/xml_cdr.conf.xml freeswitch/trunk/src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c Log: 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) 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 Dec 26 16:01:59 2007 @@ -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"/> 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 Dec 26 16:01:59 2007 @@ -44,6 +44,7 @@ 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 @@ 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 @@ *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 @@ 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;