~ubuntu-branches/ubuntu/vivid/ekiga/vivid-proposed

« back to all changes in this revision

Viewing changes to lib/engine/components/opal/sip-endpoint.h

  • Committer: Bazaar Package Importer
  • Author(s): Kilian Krause
  • Date: 2011-07-17 00:24:50 UTC
  • mfrom: (5.1.5 upstream) (7.1.7 sid)
  • Revision ID: james.westby@ubuntu.com-20110717002450-ytg3wsrc1ptd3153
Tags: 3.3.1-1
* New upstream release.
 - Required libpt-dev 2.10 and libopal-dev 3.10
* Fix debian/watch to catch new version
* Remove libnotify0.7.patch - included upstream
* Add libboost-dev and libboost-signals-dev to Build-Depends
* debian/rules: Don't install *.la files for new internal shared libs
* Fix Vcs URIs to point to correct desktop/experimental/ekiga tree

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
 
 
2
/* Ekiga -- A VoIP and Video-Conferencing application
 
3
 * Copyright (C) 2000-2009 Damien Sandras <dsandras@seconix.com>
 
4
 *
 
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.
 
9
 *
 
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.
 
14
 *
 
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.
 
18
 *
 
19
 *
 
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.
 
26
 */
 
27
 
 
28
 
 
29
/*
 
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.
 
35
 *
 
36
 */
 
37
 
 
38
 
 
39
#ifndef _SIP_ENDPOINT_H_
 
40
#define _SIP_ENDPOINT_H_
 
41
 
 
42
#include <opal/opal.h>
 
43
 
 
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"
 
51
#include "runtime.h"
 
52
#include "services.h"
 
53
 
 
54
#include "opal-call-manager.h"
 
