MT#57550 Create a new from-monologue, if still not matched

Rework the logic of fromtag monologue detection in the
`call_get_dialogue()`.

Fristly, try to match using given from tag (if there is one).
Secondly, try to match using given viabranch.
Thirdly, try to use top-most subscription of the top-most
     media related to the totag monologue (newer behavior).
Fourthly, if still not found just create a brand-new one.

This change relates to the fact, that we stop using call monologue
subscriptions model and switch to the media based one.

Change-Id: I106bdd79f5e4754f76bd048f51c8fc211ee57410
pull/1752/head
Donat Zenichev 3 years ago
parent 9ad2d9d03e
commit a3faa563ee

@ -4773,19 +4773,29 @@ static int call_get_dialogue(struct call_monologue *monologues[2], struct call *
} }
/* it seems ft hasn't seen tt before */ /* it seems ft hasn't seen tt before */
goto tag_setup; goto tag_setup;
/* try to determine the monologue from the viabranch,
* or using the top most tt's subscription, if there is one.
* Otherwise just create a brand-new one.
*/
} else { } else {
/* perhaps we can determine the monologue from the viabranch */ /* viabranch */
if (viabranch) if (viabranch)
ft = g_hash_table_lookup(call->viabranches, viabranch); ft = g_hash_table_lookup(call->viabranches, viabranch);
} /* top most subscription of tt */
if (!ft) {
if (!ft) { struct call_media *media = tt->medias->pdata[0];
/* if we don't have a fromtag monologue yet, we can use a half-complete dialogue if (media && media->media_subscriptions.head) {
* from the totag if there is one. otherwise we have to create a new one. */ struct media_subscription * ms = media->media_subscriptions.head->data;
if (tt->subscriptions.head) { if (ms->monologue)
struct call_subscription *cs = tt->subscriptions.head->data; ft = ms->monologue;
ft = cs->monologue; }
} }
/* otherwise create a brand-new one.
* The lookup of the offer monologue from the answer monologue is only valid,
* if the offer monologue belongs to an unanswered call (empty tag),
* hence `ft->tag` has to be empty at this stage.
*/
if (!ft || ft->tag.s) if (!ft || ft->tag.s)
ft = __monologue_create(call); ft = __monologue_create(call);
} }

Loading…
Cancel
Save