asterisk/apps/confbridge
Matthew Jordan 50b2d6eec1 app_confbridge: Fix crash caused when waitmarked/marked users leave together
When waitmarked users join a ConfBridge, the conference state is transitioned
from EMPTY -> INACTIVE. In this state, the users are maintined in a waiting
users list. When a marked user joins, the ConfBridge conference transitions
from INACTIVE -> MULTI_MARKED, and all users are put onto the active list of
users. This process works correctly.

When the marked user leaves, if they are the last marked user, the MULTI_MARKED
state does the following:
(1) It plays back a message to the bridge stating that the leader has left the
    conference. This requires an unlocking of the bridge.
(2) It moves waitmarked users back to the waiting list
(3) It transitions to the appropriate state: in this case, INACTIVE

However, because it plays the prompt back to the bridge before moving the users
and before finishing the state transition, this creates a race condition: with
the bridge unlocked, waitmarked users who leave the conference (or are kicked
from it) can cause a state transition of the bridge to another state before
the conference is transitioned to the INACTIVE state. This causes the state
machine to get a bit wonky, often leading to a crash when the MULTI_MARKED state
attempts to conclude its processing.

This patch fixes this problem:
(1) It prevents kicked users from being kicked again. That's just a nicety.
(2) More importantly, it fixes the race condition by only playing the prompt
    once the state has transitioned correctly to INACTIVE. If waitmarked users
    sneak out during the prompt being played, no harm no foul.

Review: https://reviewboard.asterisk.org/r/3108/

Note that the patch committed here is essentially the same as uploaded by
Simon Moxon on ASTERISK-22740, with the addition of the double kick prevention.

(closes issue AST-1258)
Reported by: Steve Pitts

(closes issue ASTERISK-22740)
Reported by: Simon Moxon
patches:
  ASTERISK-22740.diff uploaded by Simon Moxon (license 6546)
........

Merged revisions 405215 from http://svn.asterisk.org/svn/asterisk/branches/11
........

Merged revisions 405216 from http://svn.asterisk.org/svn/asterisk/branches/12


git-svn-id: https://origsvn.digium.com/svn/asterisk/trunk@405217 65c4cc65-6c06-0410-ace0-fbb531ad65f3
2014-01-09 15:50:23 +00:00
..
include Confbridge: Add option to review the recording similar to announce_join_leave 2013-11-15 22:38:52 +00:00
conf_chan_announce.c Restore Dial, Queue, and FollowMe 'I' option support. 2013-09-13 22:19:23 +00:00
conf_chan_record.c channels: Return allocated channels locked. 2013-12-18 19:28:05 +00:00
conf_config_parser.c Confbridge: Add option to review the recording similar to announce_join_leave 2013-11-15 22:38:52 +00:00
conf_state.c confbridge: Separate user muting from system muting overrides. 2013-11-02 03:24:47 +00:00
conf_state_empty.c confbridge: Rename items for clarity and consistency. 2013-03-09 00:21:46 +00:00
conf_state_inactive.c confbridge: Separate user muting from system muting overrides. 2013-11-02 03:24:47 +00:00
conf_state_multi.c confbridge: Separate user muting from system muting overrides. 2013-11-02 03:24:47 +00:00
conf_state_multi_marked.c app_confbridge: Fix crash caused when waitmarked/marked users leave together 2014-01-09 15:50:23 +00:00
conf_state_single.c confbridge: Separate user muting from system muting overrides. 2013-11-02 03:24:47 +00:00
conf_state_single_marked.c confbridge: Separate user muting from system muting overrides. 2013-11-02 03:24:47 +00:00
confbridge_manager.c Multiple revisions 399887,400138,400178,400180-400181 2013-09-30 18:55:27 +00:00