2
/* Ekiga -- A VoIP and Video-Conferencing application
3
* Copyright (C) 2000-2006 Damien Sandras
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_
43
#include "../../config.h"
50
PDICTIONARY (msgDict, PString, PString);
53
/* Minimal SIP endpoint implementation */
54
class GMSIPEndpoint : public SIPEndPoint
56
PCLASSINFO(GMSIPEndpoint, SIPEndPoint);
60
/* DESCRIPTION : The constructor.
61
* BEHAVIOR : Creates the H.323 Endpoint
62
* and initialises the variables
65
GMSIPEndpoint (GMManager &ep);
68
/* DESCRIPTION : The destructor.
76
* BEHAVIOR : Init the endpoint internal values and the various
84
* BEHAVIOR : Starts the listener thread on the port choosen
85
* in the options after having removed old listeners.
86
* returns TRUE if success and FALSE in case of error.
87
* PRE : The interface.
89
BOOL StartListener (PString iface,
94
* BEHAVIOR : Set the local user name following the firstname and last
95
* name stored by the conf.
98
void SetUserNameAndAlias ();
102
* BEHAVIOR : Adds the User Input Mode following the
103
* configuration options. Only RFC2833 is supported
107
void SetUserInputMode ();
110
/* DESCRIPTION : Called when the registration is successful.
111
* BEHAVIOR : Displays a message in the status bar and history.
114
void OnRegistered (const PString &domain,
115
const PString &username,
116
BOOL wasRegistering);
119
/* DESCRIPTION : Called when the registration fails.
120
* BEHAVIOR : Displays a message in the status bar and history.
123
void OnRegistrationFailed (const PString &host,
125
SIP_PDU::StatusCodes reason,
126
BOOL wasRegistering);
129
/* DESCRIPTION : Called when there is an incoming SIP connection.
130
* BEHAVIOR : Checks if the connection must be rejected or forwarded
131
* and call the manager function of the same name
132
* to update the GUI and take the appropriate action
133
* on the connection. If the connection is not forwarded,
134
* or rejected, OnShowIncoming will be called on the PCSS
135
* endpoint, allowing to auto-answer the call or do further
136
* updates of the GUI and internal timers.
139
BOOL OnIncomingConnection (OpalConnection &connection);
142
/* DESCRIPTION : Called when there is a MWI.
146
void OnMWIReceived (const PString & remoteAddress,
147
const PString & user,
148
SIPMWISubscribe::MWIType type,
149
const PString & msgs);
152
/* DESCRIPTION : Called when a message has been received.
153
* BEHAVIOR : Checks if we already received the message and call
157
virtual void OnReceivedMESSAGE (OpalTransport & transport,
161
/* DESCRIPTION : Called when a message has been received.
162
* BEHAVIOR : Updates the text chat window, updates the tray icon in
163
* flashing state if the text chat window is hidden.
166
void OnMessageReceived (const SIPURL & from,
167
const PString & body);
170
/* DESCRIPTION : Called when sending a message fails.
174
void OnMessageFailed (const SIPURL & messageUrl,
175
SIP_PDU::StatusCodes reason);
179
* BEHAVIOR : Returns the number of registered accounts.
182
int GetRegisteredAccounts ();
186
* BEHAVIOR : Returns the account to use for outgoing PDU's.
189
SIPURL GetRegisteredPartyName (const PString & host);
192
/* DESCRIPTION : This callback is called when the connection is
193
* established and everything is ok.
194
* BEHAVIOR : Stops the timers.
197
void OnEstablished (OpalConnection &);
200
/* DESCRIPTION : This callback is called when a connection to a remote
201
* endpoint is cleared.
202
* BEHAVIOR : Stops the timers.
205
void OnReleased (OpalConnection &);
210
/* DESCRIPTION : Notifier called when an incoming call
211
* has not been answered in the required time.
212
* BEHAVIOR : Reject the call, or forward if forward on no answer is
213
* enabled in the config database.
216
PDECLARE_NOTIFIER(PTimer, GMSIPEndpoint, OnNoAnswerTimeout);
218
PTimer NoAnswerTimer;
220
GMManager & endpoint;