1 
2 #ifndef ROOM_INFO_H
3 #define ROOM_INFO_H
4 
5 #include <string>
6 using std::string;
7 
8 #include <list>
9 using std::list;
10 
11 #include <vector>
12 using std::vector;
13 
14 #include <sys/time.h>
15 
16 
17 #include "AmArg.h"
18 #include "AmThread.h"
19 
20 struct ConferenceRoomParticipant {
21   enum ParticipantStatus {
22     Disconnected = 0,
23     Connecting,
24     Ringing,
25     Connected,
26     Disconnecting,
27     Finished
28   };
29 
30   string localtag;
31   string number;
32   ParticipantStatus status;
33   string last_reason;
34   string participant_id;
35 
36   int muted;
37 
38   struct timeval last_access_time;
39 
40   ConferenceRoomParticipant()
41     : status(Disconnected), muted(0) { }
42 
43   ~ConferenceRoomParticipant() { }
44 
45   inline void updateAccess(const struct timeval& now);
46   inline bool expired(const struct timeval& now);
47 
48   inline void updateStatus(ParticipantStatus new_status,
49 			   const string& reason,
50 			   struct timeval& now);
51 
52   inline void setMuted(int mute);
53 
54   AmArg asArgArray();
55 };
56 
57 struct ConferenceRoom {
58   string adminpin;
59 
60   struct timeval last_access_time;
61   time_t expiry_time;
62 
63   list<ConferenceRoomParticipant> participants;
64 
65   ConferenceRoom();
66   ~ConferenceRoom() { }
67 
68   void cleanExpired();
69 
70   AmArg asArgArray();
71 
72   vector<string> participantLtags();
73 
74   void newParticipant(const string& localtag, const string& number,
75 		      const string& participant_id);
76 
77   bool updateStatus(const string& part_tag,
78 		    ConferenceRoomParticipant::ParticipantStatus newstatus,
79 		    const string& reason);
80 
81   bool hasParticipant(const string& localtag);
82 
83   /** @returns whether participant is listed (and maybe not joined) */
84   bool hasInvitedParticipant(const string& participant_id);
85 
86   void setMuted(const string& localtag, int mute);
87 
88   bool expired(const struct timeval& now);
89   bool expired();
90 
91   bool hard_expired(const struct timeval& now);
92 };
93 
94 
95 #endif
96