summaryrefslogtreecommitdiff
path: root/apps/app_meetme.c
diff options
context:
space:
mode:
authorRussell Bryant <russell@russellbryant.com>2013-03-26 01:38:56 +0000
committerRussell Bryant <russell@russellbryant.com>2013-03-26 01:38:56 +0000
commit03047a47b6a8719b6d6f8ee60017c12d830c1bdd (patch)
tree438f81752e9c67e61cbe7c780539eb02cdf76ff6 /apps/app_meetme.c
parent23f363fcb1898d651371c75f1a996dc38c3498f5 (diff)
Fix multi-station answer race condition.
When an SLA trunk is ringing (inbound call on the trunk) Asterisk will make outbound calls to the stations that have that trunk. If more than one station answers the call at the same time, all channels other than the first one to answer are left in a bad state. The channel gets leaked, is not connected to anything, and there's no way to get rid of it. We now properly clean up these losing channels by hanging up on them. Since they lost the race, as we process their answer, there is no ringing trunk for them to answer. ........ Merged revisions 383835 from http://svn.asterisk.org/svn/asterisk/branches/1.8 ........ Merged revisions 383836 from http://svn.asterisk.org/svn/asterisk/branches/11 git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@383837 65c4cc65-6c06-0410-ace0-fbb531ad65f3
Diffstat (limited to 'apps/app_meetme.c')
-rw-r--r--apps/app_meetme.c9
1 files changed, 9 insertions, 0 deletions
diff --git a/apps/app_meetme.c b/apps/app_meetme.c
index c09e3c071..37ba39a0e 100644
--- a/apps/app_meetme.c
+++ b/apps/app_meetme.c
@@ -5926,7 +5926,16 @@ static void sla_handle_dial_state_event(void)
ringing_trunk = sla_choose_ringing_trunk(ringing_station->station, &s_trunk_ref, 1);
ast_mutex_unlock(&sla.lock);
if (!ringing_trunk) {
+ /* This case happens in a bit of a race condition. If two stations answer
+ * the outbound call at the same time, the first one will get connected to
+ * the trunk. When the second one gets here, it will not see any trunks
+ * ringing so we have no idea what to conect it to. So, we just hang up
+ * on it. */
ast_debug(1, "Found no ringing trunk for station '%s' to answer!\n", ringing_station->station->name);
+ ast_dial_join(ringing_station->station->dial);
+ ast_dial_destroy(ringing_station->station->dial);
+ ringing_station->station->dial = NULL;
+ ast_free(ringing_station);
break;
}
/* Track the channel that answered this trunk */