Add 'conference xxxx list count' to get exact member count for a given conference

This commit is contained in:
Michael S Collins 2011-05-25 16:52:54 -07:00
parent 788ef41a86
commit f731abe05f
1 changed files with 14 additions and 1 deletions

View File

@ -3590,6 +3590,14 @@ static void conference_list(conference_obj_t *conference, switch_stream_handle_t
switch_mutex_unlock(conference->member_mutex); switch_mutex_unlock(conference->member_mutex);
} }
static void conference_list_count_only(conference_obj_t *conference, switch_stream_handle_t *stream)
{
switch_assert(conference != NULL);
switch_assert(stream != NULL);
stream->write_function(stream, "%d\n", conference->count);
}
static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data) static switch_status_t conf_api_sub_mute(conference_member_t *member, switch_stream_handle_t *stream, void *data)
{ {
switch_event_t *event; switch_event_t *event;
@ -3889,6 +3897,7 @@ static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_st
char *d = ";"; char *d = ";";
int pretty = 0; int pretty = 0;
int summary = 0; int summary = 0;
int countonly = 0;
int argofs = (argc >= 2 && strcasecmp(argv[1], "list") == 0); /* detect being called from chat vs. api */ int argofs = (argc >= 2 && strcasecmp(argv[1], "list") == 0); /* detect being called from chat vs. api */
if (argv[1 + argofs]) { if (argv[1 + argofs]) {
@ -3909,6 +3918,8 @@ static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_st
pretty = 1; pretty = 1;
} else if (strcasecmp(argv[1 + argofs], "summary") == 0) { } else if (strcasecmp(argv[1 + argofs], "summary") == 0) {
summary = 1; summary = 1;
} else if (strcasecmp(argv[1 + argofs], "count") == 0) {
countonly = 1;
} }
} }
@ -3934,7 +3945,9 @@ static switch_status_t conf_api_sub_list(conference_obj_t *conference, switch_st
switch_mutex_unlock(globals.hash_mutex); switch_mutex_unlock(globals.hash_mutex);
} else { } else {
count++; count++;
if (pretty) { if (countonly) {
conference_list_count_only(conference, stream);
} else if (pretty) {
conference_list_pretty(conference, stream); conference_list_pretty(conference, stream);
} else { } else {
conference_list(conference, stream, d); conference_list(conference, stream, d);