size_t size;
};
+
static void *myrealloc(void *ptr, size_t size)
{
/* There might be a realloc() out there that doesn't like reallocing
{
CURL *curl;
- curl_global_init(CURL_GLOBAL_ALL);
curl = curl_easy_init();
if (!curl) {
return -1;
}
+ curl_easy_setopt(curl, CURLOPT_NOSIGNAL, 1);
+ curl_easy_setopt(curl, CURLOPT_TIMEOUT, 180);
+ curl_easy_setopt(curl, CURLOPT_FRESH_CONNECT, 1);
+ curl_easy_setopt(curl, CURLOPT_FORBID_REUSE, 1);
curl_easy_setopt(curl, CURLOPT_URL, url);
curl_easy_setopt(curl, CURLOPT_WRITEFUNCTION, WriteMemoryCallback);
curl_easy_setopt(curl, CURLOPT_WRITEDATA, (void *)chunk);
u = ast_module_user_add(chan);
AST_STANDARD_APP_ARGS(args, info);
-
+
if (!curl_internal(&chunk, args.url, args.postdata)) {
if (chunk.memory) {
chunk.memory[chunk.size] = '\0';
res = ast_custom_function_unregister(&acf_curl);
ast_module_user_hangup_all();
+
+ curl_global_cleanup();
return res;
}
{
int res;
+ if (curl_global_init(CURL_GLOBAL_ALL)) {
+ ast_log(LOG_ERROR, "Unable to initialize the CURL library. Cannot load func_curl\n");
+ return AST_MODULE_LOAD_DECLINE;
+ }
+
res = ast_custom_function_register(&acf_curl);
return res;