3
* Ekiga -- A VoIP and Video-Conferencing application
4
* Copyright (C) 2000-2009 Damien Sandras <dsandras@seconix.com>
6
* This program is free software; you can redistribute it and/or modify
7
* it under the terms of the GNU General Public License as published by
8
* the Free Software Foundation; either version 2 of the License, or (at
9
* your option) any later version. This program is distributed in the hope
10
* that it will be useful, but WITHOUT ANY WARRANTY; without even the
11
* implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
12
* See the GNU General Public License for more details.
14
* You should have received a copy of the GNU General Public License along
15
* with this program; if not, write to the Free Software Foundation, Inc.,
16
* 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
18
* Ekiga is licensed under the GPL license and as a special exception, you
19
* have permission to link or otherwise combine this program with the
20
* programs OPAL, OpenH323 and PWLIB, and distribute the combination, without
21
* applying the requirements of the GNU GPL to the OPAL, OpenH323 and PWLIB
22
* programs, as long as you do follow the requirements of the GNU GPL for all
23
* the rest of the software thus combined.
28
* call-core.h - description
29
* ------------------------------------------
30
* begin : written in 2007 by Damien Sandras
31
* copyright : (c) 2007 by Damien Sandras
32
* description : declaration of the interface of a call core.
33
* A call core manages CallManagers.
37
#ifndef __CALL_CORE_H__
38
#define __CALL_CORE_H__
40
#include "form-request.h"
41
#include "chain-of-responsibility.h"
44
#include "call-manager.h"
45
#include "call-protocol-manager.h"
46
#include <boost/smart_ptr.hpp>
48
#include <boost/signals.hpp>
49
#include <boost/bind.hpp>
59
* @defgroup calls Calls and protocols
70
typedef std::set<boost::shared_ptr<CallManager> >::iterator iterator;
71
typedef std::set<boost::shared_ptr<CallManager> >::const_iterator const_iterator;
75
CallCore () { nr_ready = 0; }
82
/*** Service Implementation ***/
84
/** Returns the name of the service.
85
* @return The service name.
87
const std::string get_name () const
88
{ return "call-core"; }
91
/** Returns the description of the service.
92
* @return The service description.
94
const std::string get_description () const
95
{ return "\tCall Core managing Call Manager objects"; }
98
/** Adds a call handled by the CallCore serice.
99
* @param call is the call to be added.
100
* @param manager is the CallManager handling it.
102
void add_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
104
/** Remove a call handled by the CallCore serice.
105
* @param call is the call to be removed.
107
void remove_call (boost::shared_ptr<Call> call);
109
/** Adds a CallManager to the CallCore service.
110
* @param The manager to be added.
112
void add_manager (boost::shared_ptr<CallManager> manager);
114
/** Return iterator to beginning
115
* @return iterator to beginning
118
const_iterator begin () const;
120
/** Return iterator to end
121
* @return iterator to end
124
const_iterator end () const;
126
/** This signal is emitted when a Ekiga::CallManager has been
127
* added to the CallCore Service.
129
boost::signal1<void, boost::shared_ptr<CallManager> > manager_added;
132
/*** Call Management ***/
134
/** Create a call based on the remote uri given as parameter
135
* @param: an uri to call
136
* @return: true if a Ekiga::Call could be created
138
bool dial (const std::string uri);
140
/*** Call Related Signals ***/
142
/** See call.h for the API
144
boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > ringing_call;
145
boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > setup_call;
146
boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > missed_call;
147
boost::signal3<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string> cleared_call;
148
boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > established_call;
149
boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > held_call;
150
boost::signal2<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call> > retrieved_call;
151
boost::signal5<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string, Call::StreamType, bool> stream_opened;
152
boost::signal5<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string, Call::StreamType, bool> stream_closed;
153
boost::signal4<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string, Call::StreamType> stream_paused;
154
boost::signal4<void, boost::shared_ptr<CallManager> , boost::shared_ptr<Call>, std::string, Call::StreamType> stream_resumed;
157
boost::signal1<void, boost::shared_ptr<CallManager> > manager_ready;
158
boost::signal0<void> ready;
160
/** This chain allows the CallCore to report errors to the user
162
ChainOfResponsibility<std::string> errors;
165
void on_new_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
166
void on_ringing_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
167
void on_setup_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
168
void on_missed_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
169
void on_cleared_call (std::string, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
170
void on_established_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
171
void on_held_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
172
void on_retrieved_call (boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
173
void on_stream_opened (std::string name, Call::StreamType type, bool is_transmitting, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
174
void on_stream_closed (std::string name, Call::StreamType type, bool is_transmitting, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
175
void on_stream_paused (std::string name, Call::StreamType type, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
176
void on_stream_resumed (std::string name, Call::StreamType type, boost::shared_ptr<Call> call, boost::shared_ptr<CallManager> manager);
178
void on_im_failed (std::string, std::string, boost::shared_ptr<CallManager> manager);
179
void on_im_sent (std::string, std::string, boost::shared_ptr<CallManager> manager);
180
void on_im_received (std::string, std::string, std::string, boost::shared_ptr<CallManager> manager);
181
void on_new_chat (std::string, std::string, boost::shared_ptr<CallManager> manager);
183
void on_manager_ready (boost::shared_ptr<CallManager> manager);
185
void on_call_removed (boost::shared_ptr<Call> call);
188
std::set<boost::shared_ptr<CallManager> > managers;
189
std::list<boost::signals::connection> manager_connections;
190
std::map<std::string, std::list<boost::signals::connection> > call_connections;