diff --git a/src/mod/event_handlers/mod_json_cdr/conf/autoload_configs/json_cdr.conf.xml b/src/mod/event_handlers/mod_json_cdr/conf/autoload_configs/json_cdr.conf.xml index af30c67c07..68a8104222 100644 --- a/src/mod/event_handlers/mod_json_cdr/conf/autoload_configs/json_cdr.conf.xml +++ b/src/mod/event_handlers/mod_json_cdr/conf/autoload_configs/json_cdr.conf.xml @@ -25,6 +25,10 @@ + + + + diff --git a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c index 7f66aa425a..2d9fc36b11 100644 --- a/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c +++ b/src/mod/event_handlers/mod_json_cdr/mod_json_cdr.c @@ -61,6 +61,7 @@ static struct { char *ssl_key_password; char *ssl_version; char *ssl_cacert_file; + char *unix_socket_path; uint32_t enable_ssl_verifyhost; int encode; int log_http_and_disk; @@ -365,6 +366,10 @@ static void process_cdr(cdr_data_t *data) // tcp timeout switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, globals.timeout); + if (!zstr(globals.unix_socket_path)) { + switch_curl_easy_setopt(curl_handle, CURLOPT_UNIX_SOCKET_PATH, globals.unix_socket_path); + } + /* these were used for testing, optionally they may be enabled if someone desires switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level */ @@ -674,6 +679,8 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load) globals.ssl_version = switch_core_strdup(globals.pool, val); } else if (!strcasecmp(var, "ssl-cacert-file")) { globals.ssl_cacert_file = switch_core_strdup(globals.pool, val); + } else if (!strcasecmp(var, "unix-socket-path")) { + globals.unix_socket_path = switch_core_strdup(globals.pool, val); } else if (!strcasecmp(var, "enable-ssl-verifyhost") && switch_true(val)) { globals.enable_ssl_verifyhost = 1; } else if (!strcasecmp(var, "auth-scheme")) { diff --git a/src/mod/xml_int/mod_xml_curl/conf/autoload_configs/xml_curl.conf.xml b/src/mod/xml_int/mod_xml_curl/conf/autoload_configs/xml_curl.conf.xml index 8efee1f9f8..b3fea5884c 100644 --- a/src/mod/xml_int/mod_xml_curl/conf/autoload_configs/xml_curl.conf.xml +++ b/src/mod/xml_int/mod_xml_curl/conf/autoload_configs/xml_curl.conf.xml @@ -12,6 +12,9 @@ + + + diff --git a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c index 5a2e201a72..e264e0ecdb 100644 --- a/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c +++ b/src/mod/xml_int/mod_xml_curl/mod_xml_curl.c @@ -53,6 +53,7 @@ struct xml_binding { char *ssl_key_password; char *ssl_version; char *ssl_cacert_file; + char *unix_socket_path; uint32_t enable_ssl_verifyhost; char *cookie_file; switch_hash_t *vars_map; @@ -281,6 +282,10 @@ static switch_xml_t xml_url_fetch(const char *section, const char *tag_name, con switch_curl_easy_setopt(curl_handle, CURLOPT_SSL_VERIFYHOST, 2); } + if (binding->unix_socket_path) { + switch_curl_easy_setopt(curl_handle, CURLOPT_UNIX_SOCKET_PATH, binding->unix_socket_path); + } + if (binding->cookie_file) { switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEJAR, binding->cookie_file); switch_curl_easy_setopt(curl_handle, CURLOPT_COOKIEFILE, binding->cookie_file); @@ -372,6 +377,7 @@ static switch_status_t do_config(void) char *ssl_key_password = NULL; char *ssl_version = NULL; char *ssl_cacert_file = NULL; + char *unix_socket_path = NULL; uint32_t enable_ssl_verifyhost = 0; char *cookie_file = NULL; hash_node_t *hash_node; @@ -437,6 +443,8 @@ static switch_status_t do_config(void) cookie_file = val; } else if (!strcasecmp(var, "use-dynamic-url") && switch_true(val)) { use_dynamic_url = 1; + } else if (!strcasecmp(var, "unix-socket-path")) { + unix_socket_path = val; } else if (!strcasecmp(var, "enable-post-var")) { if (!vars_map && need_vars_map == 0) { if (switch_core_hash_init(&vars_map) != SWITCH_STATUS_SUCCESS) { @@ -530,6 +538,10 @@ static switch_status_t do_config(void) binding->cookie_file = switch_core_strdup(globals.pool, cookie_file); } + if (unix_socket_path) { + binding->unix_socket_path = switch_core_strdup(globals.pool, unix_socket_path); + } + binding->vars_map = vars_map; if (vars_map) {