From 082385c1da3cdb63e7e0387852a47f94bf548762 Mon Sep 17 00:00:00 2001 From: Anthony Minessale Date: Mon, 1 Jun 2009 13:06:45 +0000 Subject: [PATCH] make endconf count cumulative git-svn-id: http://svn.freeswitch.org/svn/freeswitch/trunk@13526 d0543943-73ff-0310-b7d9-9358b9ac24b2 --- .../mod_conference/mod_conference.c | 18 ++++++++++++++---- 1 file changed, 14 insertions(+), 4 deletions(-) diff --git a/src/mod/applications/mod_conference/mod_conference.c b/src/mod/applications/mod_conference/mod_conference.c index 56c06e8407..e5fbad3192 100644 --- a/src/mod/applications/mod_conference/mod_conference.c +++ b/src/mod/applications/mod_conference/mod_conference.c @@ -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);