]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
optionally log b leg (note default config changes previous behavior, but old configs...
authorMichael Jerris <mike@jerris.com>
Wed, 26 Dec 2007 21:01:59 +0000 (21:01 +0000)
committerMichael Jerris <mike@jerris.com>
Wed, 26 Dec 2007 21:01:59 +0000 (21:01 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@6986 d0543943-73ff-0310-b7d9-9358b9ac24b2

conf/autoload_configs/xml_cdr.conf.xml
src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c

index 60cc674222b09b4986321221caf5ac5b184dadbf..70145b501fef00ff079d6a8619ebdf302c28efa9 100644 (file)
     <!-- optional: if not present we do not log every record to disk -->\r
     <!-- either an absolute path, a relative path assuming ${prefix}/logs or a blank value will default to ${prefix}/logs/xml_cdr -->\r
     <param name="log-dir" value=""/>\r
+\r
+    <!-- optional: if not present we do log the b leg -->\r
+    <!-- true or false if we should create a cdr for the b leg of a call-->\r
+    <param name="log-b-leg" value="false"/>\r
     \r
+\r
     <!-- encode the post data may be 'true' for url encoding, 'false' for no encoding or 'base64' for base64 encoding -->\r
     <param name="encode" value="true"/>\r
     \r
index b5758d00bf13f6158e52be985999bd6ae30855a3..db9ae34d37e2a7eedfa0b7e63ef45a97b36df385 100644 (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;