[mod_json_cdr] add timeout param.
This commit is contained in:
parent
6113db7bd7
commit
d249fb8017
|
@ -23,6 +23,8 @@
|
|||
<!-- HTTP(S) logging -->
|
||||
<!-- URL where to POST JSON CDRs. Leave empty for no URL logging. Up to 20 URLs may be specified. -->
|
||||
<param name="url" value=""/>
|
||||
<!-- optional timeout : second -->
|
||||
<param name="timeout" value="5"/>
|
||||
<!-- Authentication scheme for the above URL. May be one of basic|digest|NTLM|GSS-NEGOTIATE|any-->
|
||||
<param name="auth-scheme" value="basic"/>
|
||||
<!-- Credentials in the form username:password if auth-scheme is used. Leave empty for no authentication. -->
|
||||
|
|
|
@ -70,6 +70,7 @@ static struct {
|
|||
int disable100continue;
|
||||
int rotate;
|
||||
long auth_scheme;
|
||||
int timeout;
|
||||
switch_memory_pool_t *pool;
|
||||
switch_event_node_t *node;
|
||||
int encode_values;
|
||||
|
@ -361,8 +362,10 @@ static void process_cdr(cdr_data_t *data)
|
|||
switch_curl_easy_setopt(curl_handle, CURLOPT_CAINFO, globals.ssl_cacert_file);
|
||||
}
|
||||
|
||||
// tcp timeout
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, globals.timeout);
|
||||
|
||||
/* these were used for testing, optionally they may be enabled if someone desires
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_TIMEOUT, 120); // tcp timeout
|
||||
switch_curl_easy_setopt(curl_handle, CURLOPT_FOLLOWLOCATION, 1); // 302 recursion level
|
||||
*/
|
||||
|
||||
|
@ -607,6 +610,14 @@ SWITCH_MODULE_LOAD_FUNCTION(mod_json_cdr_load)
|
|||
globals.log_http_and_disk = switch_true(val);
|
||||
} else if (!strcasecmp(var, "log-errors-to-disk")) {
|
||||
globals.log_errors_to_disk = !switch_false(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")) {
|
||||
|
|
Loading…
Reference in New Issue