[Asterisk-code-review] app confbridge: Bridge and announcers not removed if confere... (asterisk[15])

Robert Mordec asteriskteam at digium.com
Mon May 21 07:35:23 CDT 2018


Robert Mordec has uploaded this change for review. ( https://gerrit.asterisk.org/9028


Change subject: app_confbridge: Bridge and announcers not removed if conference ends quickly
......................................................................

app_confbridge: Bridge and announcers not removed if conference ends quickly

If a conference is ended very quickly after it was created, ie. first user
immediatlely hangs up, conference bridge and announcer channels are
not removed.

When conference is created, push_announcer() function is added to playback
queue task processor and conference object reference is bumped. If conference
is ended while push_announcer() function is still going,
ao2_cleanup(conference) at the end of push_announcer() will call
the destructor function - destroy_conference_bridge().

The destroy_conference_bridge() function will then add hangup_playback task
to playback queue and will wait for it to end. Since it is already
a current task from playback queue it will wait forever.

This patch removes announcer channels at the end of push_announcer() if
by then the conference object reference counter is decreased to 1.
This prevents conference destructor from trying to remove the announcer
and locking up in the process.

ASTERISK-27870 #close

Change-Id: I947a50fb121422d90fd1816d643a54d75185a477
---
M apps/app_confbridge.c
1 file changed, 11 insertions(+), 0 deletions(-)



  git pull ssh://gerrit.asterisk.org:29418/asterisk refs/changes/28/9028/1

diff --git a/apps/app_confbridge.c b/apps/app_confbridge.c
index f3f0fdf..2b8d7c0 100644
--- a/apps/app_confbridge.c
+++ b/apps/app_confbridge.c
@@ -1460,6 +1460,17 @@
 	}
 
 	ast_autoservice_start(conference->playback_chan);
+
+	if (ao2_ref(conference, 0) == 1) {
+		/* Looks like our conference ended as soon as it started and playback channel
+		 * is no longer needed. This prevents conference destructor from locking up
+		 * while waiting for playback queue taksprocessor to finish this task.
+		 */
+		ast_autoservice_stop(conference->playback_chan);
+		ast_hangup(conference->playback_chan);
+		conference->playback_chan = NULL;
+	}
+
 	ao2_cleanup(conference);
 	return 0;
 }

-- 
To view, visit https://gerrit.asterisk.org/9028
To unsubscribe, visit https://gerrit.asterisk.org/settings

Gerrit-Project: asterisk
Gerrit-Branch: 15
Gerrit-MessageType: newchange
Gerrit-Change-Id: I947a50fb121422d90fd1816d643a54d75185a477
Gerrit-Change-Number: 9028
Gerrit-PatchSet: 1
Gerrit-Owner: Robert Mordec <r.mordec at slican.pl>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.digium.com/pipermail/asterisk-code-review/attachments/20180521/77d44d91/attachment-0001.html>


More information about the asterisk-code-review mailing list