[server] / trunk / server / src / channelmanager.h Repository:
ViewVC logotype

Annotation of /trunk/server/src/channelmanager.h

Parent Directory Parent Directory | Revision Log Revision Log


Revision 530 - (view) (download)

1 : amartin 20 /*
2 : jtarlton 355 * This file is part of Project DiaStar Server.
3 : amartin 20 *
4 : amartin 143 * More information about this project can be found at:
5 : jtarlton 355 * http://www.projectdiastar.org.
6 : amartin 20 *
7 : amartin 143 * Copyright (C) 2009 Dialogic Corp.
8 : amartin 20 *
9 : amartin 143 * This program is free software; you can redistribute it and/or
10 :     * modify it under the terms of the GNU General Public License
11 :     * as published by the Free Software Foundation; either version 2
12 :     * of the License, or (at your option) any later version.
13 :     *
14 :     * This program is distributed in the hope that it will be useful,
15 :     * but WITHOUT ANY WARRANTY; without even the implied warranty of
16 :     * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 :     * GNU General Public License for more details.
18 :     *
19 :     * You should have received a copy of the GNU General Public License
20 :     * along with this program; if not, write to the Free Software
21 :     * Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA
22 :     * 02110-1301, USA.
23 :     * Alternatively see <http://www.gnu.org/licenses/>.
24 :     * Or see the LICENSE file included within the source tree.
25 :     *
26 : amartin 20 */
27 :    
28 :     /*!
29 : jtarlton 87 * \file channelmanager.h
30 : jtarlton 183 * \brief Base class for managing channels. Defines a generic interface
31 :     * between the server application and the device technologies.
32 : amartin 20 * \author Antony Martin <antony.martin@dialogic.com>
33 : jtarlton 83 * \author John Tarlton <john.tarlton@dialogic.com>
34 : jtarlton 87 * \version 30-MAR-2009
35 : amartin 20 */
36 :    
37 : jtarlton 87 #ifndef _CHANNELMANAGER_H
38 :     #define _CHANNELMANAGER_H
39 : amartin 20
40 : jtarlton 87 /*-------------------------------- Dependencies ------------------------------*/
41 : amartin 20
42 : jtarlton 83 #include <string>
43 : jtarlton 131 #include "ipinfo.h"
44 : jtarlton 83
45 : jtarlton 87 /*----------------------------------------------------------------------------*/
46 : jtarlton 83
47 :    
48 : jtarlton 59 /*!
49 : jtarlton 166 * Connection type
50 :     */
51 :     #define CONN_UNKNOWN "unknown"
52 : jtarlton 217 #define CONN_VOICE "voice"
53 : jtarlton 166 #define CONN_ANSWERMACHINE "answer-machine"
54 : jtarlton 174 #define CONN_FAX "fax"
55 : jtarlton 326 #define CONN_INTERCEPT "operator-intercept"
56 :     #define CONN_BUSY "busy-tone"
57 : jtarlton 166
58 : jtarlton 459
59 : jtarlton 166 /*!
60 : jtarlton 459 * End play /record reasons
61 :     */
62 :     #define PLAY_END_MEDIA "end"
63 :     #define PLAY_END_DIGIT "digit"
64 :     #define PLAY_STOPPED "stopped"
65 :    
66 :     #define RECORD_END_MAXDURATION "maxduration"
67 :     #define RECORD_END_DIGIT "digit"
68 :     #define RECORD_STOPPED "stopped"
69 :    
70 :    
71 :     /*!
72 : jtarlton 431 * Signalling protocols
73 :     */
74 :     enum Protocol
75 :     {
76 :     PROTOCOL_ISDN,
77 :     PROTOCOL_SIP,
78 :     PROTOCOL_SS7
79 :     };
80 :    
81 :    
82 :     /*!
83 : jtarlton 87 * \class Channel
84 : jtarlton 166 * Base class for managing a channel's resources.
85 : amartin 20 */
86 : jtarlton 87 class Channel
87 : amartin 20 {
88 :     public:
89 :    
90 : jtarlton 46 /*!
91 : jtarlton 87 * ctor.
92 : amartin 20 */
93 : jtarlton 87 Channel() {}
94 : amartin 20
95 : jtarlton 46 /*!
96 : jtarlton 87 * dtor
97 : amartin 20 */
98 : jtarlton 87 virtual ~Channel() {}
99 : amartin 20
100 : jtarlton 46 /*!
101 : jtarlton 530 * Get the current signalling protocol.
102 : jtarlton 390 */
103 :     virtual Protocol getProtocol() const = 0
104 :    
105 :     ;
106 :     /*!
107 : jtarlton 183 * Make an outbound call.
108 :     * \param local_number - caller's number
109 :     * \param local_name - caller's name
110 :     * \param remote_number - callee's number
111 : jtarlton 217 * \param cpa - set true to enable call progress analysis.
112 : amartin 20 */
113 : jtarlton 87 virtual bool makeCall( const std::string& local_number,
114 : jtarlton 65 const std::string& local_name,
115 : jtarlton 166 const std::string& remote_number,
116 :     bool cpa ) = 0;
117 : amartin 20
118 : jtarlton 46 /*!
119 : jtarlton 183 * Hangup a call.
120 : jtarlton 262 * \param cause - reason the call is being cleared
121 : amartin 20 */
122 : jtarlton 262 virtual bool hangup( int cause ) = 0;
123 : amartin 20
124 : jtarlton 46 /*!
125 : jtarlton 183 * Seize an inbound call.
126 : amartin 20 */
127 : jtarlton 87 virtual bool seize() = 0;
128 : amartin 20
129 : jtarlton 46 /*!
130 : jtarlton 183 * Accept an inbound call.
131 : amartin 20 */
132 : jtarlton 87 virtual bool accept() = 0;
133 : amartin 20
134 : jtarlton 101 /*!
135 : jtarlton 183 * Answer an inbound call.
136 : amartin 20 */
137 : jtarlton 87 virtual bool answer() = 0;
138 : jtarlton 103
139 :     /*!
140 : jtarlton 183 * Send dtmf digits to an established call.
141 : jtarlton 152 * \param dtmf - digits to send.
142 :     */
143 :     virtual bool sendDtmf( const std::string& dtmf ) = 0;
144 :    
145 :     /*!
146 : jtarlton 390 * Play media to an established call.
147 :     * \param audio_uri - audio file.
148 :     * \param video_uri - video file.
149 : jtarlton 426 * \param stop_digits - termination digits.
150 : jtarlton 390 */
151 :     virtual bool play( const std::string& audio_uri,
152 : jtarlton 426 const std::string& video_uri,
153 :     const std::string& stop_digits ) = 0;
154 : jtarlton 390
155 :     /*!
156 :     * Record media from an established call.
157 :     * \param audio_uri - audio file.
158 :     * \param video_uri - video file.
159 : jtarlton 426 * \param stop_digits - termination digits.
160 : jtarlton 390 */
161 :     virtual bool record( const std::string& audio_uri,
162 : jtarlton 426 const std::string& video_uri,
163 :     const std::string& stop_digits ) = 0;
164 : jtarlton 390
165 :     /*!
166 : jtarlton 426 *
167 :     */
168 :     virtual bool isStopDigit( char dtmf ) const = 0;
169 :    
170 :     /*!
171 : jtarlton 411 * Start streaming media to the client.
172 :     */
173 :     virtual bool startMedia() = 0;
174 :    
175 :     /*!
176 :     * Stop streaming media to the client.
177 :     */
178 :     virtual bool stopMedia() = 0;
179 :    
180 :     /*!
181 : jtarlton 131 * Get the local ip-address and port number for the rtp audio.
182 : jtarlton 103 */
183 : jtarlton 131 virtual void getLocalRtpAudioInfo( IpInfo& rtp_audio ) const = 0;
184 : jtarlton 103
185 :     /*!
186 : jtarlton 131 * Save the ip-address and port of the remote party's rtp audio.
187 : jtarlton 103 */
188 : jtarlton 131 virtual void setRemoteRtpAudioInfo( const IpInfo& rtp_audio ) = 0;
189 : jtarlton 390
190 :     /*!
191 :     * Get the local ip-address and port number for the rtp video;
192 :     */
193 :     virtual void getLocalRtpVideoInfo( IpInfo& rtp_video ) const = 0;
194 :    
195 :     /*!
196 :     * Save the ip-address and port of the remote party's rtp video.
197 :     */
198 :     virtual void setRemoteRtpVideoInfo( const IpInfo& rtp_video ) = 0;
199 : jtarlton 87 };
200 : amartin 20
201 : jtarlton 67
202 : jtarlton 87 /*!
203 :     * \class ChannelManager
204 : jtarlton 183 * Base class for managing channel objects.
205 : jtarlton 87 */
206 :     class ChannelManager
207 :     {
208 :    
209 :     public:
210 :    
211 : jtarlton 54 /*!
212 : jtarlton 87 * ctor
213 : jtarlton 54 */
214 : jtarlton 87 ChannelManager() {}
215 : jtarlton 54
216 : jtarlton 87 /*!
217 :     * dtor
218 :     */
219 :     virtual ~ChannelManager() {}
220 : amartin 20
221 : jtarlton 87 /*!
222 : jtarlton 176 * Init all devices.
223 : jtarlton 530 * \param config - configuration file
224 : jtarlton 87 */
225 : jtarlton 530 virtual bool start( const std::string& config ) = 0;
226 : jtarlton 87
227 :     /*!
228 : jtarlton 176 * Probe devices and generate configuration information.
229 : jtarlton 530 * \param config - name of the configuration file that should receive the
230 :     * information. If empty, the information will be written to
231 :     * stdout.
232 : jtarlton 176 */
233 : jtarlton 530 virtual bool probe( const std::string& config ) { return false; }
234 : jtarlton 176
235 :     /*!
236 : jtarlton 183 * Close all devices.
237 : jtarlton 87 */
238 :     virtual void shutdown() = 0;
239 :    
240 :     /*!
241 : jtarlton 176 * Allocate a channel object.
242 : jtarlton 87 */
243 :     Channel* createChannel( void* );
244 :    
245 :     /*!
246 : jtarlton 176 * Delete a channel object.
247 : jtarlton 87 */
248 :     void destroyChannel( Channel* channel );
249 : amartin 20 };
250 :    
251 : jtarlton 46
252 : jtarlton 82 /*!
253 : jtarlton 183 * \class ChannelManagerClient
254 :     * Base class that defines the application's interfaces that are called to
255 :     * handle events from the device layer.
256 : jtarlton 82 */
257 : jtarlton 87 class ChannelManagerClient
258 : jtarlton 82 {
259 :     public:
260 :    
261 :     /*!
262 : jtarlton 83 * ctor
263 :     */
264 : jtarlton 87 ChannelManagerClient() {}
265 : jtarlton 83
266 :     /*!
267 :     * dtor
268 :     */
269 : jtarlton 87 virtual ~ChannelManagerClient() {}
270 :    
271 : jtarlton 83 /*!
272 : jtarlton 82 * Handle an incoming call event.
273 : jtarlton 158 * \param channel - source of the event.
274 : jtarlton 198 * \param local_number - called number.
275 :     * \param remote_number - calling number.
276 : jtarlton 82 */
277 : jtarlton 89 virtual void onIncoming( Channel* channel,
278 :     const std::string& local_number,
279 :     const std::string& remote_number ) = 0;
280 : jtarlton 82
281 :     /*!
282 : jtarlton 95 * Handle a call accepted event.
283 : jtarlton 158 * \param channel - source of the event.
284 : jtarlton 95 */
285 :     virtual void onAccepted( Channel* channel ) = 0;
286 :    
287 :     /*!
288 : amartin 98 * Handle a call answered event.
289 : jtarlton 158 * \param channel - source of the event.
290 : amartin 98 */
291 :     virtual void onAnswered( Channel* channel ) = 0;
292 :    
293 :     /*!
294 : jtarlton 158 * Handle an outgoing call proceeding event.
295 :     * \param channel - source of the event.
296 : jtarlton 82 */
297 : jtarlton 87 virtual void onProceeding( Channel* channel ) = 0;
298 : jtarlton 82
299 :     /*!
300 :     * Handle a remote party ringing event.
301 : jtarlton 158 * \param channel - source of the event.
302 : jtarlton 82 */
303 : jtarlton 87 virtual void onRinging( Channel* channel ) = 0;
304 : jtarlton 82
305 :     /*!
306 :     * Handle a hangup event.
307 : jtarlton 158 * \param channel - source of the event.
308 : jtarlton 198 * \param cause - Q.931 cause value
309 : jtarlton 265 * \param cause_text - description
310 : jtarlton 82 */
311 : jtarlton 265 virtual void onHangup( Channel* channel,
312 :     int cause,
313 : jtarlton 489 const std::string& cause_text,
314 :     const std::string& conn_type = std::string() ) = 0;
315 : jtarlton 82
316 :     /*!
317 :     * Handle a call connected event.
318 : jtarlton 158 * \param channel - source of the event.
319 : jtarlton 166 * \param conn_type - what the channel has connected to.
320 : jtarlton 82 */
321 : jtarlton 166 virtual void onConnect( Channel* channel, const std::string& conn_type ) = 0;
322 : jtarlton 82
323 :     /*!
324 : jtarlton 530 * Handle a media change event.
325 : jtarlton 431 * \param channel - source of the event.
326 :     */
327 :     virtual void onMedia( Channel* channel ) = 0;
328 :    
329 :     /*!
330 : jtarlton 82 * Handle a dtmf digit received event.
331 : jtarlton 158 * \param channel - source of the event.
332 : jtarlton 426 * \param dtmf - the digit
333 : jtarlton 198 * \param duration - length digit in ms.
334 : jtarlton 82 */
335 : jtarlton 87 virtual void onDtmf( Channel* channel,
336 : jtarlton 426 char dtmf,
337 : jtarlton 82 int duration ) = 0;
338 : jtarlton 158
339 :     /*!
340 :     * Handle a senddtmf completion event from a channel.
341 :     * \param channel - source of the event.
342 :     */
343 :     virtual void onSendDtmfCompleted( Channel* channel ) = 0;
344 :    
345 : jtarlton 395 /*!
346 :     * Handle a play completion event from a channel.
347 :     * \param channel - source of the event.
348 : jtarlton 459 * \param reason - why the play ended.
349 : jtarlton 395 */
350 : jtarlton 459 virtual void onPlayCompleted( Channel* channel, const std::string& reason ) = 0;
351 : jtarlton 399
352 :     /*!
353 :     * Handle a record completion event from a channel.
354 :     * \param channel - source of the event.
355 : jtarlton 459 * \param reason - why the record ended.
356 : jtarlton 399 */
357 : jtarlton 459 virtual void onRecordCompleted( Channel* channel, const std::string& reason ) = 0;
358 : jtarlton 83 };
359 : jtarlton 82
360 : jtarlton 83
361 :    
362 : jtarlton 87 #endif // _CHANNELMANAGER_H
363 : jtarlton 83
364 :    
365 : amartin 20 /* vim:ts=4:set nu:
366 :     * EOF
367 :     */

No admin address has been configured
ViewVC Help
Powered by ViewVC 1.0.8