public List <Attendee> GetAttendees() { List <Attendee> attendees = new List <Attendee>(); var participantsPtr = IntPtr.Zero; if (!_meetingManager.IsServierStarted) { return(attendees); } try { int maxParticipantCount = 100, getParticipantCount = 0; var participantByte = Marshal.SizeOf(typeof(ParticipantInfo)); var maxParticipantBytes = participantByte * maxParticipantCount; participantsPtr = Marshal.AllocHGlobal(maxParticipantBytes); var result = MeetingAgent.GetParticipantsEx(participantsPtr, ref getParticipantCount, maxParticipantCount); if (result != 0) { } var participants = new List <ParticipantInfo>(); for (var i = 0; i < getParticipantCount; i++) { var pointer = new IntPtr(participantsPtr.ToInt64() + participantByte * i); var participant = (ParticipantInfo)Marshal.PtrToStructure(pointer, typeof(ParticipantInfo)); participants.Add(participant); } participants.ForEach(p => { attendees.Add(new Attendee() { Id = p.m_contactInfo.m_szPhoneId, Name = p.m_contactInfo.m_szDisplayName, IsSpeaking = p.m_bIsSpeaking == 1 }); }); return(attendees); } catch (Exception ex) { Log.Logger.Error($"GetAttendees() excpetion:{ex}"); return(attendees); } finally { if (participantsPtr != IntPtr.Zero) { Marshal.FreeHGlobal(participantsPtr); } } }