55
 
 
56
namespace Opal {
 
57
 
 
58
  namespace Sip {
 
59
 
 
60
    class EndPoint : public SIPEndPoint,
 
61
                     public Ekiga::Service,
 
62
                     public Ekiga::CallProtocolManager,
 
63
                     public Ekiga::PresentityDecorator,
 
64
                     public Ekiga::ContactDecorator
 
65
    {
 
66
      PCLASSINFO(EndPoint, SIPEndPoint);
 
67
 
 
68
    public:
 
69
 
 
70
      typedef std::list<std::string> domain_list;
 
71
      typedef std::list<std::string>::iterator domain_list_iterator;
 
72
 
 
73
      EndPoint (CallManager& ep,
 
74
                Ekiga::ServiceCore& core,
 
75
                unsigned listen_port);
 
76
 
 
77
      ~EndPoint ();
 
78
 
 
79
      /* Service */
 
80
      const std::string get_name () const
 
81
      { return "opal-sip-endpoint"; }
 
82
 
 
83
      const std::string get_description () const
 
84
      { return "\tObject managing SIP objects with the Opal library"; }
 
85
 
 
86
      /* ContactDecorator and PresentityDecorator */
 
87
      bool populate_menu (Ekiga::ContactPtr contact,
 
88
                          const std::string uri,
 
89
                          Ekiga::MenuBuilder &builder);
 
90
 
 
91
      bool populate_menu (Ekiga::PresentityPtr presentity,
 
92
                          const std::string uri,
 
93
                          Ekiga::MenuBuilder & builder);
 
94
 
 
95
      bool menu_builder_add_actions (const std::string & fullname,
 
96
                                     const std::string& uri,
 
97
                                     Ekiga::MenuBuilder & builder);
 
98
 
 
99
 
 
100
      /* Chat subsystem */
 
101
      bool send_message (const std::string & uri,
 
102
                         const std::string & message);
 
103
 
 
104
 
 
105
      /* CallProtocolManager */
 
106
      bool dial (const std::string & uri);
 
107
 
 
108
      const std::string & get_protocol_name () const;
 
109
 
 
110
      void set_dtmf_mode (unsigned mode);
 
111
      unsigned get_dtmf_mode () const;
 
112
 
 
113
      bool set_listen_port (unsigned port);
 
114
      const Ekiga::CallProtocolManager::Interface& get_listen_interface () const;
 
115
 
 
116
 
 
117
      /* SIP EndPoint */
 
118
      void set_nat_binding_delay (unsigned delay);
 
119
      unsigned get_nat_binding_delay ();
 
120
 
 
121
      void set_outbound_proxy (const std::string & uri);
 
122
      const std::string & get_outbound_proxy () const;
 
123
 
 
124
      void set_forward_uri (const std::string & uri);
 
125
      const std::string & get_forward_uri () const;
 
126
 
 
127
 
 
128
      /* AccountSubscriber */
 
129
      bool subscribe (const Opal::Account & account);
 
130
      bool unsubscribe (const Opal::Account & account);
 
131
 
 
132
 
 
133
      /* Helper */
 
134
      static std::string get_aor_domain (const std::string & aor);
 
135
 
 
136
 
 
137
      /* OPAL Methods */
 
138
      void Register (const std::string username,
 
139
                     const std::string host,
 
140
                     const std::string auth_username,
 
141
                     const std::string password,
 
142
                     bool is_enabled,
 
143
                     bool is_limited, /* limited registrar = which do not accept
 
144
                                 extra contact addresses, such as private ones*/
 
145
                     unsigned timeout);
 
146
 
 
147
      void OnRegistered (const PString & aor,
 
148
                         bool wasRegistering);
 
149
 
 
150
      void OnRegistrationFailed (const PString & aor,
 
151
                                 SIP_PDU::StatusCodes reason,
 
152
                                 bool wasRegistering);
 
153
 
 
154
      void OnMWIReceived (const PString & party,
 
155
                          OpalManager::MessageWaitingType type,
 
156
                          const PString & info);
 
157
 
 
158
      bool OnIncomingConnection (OpalConnection &connection,
 
159
                                 unsigned options,
 
160
                                 OpalConnection::StringOptions * stroptions);
 
161
 
 
162
      void OnDialogInfoReceived (const SIPDialogNotification & info);
 
163
 
 
164
      PBoolean OnReceivedINVITE (OpalTransport & transport, SIP_PDU * pdu);
 
165
 
 
166
      bool OnReceivedMESSAGE (OpalTransport & transport,
 
167
                              SIP_PDU & pdu);
 
168
 
 
169
      void OnMESSAGECompleted (const SIPMessage::Params & params,
 
170
                               SIP_PDU::StatusCodes reason);
 
171
 
 
172
      SIPURL GetRegisteredPartyName (const SIPURL & host,
 
173
                                     const OpalTransport & transport);
 
174
 
 
175
 
 
176
      /* Callbacks */
 
177
    private:
 
178
      void on_dial (std::string uri);
 
179
      void on_message (std::string uri,
 
180
                       std::string name);
 
181
      void on_transfer (std::string uri);
 
182
 
 
183
      void on_bank_updated (Ekiga::AccountPtr account);
 
184
 
 
185
      bool visit_accounts (Ekiga::AccountPtr account);
 
186
 
 
187
      void registration_event_in_main (const std::string aor,
 
188
                                       Account::RegistrationState state,
 
189
                                       const std::string msg);
 
190
 
 
191
      void presence_status_in_main (std::string uri,
 
192
                                    std::string presence,
 
193
                                    std::string status);
 
194
 
 
195
      void push_message_in_main (const std::string uri,
 
196
                                 const std::string name,
 
197
                                 const std::string msg);
 
198
 
 
199
      void push_notice_in_main (const std::string uri,
 
200
                                const std::string name,
 
201
                                const std::string msg);
 
202
 
 
203
      void mwi_received_in_main (const std::string aor,
 
204
                                 const std::string info);
 
205
 
 
206
      PMutex aorMutex;
 
207
      std::map<std::string, std::string> accounts;
 
208
 
 
209
      CallManager & manager;
 
210
      Ekiga::ServiceCore & core;
 
211
 
 
212
      std::map<std::string, PString> publications;
 
213
 
 
214
      Ekiga::CallProtocolManager::Interface listen_iface;
 
215
 
 
216
      std::string protocol_name;
 
217
      std::string uri_prefix;
 
218
      std::string forward_uri;
 
219
      std::string outbound_proxy;
 
220
 
 
221
      unsigned listen_port;
 
222
      bool auto_answer_call;
 
223
 
 
224
      boost::shared_ptr<SIP::Dialect> dialect;
 
225
    };
 
226
  };
 
227
};
 
228
#endif