commit de lancement : 2.0.1-1
[asterisk-app-conference.git] / conference.h
1
2 // $Id: conference.h 884 2007-06-27 14:56:21Z sbalea $
3
4 /*
5 * app_conference
6 *
7 * A channel independent conference application for Asterisk
8 *
9 * Copyright (C) 2002, 2003 Junghanns.NET GmbH
10 * Copyright (C) 2003, 2004 HorizonLive.com, Inc.
11 * Copyright (C) 2005, 2006 HorizonWimba, Inc.
12 * Copyright (C) 2007 Wimba, Inc.
13 *
14 * Klaus-Peter Junghanns <kapejod@ns1.jnetdns.de>
15 *
16 * Video Conferencing support added by
17 * Neil Stratford <neils@vipadia.com>
18 * Copyright (C) 2005, 2005 Vipadia Limited
19 *
20 * VAD driven video conferencing, text message support
21 * and miscellaneous enhancements added by
22 * Mihai Balea <mihai at hates dot ms>
23 *
24 * This program may be modified and distributed under the
25 * terms of the GNU General Public License. You should have received
26 * a copy of the GNU General Public License along with this
27 * program; if not, write to the Free Software Foundation, Inc.
28 * 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
29 */
30
31 #ifndef _APP_CONF_CONFERENCE_H
32 #define _APP_CONF_CONFERENCE_H
33
34 //
35 // includes
36 //
37
38 #include "app_conference.h"
39 #include "common.h"
40
41 //
42 // struct declarations
43 //
44
45 typedef struct ast_conference_stats
46 {
47 // conference name ( copied for ease of use )
48 char name[128] ;
49
50 // type of connection
51 unsigned short phone ;
52 unsigned short iaxclient ;
53 unsigned short sip ;
54
55 // type of users
56 unsigned short moderators ;
57 unsigned short listeners ;
58
59 // accounting data
60 unsigned long frames_in ;
61 unsigned long frames_out ;
62 unsigned long frames_mixed ;
63
64 struct timeval time_entered ;
65
66 } ast_conference_stats ;
67
68
69 struct ast_conference
70 {
71 // conference name
72 char name[128] ;
73
74 // single-linked list of members in conference
75 struct ast_conf_member* memberlist ;
76 int membercount ;
77 int id_count;
78
79 // id of the default video source
80 // If nobody is talking and video is unlocked, we use this source
81 int default_video_source_id;
82
83 // id of the current video source
84 // this changes according to VAD rules and lock requests
85 int current_video_source_id;
86
87 // timestamp of when the current source has started talking
88 // TODO: do we really need this?
89 //struct timeval current_video_source_timestamp;
90
91 // Video source locked flag, 1 -> locked, 0 -> unlocked
92 short video_locked;
93
94 // conference thread id
95 pthread_t conference_thread ;
96
97 // conference data mutex
98 ast_mutex_t lock ;
99
100 // pointer to next conference in single-linked list
101 struct ast_conference* next ;
102
103 // pointer to translation paths
104 struct ast_trans_pvt* from_slinear_paths[ AC_SUPPORTED_FORMATS ] ;
105
106 // conference stats
107 ast_conference_stats stats ;
108
109 // keep track of current delivery time
110 struct timeval delivery_time ;
111
112 // 1 => on, 0 => off
113 short debug_flag ;
114 } ;
115
116
117 #include "member.h"
118
119 //
120 // function declarations
121 //
122
123 struct ast_conference* start_conference( struct ast_conf_member* member ) ;
124
125 void conference_exec( struct ast_conference* conf ) ;
126
127 struct ast_conference* find_conf( const char* name ) ;
128 struct ast_conference* create_conf( char* name, struct ast_conf_member* member ) ;
129 void remove_conf( struct ast_conference* conf ) ;
130 int end_conference( const char *name, int hangup ) ;
131
132 // find a particular member, locking if requested.
133 struct ast_conf_member *find_member ( const char *chan, int lock) ;
134
135 int queue_frame_for_listener( struct ast_conference* conf, struct ast_conf_member* member, conf_frame* frame ) ;
136 int queue_frame_for_speaker( struct ast_conference* conf, struct ast_conf_member* member, conf_frame* frame ) ;
137 int queue_silent_frame( struct ast_conference* conf, struct ast_conf_member* member ) ;
138
139 int get_new_id( struct ast_conference *conf );
140 void add_member( struct ast_conf_member* member, struct ast_conference* conf ) ;
141 int remove_member( struct ast_conf_member* member, struct ast_conference* conf ) ;
142 int count_member( struct ast_conf_member* member, struct ast_conference* conf, short add_member ) ;
143
144 void do_VAD_switching(struct ast_conference *conf);
145 int send_text_message_to_member(struct ast_conf_member *member, const char *text);
146 void do_video_switching(struct ast_conference *conf, int new_id, int lock);
147
148 // called by app_confernce.c:load_module()
149 void init_conference( void ) ;
150
151 int get_conference_count( void ) ;
152
153 int show_conference_list ( int fd, const char* name );
154 int manager_conference_list( struct mansession *s, const struct message *m);
155 int show_conference_stats ( int fd );
156 int kick_member ( const char* confname, int user_id);
157 int kick_channel ( const char *confname, const char *channel);
158 int kick_all ( void );
159 int mute_member ( const char* confname, int user_id);
160 int unmute_member ( const char* confname, int user_id);
161 int mute_channel ( const char* confname, const char* user_chan);
162 int unmute_channel ( const char* confname, const char* user_chan);
163 int viewstream_switch ( const char* confname, int user_id, int stream_id);
164 int viewchannel_switch ( const char* confname, const char* user_chan, const char* stream_chan);
165
166 int get_conference_stats( ast_conference_stats* stats, int requested ) ;
167 int get_conference_stats_by_name( ast_conference_stats* stats, const char* name ) ;
168
169 int lock_conference(const char *conference, int member_id);
170 int lock_conference_channel(const char *conference, const char *channel);
171 int unlock_conference(const char *conference);
172
173 int set_default_id(const char *conference, int member_id);
174 int set_default_channel(const char *conference, const char *channel);
175
176 int video_mute_member(const char *conference, int member_id);
177 int video_unmute_member(const char *conference, int member_id);
178 int video_mute_channel(const char *conference, const char *channel);
179 int video_unmute_channel(const char *conference, const char *channel);
180
181 int send_text(const char *conference, int member, const char *text);
182 int send_text_channel(const char *conference, const char *channel, const char *text);
183 int send_text_broadcast(const char *conference, const char *text);
184
185 int drive(const char *conference, int src_member_id, int dst_member_id);
186 int drive_channel(const char *conference, const char *src_channel, const char *dst_channel);
187
188 int play_sound_channel(int fd, const char *channel, const char *file, int mute);
189 int stop_sound_channel(int fd, const char *channel);
190
191 int set_conference_debugging( const char* name, int state ) ;
192
193 #endif