]> git.ipfire.org Git - thirdparty/freeswitch.git/commitdiff
make endconf count cumulative
authorAnthony Minessale <anthony.minessale@gmail.com>
Mon, 1 Jun 2009 13:06:45 +0000 (13:06 +0000)
committerAnthony Minessale <anthony.minessale@gmail.com>
Mon, 1 Jun 2009 13:06:45 +0000 (13:06 +0000)
git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13526 d0543943-73ff-0310-b7d9-9358b9ac24b2

src/mod/applications/mod_conference/mod_conference.c

index 56c06e840744e2fb36fdc689ff565a3b1b02de5d..e5fbad31929c1af7070f7e93d1c2505af92a7f9b 100644 (file)
@@ -279,6 +279,7 @@ typedef struct conference_obj {
        int video_running;
        uint32_t eflags;
        uint32_t verbose_events;
+       int end_count;
 } conference_obj_t;
 
 /* Relationship with another member */
@@ -609,6 +610,11 @@ static switch_status_t conference_add_member(conference_obj_t *conference, confe
 
        if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
                conference->count++;
+
+               if (switch_test_flag(member, MFLAG_ENDCONF)) {
+                       if (conference->end_count++);
+               }
+
                if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name);
@@ -756,10 +762,6 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe
                switch_core_speech_close(&member->lsh, &flags);
        }
 
-       if (switch_test_flag(member, MFLAG_ENDCONF)) {
-               switch_set_flag_locked(member->conference, CFLAG_DESTRUCT);
-       }
-
        if (member == member->conference->floor_holder) {
                member->conference->floor_holder = NULL;
        }
@@ -768,6 +770,14 @@ static switch_status_t conference_del_member(conference_obj_t *conference, confe
 
        if (!switch_test_flag(member, MFLAG_NOCHANNEL)) {
                conference->count--;
+
+               if (switch_test_flag(member, MFLAG_ENDCONF)) {
+                       if (!--member->conference->end_count) {
+                       switch_set_flag_locked(member->conference, CFLAG_DESTRUCT);
+                       }
+               }
+
+
                if (switch_event_create(&event, SWITCH_EVENT_PRESENCE_IN) == SWITCH_STATUS_SUCCESS) {
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "proto", CONF_CHAT_PROTO);
                        switch_event_add_header_string(event, SWITCH_STACK_BOTTOM, "login", conference->name);