diff --git a/daemon/call.c b/daemon/call.c index d87affbdd..776f6a0f8 100644 --- a/daemon/call.c +++ b/daemon/call.c @@ -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.