Index: apps/app_meetme.c =================================================================== --- apps/app_meetme.c (revision 291826) +++ apps/app_meetme.c (working copy) @@ -488,11 +488,11 @@ - List participants in a conference. + List participants in a conference or all conferences. - + Conference number. @@ -498,6 +498,7 @@ Lists all users in a particular MeetMe conference. + If a Conference number is not specified all active conferences are returned. MeetmeList will follow as separate events, followed by a final event called MeetmeListComplete. @@ -4747,61 +4748,66 @@ if (!ast_strlen_zero(actionid)) snprintf(idText, sizeof(idText), "ActionID: %s\r\n", actionid); - if (AST_LIST_EMPTY(&confs)) { - astman_send_error(s, m, "No active conferences."); - return 0; + if (!AST_LIST_EMPTY(&confs)) { + /* Find the right conference */ + AST_LIST_LOCK(&confs); + AST_LIST_TRAVERSE(&confs, cnf, list) { + user_iter = ao2_iterator_init(cnf->usercontainer, 0); + /* If we ask for one particular, and this isn't it, skip it */ + if (!ast_strlen_zero(conference) && strcmp(cnf->confno, conference)) + continue; + + /* Show all the users */ + while ((user = ao2_iterator_next(&user_iter))) { + if(!total) { + astman_send_listack(s, m, "Meetme user list will follow", "start"); + } + total++; + astman_append(s, + "Event: MeetmeList\r\n" + "%s" + "Conference: %s\r\n" + "UserNumber: %d\r\n" + "CallerIDNum: %s\r\n" + "CallerIDName: %s\r\n" + "Channel: %s\r\n" + "Admin: %s\r\n" + "Role: %s\r\n" + "MarkedUser: %s\r\n" + "Muted: %s\r\n" + "Talking: %s\r\n" + "\r\n", + idText, + cnf->confno, + user->user_no, + S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, ""), + S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, ""), + user->chan->name, + ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "Yes" : "No", + ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "Listen only" : ast_test_flag64(&user->userflags, CONFFLAG_TALKER) ? "Talk only" : "Talk and listen", + ast_test_flag64(&user->userflags, CONFFLAG_MARKEDUSER) ? "Yes" : "No", + user->adminflags & ADMINFLAG_MUTED ? "By admin" : user->adminflags & ADMINFLAG_SELFMUTED ? "By self" : "No", + user->talking > 0 ? "Yes" : user->talking == 0 ? "No" : "Not monitored"); + ao2_ref(user, -1); + } + ao2_iterator_destroy(&user_iter); + } + AST_LIST_UNLOCK(&confs); } - - astman_send_listack(s, m, "Meetme user list will follow", "start"); - - /* Find the right conference */ - AST_LIST_LOCK(&confs); - AST_LIST_TRAVERSE(&confs, cnf, list) { - user_iter = ao2_iterator_init(cnf->usercontainer, 0); - /* If we ask for one particular, and this isn't it, skip it */ - if (!ast_strlen_zero(conference) && strcmp(cnf->confno, conference)) - continue; - - /* Show all the users */ - while ((user = ao2_iterator_next(&user_iter))) { - total++; - astman_append(s, - "Event: MeetmeList\r\n" - "%s" - "Conference: %s\r\n" - "UserNumber: %d\r\n" - "CallerIDNum: %s\r\n" - "CallerIDName: %s\r\n" - "Channel: %s\r\n" - "Admin: %s\r\n" - "Role: %s\r\n" - "MarkedUser: %s\r\n" - "Muted: %s\r\n" - "Talking: %s\r\n" - "\r\n", - idText, - cnf->confno, - user->user_no, - S_COR(user->chan->caller.id.number.valid, user->chan->caller.id.number.str, ""), - S_COR(user->chan->caller.id.name.valid, user->chan->caller.id.name.str, ""), - user->chan->name, - ast_test_flag64(&user->userflags, CONFFLAG_ADMIN) ? "Yes" : "No", - ast_test_flag64(&user->userflags, CONFFLAG_MONITOR) ? "Listen only" : ast_test_flag64(&user->userflags, CONFFLAG_TALKER) ? "Talk only" : "Talk and listen", - ast_test_flag64(&user->userflags, CONFFLAG_MARKEDUSER) ? "Yes" : "No", - user->adminflags & ADMINFLAG_MUTED ? "By admin" : user->adminflags & ADMINFLAG_SELFMUTED ? "By self" : "No", - user->talking > 0 ? "Yes" : user->talking == 0 ? "No" : "Not monitored"); - ao2_ref(user, -1); + if(!total) { + if(!ast_strlen_zero(conference)) { + astman_send_error(s, m, "Conference not found"); + return 0; } - ao2_iterator_destroy(&user_iter); + /* Specific conference not requested and none active. Send empty list */ + astman_send_listack(s, m, "Meetme user list will follow", "start"); } - AST_LIST_UNLOCK(&confs); - /* Send final confirmation */ astman_append(s, - "Event: MeetmeListComplete\r\n" - "EventList: Complete\r\n" - "ListItems: %d\r\n" - "%s" - "\r\n", total, idText); + "Event: MeetmeListComplete\r\n" + "EventList: Complete\r\n" + "ListItems: %d\r\n" + "%s" + "\r\n", total, idText); return 0; }