TT#71050 fix branch deletion from via-branch

Untagged branches (only known by via-branch) don't appear in the `tags`
hash and don't have any `other_tags`. The logic to determine whether the
call is completely finished therefore must take these into account
separately.

We take care to remove destroyed monologues from the `viabranches` hash
to keep the count up to date, and determine whether a call is terminated
when there is no more than 1 tagged monologue left and no untagged
monologues.

Closes #875

Change-Id: I6b9618d598f4a95970cd2a452f06574423932b09
changes/16/35316/1
Richard Fuchs 6 years ago
parent 1ec82768db
commit e0dd6747ea

@ -2544,6 +2544,8 @@ static void __monologue_destroy(struct call_monologue *monologue) {
call = monologue->call;
g_hash_table_remove(call->tags, &monologue->tag);
if (monologue->viabranch.s)
g_hash_table_remove(call->viabranches, &monologue->viabranch);
l = g_hash_table_get_values(monologue->other_tags);
@ -2564,7 +2566,7 @@ static int monologue_destroy(struct call_monologue *ml) {
__monologue_destroy(ml);
if (!g_hash_table_size(c->tags)) {
if (g_hash_table_size(c->tags) < 2 && g_hash_table_size(c->viabranches) == 0) {
ilog(LOG_INFO, "Call branch '" STR_FORMAT_M "' (%s" STR_FORMAT "%svia-branch '" STR_FORMAT_M "') "
"deleted, no more branches remaining",
STR_FMT_M(&ml->tag),
@ -2754,7 +2756,7 @@ int call_delete_branch(const str *callid, const str *branch,
if ((!totag || !totag->len) && branch && branch->len) {
// try a via-branch match
ml = g_hash_table_lookup(c->viabranches, branch);
if (ml && ml->tag.len) // ignore wildcard/unknown monologues
if (ml)
goto do_delete;
}

Loading…
Cancel
Save