]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
XML-26
authorBrian West <brian@freeswitch.org>
Sun, 2 May 2010 00:49:17 +0000 (19:49 -0500)
committerBrian West <brian@freeswitch.org>
Sun, 2 May 2010 00:49:17 +0000 (19:49 -0500)
src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c

index b8dc08ff3f48b287e56a014e15f918fc01e2e143..427c64dd0d199a985f7f6bb655450f7c5e63eb30 100644 (file)
@@ -67,6 +67,7 @@ static struct {
        int disable100continue;
        int rotate;
        int auth_scheme;
+       int timeout;
        switch_memory_pool_t *pool;
 } globals;
 
@@ -326,9 +327,10 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                if (globals.ssl_cacert_file) {
                        curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file);
                }
+               
+               curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, globals.timeout);
 
                /* these were used for testing, optionally they may be enabled if someone desires
-                  curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
                   curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
                 */
 
@@ -499,6 +501,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
                                }
                        } else if (!strcasecmp(var, "log-http-and-disk")) {
                                globals.log_http_and_disk = switch_true(val);
+                       } else if (!strcasecmp(var, "timeout")) {
+                               int tmp = atoi(val);
+                               if (tmp >= 0) {
+                                       globals.timeout = tmp;
+                               } else {
+                                       globals.timeout = 0;
+                                       switch_log_printf(SWITCH_CHANNEL_LOG, SWITCH_LOG_ERROR, "Can't set a negative timeout!\n");
+                               }
                        } else if (!strcasecmp(var, "delay") && !zstr(val)) {
                                globals.delay = (uint32_t) atoi(val);
                        } else if (!strcasecmp(var, "log-b-leg")) {