MT#56465 Improve "this" side lookup by subs

During the monologues lookup in
`call_get_dialogue()`,

instead of relying on the very first available
other side subscription, when doing a lookup
of this side, try to look into all of them
to find available media with existing subs.

Change-Id: If232cd25f26a2bc56eb1f401ba5c2c8a13e3e463
pull/1880/head
Donat Zenichev 1 year ago
parent 4e6b40a9fc
commit 4f48d31444

@ -4747,13 +4747,21 @@ static int call_get_dialogue(struct call_monologue *monologues[2], call_t *call,
*/
if (viabranch)
ft = t_hash_table_lookup(call->viabranches, viabranch);
/* top most subscription of tt */
/* first possible subscription of tt (other side) */
if (!ft) {
struct call_media *media = tt->medias->len ? tt->medias->pdata[0] : NULL;
if (media && media->media_subscriptions.head) {
/* find by any other's side subscriptions (expected one-monologue to one-monologue talk) */
for (int i = 0; i < tt->medias->len; i++)
{
struct call_media *media = tt->medias->pdata[i];
if (!media || !media->media_subscriptions.head)
continue;
struct media_subscription * ms = media->media_subscriptions.head->data;
if (ms->monologue)
if (ms->monologue) {
ft = ms->monologue;
__C_DBG("Found existing monologue '" STR_FORMAT "' for this side, by lookup of other side subscriptions",
STR_FMT(&ft->tag));
break;
}
}
}
/* otherwise create a brand-new one.

Loading…
Cancel
Save