From 783b2a1b4c26c7ef0f8842df65a84dd9f45c7b5e Mon Sep 17 00:00:00 2001 From: Donat Zenichev Date: Thu, 9 Nov 2023 18:22:43 +0100 Subject: [PATCH] MT#57550 Use media subs in the `kill_calls_timer()` Use media subscriptions model in the `kill_calls_timer()` to find subscribers and related monologues in order the to update the `xmlrpc_helper` data. Change-Id: I4e7e8586a701eeb135c34138ba5a9dc288817c8d --- daemon/call.c | 40 +++++++++++++++++++++++----------------- 1 file changed, 23 insertions(+), 17 deletions(-) diff --git a/daemon/call.c b/daemon/call.c index 631f18cb9..3454a46ea 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -448,28 +448,34 @@ void kill_calls_timer(GSList *list, const char *url) { if (!cm->tag.s || !cm->tag.len) continue; - for (GList *sub = cm->subscribers.head; sub; sub = sub->next) { - struct call_subscription *cs = sub->data; - struct call_monologue *cd = cs->monologue; - - if (!cd->tag.s || !cd->tag.len) + for (unsigned int i = 0; i < cm->medias->len; i++) + { + struct call_media *media = cm->medias->pdata[i]; + if (!media) continue; - str *from_tag = g_hash_table_lookup(dup_tags, &cd->tag); - if (from_tag && !str_cmp_str(from_tag, &cm->tag)) - continue; + for (GList *l = media->media_subscribers.head; l; l = l->next) + { + struct media_subscription * ms = l->data; + struct call_monologue * sub_ml = ms->monologue; - from_tag = str_dup(&cm->tag); - str *to_tag = str_dup(&cd->tag); + if (!sub_ml->tag.s || !sub_ml->tag.len) + continue; - g_queue_push_tail(&xh->strings, - strdup(url_buf)); - g_queue_push_tail(&xh->strings, - str_dup(&ca->callid)); - g_queue_push_tail(&xh->strings, from_tag); - g_queue_push_tail(&xh->strings, to_tag); + str *from_tag = g_hash_table_lookup(dup_tags, &sub_ml->tag); + if (from_tag && !str_cmp_str(from_tag, &cm->tag)) + continue; - g_hash_table_insert(dup_tags, from_tag, to_tag); + from_tag = str_dup(&cm->tag); + str *to_tag = str_dup(&sub_ml->tag); + + g_queue_push_tail(&xh->strings, strdup(url_buf)); + g_queue_push_tail(&xh->strings, str_dup(&ca->callid)); + g_queue_push_tail(&xh->strings, from_tag); + g_queue_push_tail(&xh->strings, to_tag); + + g_hash_table_insert(dup_tags, from_tag, to_tag); + } } } break;