]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
FS-7299: Implement cookie-file option for mod_xml_cdr.
authorArtur Zaprzała <zapartur@gmail.com>
Wed, 18 Feb 2015 14:53:19 +0000 (15:53 +0100)
committerArtur Zaprzała <zapartur@gmail.com>
Thu, 19 Feb 2015 08:03:53 +0000 (09:03 +0100)
conf/vanilla/autoload_configs/xml_cdr.conf.xml
src/mod/xml_int/mod_xml_cdr/mod_xml_cdr.c

index d4c4bea8d95dda76581b4fbd9e05f66d985ad977..bdb20e63e0caa608fe80e210ecc9fa479f596b0e 100644 (file)
@@ -66,6 +66,6 @@
     <!-- <param name="ssl-version" value="TLSv1"/> -->
 
     <!-- optional: enables cookies and stores them in the specified file. -->
-    <!-- <param name="cookie-file" value="/$${temp_dir}/cookie-mod_xml_curl.txt"/> -->
+    <!-- <param name="cookie-file" value="$${run_dir}/mod_xml_cdr-cookie.txt"/> -->
   </settings>
 </configuration>
index 56f4500b82a48c4d09810f7af289b962200604de..71f51d30ceedace3e38fd1a056ddb736b65c6a8d 100644 (file)
@@ -70,6 +70,7 @@ static struct {
        int timeout;
        switch_memory_pool_t *pool;
        switch_event_node_t *node;
+       char *cookie_file;
 } globals;
 
 SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load);
@@ -330,6 +331,11 @@ static switch_status_t my_on_reporting(switch_core_session_t *session)
                        switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file);
                }
                
+               if (globals.cookie_file) {
+                       switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, globals.cookie_file);
+                       switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, globals.cookie_file);
+               }
+
                switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, globals.timeout);
 
                /* these were used for testing, optionally they may be enabled if someone desires
@@ -582,6 +588,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_xml_cdr_load)
                                } else if (!strcasecmp(val, "any")) {
                                        globals.auth_scheme = (long)CURLAUTH_ANY;
                                }
+                       } else if (!strcasecmp(var, "cookie-file")) {
+                               globals.cookie_file = switch_core_strdup(globals.pool, val);
                        }
                }