2
/* Ekiga -- A VoIP and Video-Conferencing application
3
* Copyright (C) 2000-2009 Damien Sandras <dsandras@seconix.com>
5
* This program is free software; you can redistribute it and/or modify
6
* it under the terms of the GNU General Public License as published by
7
* the Free Software Foundation; either version 2 of the License, or
8
* (at your option) any later version.
10
* This program is distributed in the hope that it will be useful,
11
* but WITHOUT ANY WARRANTY; without even the implied warranty of
12
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
13
* GNU General Public License for more details.
15
* You should have received a copy of the GNU General Public License
16
* along with this program; if not, write to the Free Software Foundation,
17
* Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301, USA.
20
* Ekiga is licensed under the GPL license and as a special exception,
21
* you have permission to link or otherwise combine this program with the
22
* programs OPAL, OpenH323 and PWLIB, and distribute the combination,
23
* without applying the requirements of the GNU GPL to the OPAL, OpenH323
24
* and PWLIB programs, as long as you do follow the requirements of the
25
* GNU GPL for all the rest of the software thus combined.
30
* sipendpoint.h - description
31
* -----------------------------
32
* begin : Wed 24 Nov 2004
33
* copyright : (C) 2000-2006 by Damien Sandras
34
* description : This file contains the SIP Endpoint class.
39
#ifndef _SIP_ENDPOINT_H_
40
#define _SIP_ENDPOINT_H_
42
#include <opal/opal.h>
44
#include "presence-core.h"
45
#include "call-manager.h"
46
#include "call-protocol-manager.h"
47
#include "opal-bank.h"
48
#include "sip-dialect.h"
49
#include "call-core.h"
50
#include "contact-core.h"
54
#include "opal-call-manager.h"
60
class EndPoint : public SIPEndPoint,
61
public Ekiga::Service,
62
public Ekiga::CallProtocolManager,
63
public Ekiga::PresentityDecorator,
64
public Ekiga::ContactDecorator
66
PCLASSINFO(EndPoint, SIPEndPoint);
70
typedef std::list<std::string> domain_list;
71
typedef std::list<std::string>::iterator domain_list_iterator;
73
EndPoint (CallManager& ep,
74
Ekiga::ServiceCore& core,
75
unsigned listen_port);
80
const std::string get_name () const
81
{ return "opal-sip-endpoint"; }
83
const std::string get_description () const
84
{ return "\tObject managing SIP objects with the Opal library"; }
86
/* ContactDecorator and PresentityDecorator */
87
bool populate_menu (Ekiga::ContactPtr contact,
88
const std::string uri,
89
Ekiga::MenuBuilder &builder);
91
bool populate_menu (Ekiga::PresentityPtr presentity,
92
const std::string uri,
93
Ekiga::MenuBuilder & builder);
95
bool menu_builder_add_actions (const std::string & fullname,
96
const std::string& uri,
97
Ekiga::MenuBuilder & builder);
101
bool send_message (const std::string & uri,
102
const std::string & message);
105
/* CallProtocolManager */
106
bool dial (const std::string & uri);
108
const std::string & get_protocol_name () const;
110
void set_dtmf_mode (unsigned mode);
111
unsigned get_dtmf_mode () const;
113
bool set_listen_port (unsigned port);
114
const Ekiga::CallProtocolManager::Interface& get_listen_interface () const;
118
void set_nat_binding_delay (unsigned delay);
119
unsigned get_nat_binding_delay ();
121
void set_outbound_proxy (const std::string & uri);
122
const std::string & get_outbound_proxy () const;
124
void set_forward_uri (const std::string & uri);
125
const std::string & get_forward_uri () const;
128
/* AccountSubscriber */
129
bool subscribe (const Opal::Account & account);
130
bool unsubscribe (const Opal::Account & account);
134
static std::string get_aor_domain (const std::string & aor);
138
void Register (const std::string username,
139
const std::string host,
140
const std::string auth_username,
141
const std::string password,
143
bool is_limited, /* limited registrar = which do not accept
144
extra contact addresses, such as private ones*/
147
void OnRegistered (const PString & aor,
148
bool wasRegistering);
150
void OnRegistrationFailed (const PString & aor,
151
SIP_PDU::StatusCodes reason,
152
bool wasRegistering);
154
void OnMWIReceived (const PString & party,
155
OpalManager::MessageWaitingType type,
156
const PString & info);
158
bool OnIncomingConnection (OpalConnection &connection,
160
OpalConnection::StringOptions * stroptions);
162
void OnDialogInfoReceived (const SIPDialogNotification & info);
164
PBoolean OnReceivedINVITE (OpalTransport & transport, SIP_PDU * pdu);
166
bool OnReceivedMESSAGE (OpalTransport & transport,
169
void OnMESSAGECompleted (const SIPMessage::Params & params,
170
SIP_PDU::StatusCodes reason);
172
SIPURL GetRegisteredPartyName (const SIPURL & host,
173
const OpalTransport & transport);
178
void on_dial (std::string uri);
179
void on_message (std::string uri,
181
void on_transfer (std::string uri);
183
void on_bank_updated (Ekiga::AccountPtr account);
185
bool visit_accounts (Ekiga::AccountPtr account);
187
void registration_event_in_main (const std::string aor,
188
Account::RegistrationState state,
189
const std::string msg);
191
void presence_status_in_main (std::string uri,
192
std::string presence,
195
void push_message_in_main (const std::string uri,
196
const std::string name,
197
const std::string msg);
199
void push_notice_in_main (const std::string uri,
200
const std::string name,
201
const std::string msg);
203
void mwi_received_in_main (const std::string aor,
204
const std::string info);
207
std::map<std::string, std::string> accounts;
209
CallManager & manager;
210
Ekiga::ServiceCore & core;
212
std::map<std::string, PString> publications;
214
Ekiga::CallProtocolManager::Interface listen_iface;
216
std::string protocol_name;
217
std::string uri_prefix;
218
std::string forward_uri;
219
std::string outbound_proxy;
221
unsigned listen_port;
222
bool auto_answer_call;
224
boost::shared_ptr<SIP::Dialect> dialect;