|
|
@ -57,7 +57,6 @@ struct iterator_helper { |
|
|
}; |
|
|
}; |
|
|
struct xmlrpc_helper { |
|
|
struct xmlrpc_helper { |
|
|
enum xmlrpc_format fmt; |
|
|
enum xmlrpc_format fmt; |
|
|
GStringChunk *c; |
|
|
|
|
|
GQueue strings; |
|
|
GQueue strings; |
|
|
}; |
|
|
}; |
|
|
|
|
|
|
|
|
@ -290,7 +289,7 @@ retry: |
|
|
pid = waitpid(pid, &status, 0); |
|
|
pid = waitpid(pid, &status, 0); |
|
|
if ((pid > 0 && WIFEXITED(status) && WEXITSTATUS(status) == 0) || i >= 3) { |
|
|
if ((pid > 0 && WIFEXITED(status) && WEXITSTATUS(status) == 0) || i >= 3) { |
|
|
for (int i = 0; i < els_per_ent; i++) |
|
|
for (int i = 0; i < els_per_ent; i++) |
|
|
g_queue_pop_head(&xh->strings); |
|
|
|
|
|
|
|
|
free(g_queue_pop_head(&xh->strings)); |
|
|
i = 0; |
|
|
i = 0; |
|
|
} |
|
|
} |
|
|
else { |
|
|
else { |
|
|
@ -356,7 +355,7 @@ retry: |
|
|
|
|
|
|
|
|
xmlrpc_client_destroy(c); |
|
|
xmlrpc_client_destroy(c); |
|
|
for (int i = 0; i < els_per_ent; i++) |
|
|
for (int i = 0; i < els_per_ent; i++) |
|
|
g_queue_pop_head(&xh->strings); |
|
|
|
|
|
|
|
|
free(g_queue_pop_head(&xh->strings)); |
|
|
xmlrpc_env_clean(&e); |
|
|
xmlrpc_env_clean(&e); |
|
|
|
|
|
|
|
|
_exit(0); |
|
|
_exit(0); |
|
|
@ -366,7 +365,6 @@ fault: |
|
|
_exit(1); |
|
|
_exit(1); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
g_string_chunk_free(xh->c); |
|
|
|
|
|
g_slice_free1(sizeof(*xh), xh); |
|
|
g_slice_free1(sizeof(*xh), xh); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
@ -374,7 +372,7 @@ void kill_calls_timer(GSList *list, const char *url) { |
|
|
struct call *ca; |
|
|
struct call *ca; |
|
|
GList *csl; |
|
|
GList *csl; |
|
|
struct call_monologue *cm, *cd; |
|
|
struct call_monologue *cm, *cd; |
|
|
const char *url_prefix, *url_suffix; |
|
|
|
|
|
|
|
|
char *url_prefix = NULL, *url_suffix = NULL; |
|
|
struct xmlrpc_helper *xh = NULL; |
|
|
struct xmlrpc_helper *xh = NULL; |
|
|
char url_buf[128]; |
|
|
char url_buf[128]; |
|
|
|
|
|
|
|
|
@ -384,15 +382,14 @@ void kill_calls_timer(GSList *list, const char *url) { |
|
|
/* if url is NULL, it's the scheduled deletions, otherwise it's the timeouts */ |
|
|
/* if url is NULL, it's the scheduled deletions, otherwise it's the timeouts */ |
|
|
if (url) { |
|
|
if (url) { |
|
|
xh = g_slice_alloc(sizeof(*xh)); |
|
|
xh = g_slice_alloc(sizeof(*xh)); |
|
|
xh->c = g_string_chunk_new(64); |
|
|
|
|
|
url_prefix = NULL; |
|
|
url_prefix = NULL; |
|
|
url_suffix = strstr(url, "%%"); |
|
|
url_suffix = strstr(url, "%%"); |
|
|
if (url_suffix) { |
|
|
if (url_suffix) { |
|
|
url_prefix = g_string_chunk_insert_len(xh->c, url, url_suffix - url); |
|
|
|
|
|
url_suffix = g_string_chunk_insert(xh->c, url_suffix + 2); |
|
|
|
|
|
|
|
|
url_prefix = strndup(url, url_suffix - url); |
|
|
|
|
|
url_suffix = strdup(url_suffix + 2); |
|
|
} |
|
|
} |
|
|
else |
|
|
else |
|
|
url_suffix = g_string_chunk_insert(xh->c, url); |
|
|
|
|
|
|
|
|
url_suffix = strdup(url); |
|
|
g_queue_init(&xh->strings); |
|
|
g_queue_init(&xh->strings); |
|
|
xh->fmt = rtpe_config.fmt; |
|
|
xh->fmt = rtpe_config.fmt; |
|
|
} |
|
|
} |
|
|
@ -430,13 +427,13 @@ void kill_calls_timer(GSList *list, const char *url) { |
|
|
cm = csl->data; |
|
|
cm = csl->data; |
|
|
if (!cm->tag.s || !cm->tag.len) |
|
|
if (!cm->tag.s || !cm->tag.len) |
|
|
continue; |
|
|
continue; |
|
|
g_queue_push_tail(&xh->strings, g_string_chunk_insert(xh->c, url_buf)); |
|
|
|
|
|
g_queue_push_tail(&xh->strings, str_chunk_insert(xh->c, &cm->tag)); |
|
|
|
|
|
|
|
|
g_queue_push_tail(&xh->strings, strdup(url_buf)); |
|
|
|
|
|
g_queue_push_tail(&xh->strings, str_dup(&cm->tag)); |
|
|
} |
|
|
} |
|
|
break; |
|
|
break; |
|
|
case XF_CALLID: |
|
|
case XF_CALLID: |
|
|
g_queue_push_tail(&xh->strings, g_string_chunk_insert(xh->c, url_buf)); |
|
|
|
|
|
g_queue_push_tail(&xh->strings, str_chunk_insert(xh->c, &ca->callid)); |
|
|
|
|
|
|
|
|
g_queue_push_tail(&xh->strings, strdup(url_buf)); |
|
|
|
|
|
g_queue_push_tail(&xh->strings, str_dup(&ca->callid)); |
|
|
break; |
|
|
break; |
|
|
case XF_KAMAILIO: |
|
|
case XF_KAMAILIO: |
|
|
for (csl = ca->monologues.head; csl; csl = csl->next) { |
|
|
for (csl = ca->monologues.head; csl; csl = csl->next) { |
|
|
@ -449,13 +446,13 @@ void kill_calls_timer(GSList *list, const char *url) { |
|
|
if (from_tag && !str_cmp_str(from_tag, &cm->tag)) |
|
|
if (from_tag && !str_cmp_str(from_tag, &cm->tag)) |
|
|
continue; |
|
|
continue; |
|
|
|
|
|
|
|
|
from_tag = str_chunk_insert(xh->c, &cm->tag); |
|
|
|
|
|
str *to_tag = str_chunk_insert(xh->c, &cd->tag); |
|
|
|
|
|
|
|
|
from_tag = str_dup(&cm->tag); |
|
|
|
|
|
str *to_tag = str_dup(&cd->tag); |
|
|
|
|
|
|
|
|
g_queue_push_tail(&xh->strings, |
|
|
g_queue_push_tail(&xh->strings, |
|
|
g_string_chunk_insert(xh->c, url_buf)); |
|
|
|
|
|
|
|
|
strdup(url_buf)); |
|
|
g_queue_push_tail(&xh->strings, |
|
|
g_queue_push_tail(&xh->strings, |
|
|
str_chunk_insert(xh->c, &ca->callid)); |
|
|
|
|
|
|
|
|
str_dup(&ca->callid)); |
|
|
g_queue_push_tail(&xh->strings, from_tag); |
|
|
g_queue_push_tail(&xh->strings, from_tag); |
|
|
g_queue_push_tail(&xh->strings, to_tag); |
|
|
g_queue_push_tail(&xh->strings, to_tag); |
|
|
|
|
|
|
|
|
@ -479,6 +476,10 @@ destroy: |
|
|
if (xh) |
|
|
if (xh) |
|
|
thread_create_detach_prio(xmlrpc_kill_calls, xh, rtpe_config.idle_scheduling, |
|
|
thread_create_detach_prio(xmlrpc_kill_calls, xh, rtpe_config.idle_scheduling, |
|
|
rtpe_config.idle_priority, "XMLRPC callback"); |
|
|
rtpe_config.idle_priority, "XMLRPC callback"); |
|
|
|
|
|
if (url_prefix) |
|
|
|
|
|
free(url_prefix); |
|
|
|
|
|
if (url_suffix) |
|
|
|
|
|
free(url_suffix); |
|
|
} |
|
|
} |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|