SIPEndPoint Class Reference

#include <sipep.h>

Inheritance diagram for SIPEndPoint:

OpalEndPoint List of all members.

Public Types

 None
 Options
 EmptyRequest
 NumMethods
enum  NATBindingRefreshMethod { None, Options, EmptyRequest, NumMethods }

Public Member Functions

PSafePtr< SIPConnectionGetSIPConnectionWithLock (const PString &token, PSafetyMode mode=PSafeReadWrite)
virtual BOOL IsAcceptedAddress (const SIPURL &toAddr)
virtual void OnMessageReceived (const SIPURL &from, const PString &body)
BOOL Register (const PString &host, const PString &username=PString::Empty(), const PString &autName=PString::Empty(), const PString &password=PString::Empty(), const PString &authRealm=PString::Empty(), int timeout=0)
virtual void OnMWIReceived (const PString &host, const PString &user, SIPMWISubscribe::MWIType type, const PString &msgs)
BOOL MWISubscribe (const PString &host, const PString &username, int timeout=0)
virtual void OnRegistrationFailed (const PString &host, const PString &userName, SIP_PDU::StatusCodes reason, BOOL wasRegistering)
virtual void OnRegistered (const PString &host, const PString &userName, BOOL wasRegistering)
BOOL IsRegistered (const PString &host)
unsigned GetRegistrationsCount ()
BOOL IsSubscribed (const PString &host, const PString &user)
BOOL Unregister (const PString &host, const PString &user)
BOOL MWIUnsubscribe (const PString &host, const PString &user)
virtual void OnMessageFailed (const SIPURL &messageUrl, SIP_PDU::StatusCodes reason)
void SetMIMEForm (BOOL v)
BOOL GetMIMEForm () const
void SetMaxRetries (unsigned r)
unsigned GetMaxRetries () const
void SetRetryTimeouts (const PTimeInterval &t1, const PTimeInterval &t2)
const PTimeInterval & GetRetryTimeoutMin () const
const PTimeInterval & GetRetryTimeoutMax () const
void SetNonInviteTimeout (const PTimeInterval &t)
const PTimeInterval & GetNonInviteTimeout () const
void SetPduCleanUpTimeout (const PTimeInterval &t)
const PTimeInterval & GetPduCleanUpTimeout () const
void SetInviteTimeout (const PTimeInterval &t)
const PTimeInterval & GetInviteTimeout () const
void SetAckTimeout (const PTimeInterval &t)
const PTimeInterval & GetAckTimeout () const
void SetRegistrarTimeToLive (const PTimeInterval &t)
const PTimeInterval & GetRegistrarTimeToLive () const
void SetNotifierTimeToLive (const PTimeInterval &t)
const PTimeInterval & GetNotifierTimeToLive () const
void SetNATBindingTimeout (const PTimeInterval &t)
const PTimeInterval & GetNATBindingTimeout () const
void AddTransaction (SIPTransaction *transaction)
void RemoveTransaction (SIPTransaction *transaction)
unsigned GetNextCSeq ()
BOOL GetAuthentication (const PString &authRealm, SIPAuthentication &)
virtual SIPURL GetRegisteredPartyName (const PString &)
virtual SIPURL GetDefaultRegisteredPartyName ()
SIPURL GetLocalURL (const OpalTransport &transport, const PString &userName=PString::Empty())
const SIPURLGetProxy () const
void SetProxy (const SIPURL &url)
void SetProxy (const PString &hostname, const PString &username, const PString &password)
virtual PString GetUserAgent () const
void SetUserAgent (const PString &str)
BOOL SendMessage (const SIPURL &url, const PString &body)
void SetNATBindingRefreshMethod (const NATBindingRefreshMethod m)
Construction
 SIPEndPoint (OpalManager &manager)
 ~SIPEndPoint ()
Overrides from OpalEndPoint
virtual PStringArray GetDefaultListeners () const
virtual BOOL NewIncomingConnection (OpalTransport *transport)
virtual BOOL MakeConnection (OpalCall &call, const PString &party, void *userData=NULL)
virtual OpalMediaFormatList GetMediaFormats () const
Customisation call backs
virtual SIPConnectionCreateConnection (OpalCall &call, const PString &token, void *userData, const SIPURL &destination, OpalTransport *transport, SIP_PDU *invite)
virtual BOOL SetupTransfer (const PString &token, const PString &callIdentity, const PString &remoteParty, void *userData=NULL)
virtual BOOL ForwardConnection (SIPConnection &connection, const PString &forwardParty)
Protocol handling routines
OpalTransportCreateTransport (const OpalTransportAddress &address)
virtual void HandlePDU (OpalTransport &transport)
virtual BOOL OnReceivedPDU (OpalTransport &transport, SIP_PDU *pdu)
virtual void OnReceivedResponse (SIPTransaction &transaction, SIP_PDU &response)
virtual BOOL OnReceivedINVITE (OpalTransport &transport, SIP_PDU *pdu)
virtual void OnReceivedAuthenticationRequired (SIPTransaction &transaction, SIP_PDU &response)
virtual void OnReceivedOK (SIPTransaction &transaction, SIP_PDU &response)
virtual BOOL OnReceivedNOTIFY (OpalTransport &transport, SIP_PDU &response)
virtual void OnReceivedMESSAGE (OpalTransport &transport, SIP_PDU &response)
virtual void OnRTPStatistics (const SIPConnection &connection, const RTP_Session &session) const

Protected Member Functions

 PDECLARE_NOTIFIER (PThread, SIPEndPoint, TransportThreadMain)
 PDECLARE_NOTIFIER (PTimer, SIPEndPoint, NATBindingRefresh)
 PDECLARE_NOTIFIER (PTimer, SIPEndPoint, RegistrationRefresh)
BOOL TransmitSIPInfo (SIP_PDU::Methods method, const PString &host, const PString &username, const PString &authName=PString::Empty(), const PString &password=PString::Empty(), const PString &authRealm=PString::Empty(), const PString &body=PString::Empty(), int timeout=0)
BOOL TransmitSIPUnregistrationInfo (const PString &host, const PString &username, SIP_PDU::Methods method)
void ParsePartyName (const PString &remoteParty, PString &party)
 Parsed party name, after e164 lookup.

Static Protected Member Functions

static BOOL WriteSIPInfo (OpalTransport &transport, void *info)

Protected Attributes

SIPURL proxy
PString userAgentString
BOOL mimeForm
unsigned maxRetries
PTimeInterval retryTimeoutMin
PTimeInterval retryTimeoutMax
PTimeInterval nonInviteTimeout
PTimeInterval pduCleanUpTimeout
PTimeInterval inviteTimeout
PTimeInterval ackTimeout
PTimeInterval registrarTimeToLive
PTimeInterval notifierTimeToLive
PTimeInterval natBindingTimeout
RegistrationList activeSIPInfo
PTimer registrationTimer
SIPTransactionList messages
SIPTransactionDict transactions
PTimer natBindingTimer
NATBindingRefreshMethod natMethod
PMutex transactionsMutex
PMutex connectionsActiveInUse
unsigned lastSentCSeq

Classes

class  RegistrationList

Detailed Description

Session Initiation Protocol endpoint.


Member Enumeration Documentation

enum SIPEndPoint::NATBindingRefreshMethod

NAT Binding Refresh Method

Enumerator:
None 
Options 
EmptyRequest 
NumMethods 


Constructor & Destructor Documentation

SIPEndPoint::SIPEndPoint ( OpalManager manager  ) 

Create a new endpoint.

SIPEndPoint::~SIPEndPoint (  ) 

Destroy endpoint.


Member Function Documentation

void SIPEndPoint::AddTransaction ( SIPTransaction transaction  )  [inline]

virtual SIPConnection* SIPEndPoint::CreateConnection ( OpalCall call,
const PString &  token,
void *  userData,
const SIPURL destination,
OpalTransport transport,
SIP_PDU invite 
) [virtual]

Create a connection for the SIP endpoint. The default implementation is to create a OpalSIPConnection.

Parameters:
call  Owner of connection
token  token used to identify connection
userData  User data for connection
destination  Destination for outgoing call
transport  Transport INVITE has been received on
invite  Original INVITE pdu

OpalTransport* SIPEndPoint::CreateTransport ( const OpalTransportAddress address  ) 

virtual BOOL SIPEndPoint::ForwardConnection ( SIPConnection connection,
const PString &  forwardParty 
) [virtual]

Forward the connection using the same token as the specified connection. Return TRUE if the connection is being redirected.

Parameters:
connection  Connection to be forwarded
forwardParty  Remote party to forward to

const PTimeInterval& SIPEndPoint::GetAckTimeout (  )  const [inline]

BOOL SIPEndPoint::GetAuthentication ( const PString &  authRealm,
SIPAuthentication  
)

Return the SIPAuthentication for a specific realm.

virtual PStringArray SIPEndPoint::GetDefaultListeners (  )  const [virtual]

Get the default listeners for the endpoint type. Overrides the default behaviour to return udp and tcp listeners.

Reimplemented from OpalEndPoint.

virtual SIPURL SIPEndPoint::GetDefaultRegisteredPartyName (  )  [virtual]

Return the default registered party name URL.

const PTimeInterval& SIPEndPoint::GetInviteTimeout (  )  const [inline]

SIPURL SIPEndPoint::GetLocalURL ( const OpalTransport transport,
const PString &  userName = PString::Empty() 
)

Return the local URL for the given transport and user name. That URL can be used as via address, and as contact field in outgoing requests.

The URL is translated if required.

If the transport is not running, the first listener transport will be used, if any.

Parameters:
transport  Transport on which we can receive new requests
userName  The user name part of the contact field

unsigned SIPEndPoint::GetMaxRetries (  )  const [inline]

virtual OpalMediaFormatList SIPEndPoint::GetMediaFormats (  )  const [virtual]

Get the data formats this endpoint is capable of operating. This provides a list of media data format names that may be used by an OpalMediaStream may be created by a connection from this endpoint.

Note that a specific connection may not actually support all of the media formats returned here, but should return no more.

The default behaviour is pure.

Implements OpalEndPoint.

BOOL SIPEndPoint::GetMIMEForm (  )  const [inline]

const PTimeInterval& SIPEndPoint::GetNATBindingTimeout (  )  const [inline]

unsigned SIPEndPoint::GetNextCSeq (  )  [inline]

Return the next CSEQ for the next transaction.

const PTimeInterval& SIPEndPoint::GetNonInviteTimeout (  )  const [inline]

const PTimeInterval& SIPEndPoint::GetNotifierTimeToLive (  )  const [inline]

const PTimeInterval& SIPEndPoint::GetPduCleanUpTimeout (  )  const [inline]

const SIPURL& SIPEndPoint::GetProxy (  )  const [inline]

Return the outbound proxy URL, if any.

virtual SIPURL SIPEndPoint::GetRegisteredPartyName ( const PString &   )  [virtual]

Return the registered party name URL for the given host.

That URL can be used in the FORM field of the PDU's. The host part can be different from the registration domain.

const PTimeInterval& SIPEndPoint::GetRegistrarTimeToLive (  )  const [inline]

unsigned SIPEndPoint::GetRegistrationsCount (  )  [inline]

Returns the number of registered accounts.

const PTimeInterval& SIPEndPoint::GetRetryTimeoutMax (  )  const [inline]

const PTimeInterval& SIPEndPoint::GetRetryTimeoutMin (  )  const [inline]

PSafePtr<SIPConnection> SIPEndPoint::GetSIPConnectionWithLock ( const PString &  token,
PSafetyMode  mode = PSafeReadWrite 
) [inline]

Find a connection that uses the specified token. This searches the endpoint for the connection that contains the token as provided by functions such as MakeConnection().

Parameters:
token  Token to identify connection

virtual PString SIPEndPoint::GetUserAgent (  )  const [virtual]

Get the User Agent for this endpoint.

virtual void SIPEndPoint::HandlePDU ( OpalTransport transport  )  [virtual]

virtual BOOL SIPEndPoint::IsAcceptedAddress ( const SIPURL toAddr  )  [virtual]

BOOL SIPEndPoint::IsRegistered ( const PString &  host  ) 

Returns TRUE if the given URL has been registered (e.g.: 6001@seconix.com).

BOOL SIPEndPoint::IsSubscribed ( const PString &  host,
const PString &  user 
)

Returns TRUE if subscribed to the given host for MWI.

virtual BOOL SIPEndPoint::MakeConnection ( OpalCall call,
const PString &  party,
void *  userData = NULL 
) [virtual]

Set up a connection to a remote party. This is called from the OpalManager::MakeConnection() function once it has determined that this is the endpoint for the protocol.

The general form for this party parameter is:

[proto:][alias@][transport$]address[:port]

where the various fields will have meanings specific to the endpoint type. For example, with H.323 it could be "h323:Fred@site.com" which indicates a user Fred at gatekeeper size.com. Whereas for the PSTN endpoint it could be "pstn:5551234" which is to call 5551234 on the first available PSTN line.

The proto field is optional when passed to a specific endpoint. If it is present, however, it must agree with the endpoints protocol name or FALSE is returned.

This function usually returns almost immediately with the connection continuing to occur in a new background thread.

If FALSE is returned then the connection could not be established. For example if a PSTN endpoint is used and the assiciated line is engaged then it may return immediately. Returning a non-NULL value does not mean that the connection will succeed, only that an attempt is being made.

The default behaviour is pure.

Parameters:
call  Owner of connection
party  Remote party to call
userData  Arbitrary data to pass to connection

Implements OpalEndPoint.

BOOL SIPEndPoint::MWISubscribe ( const PString &  host,
const PString &  username,
int  timeout = 0 
)

Subscribe to a notifier. This function is asynchronous to permit several subscripttions to occur at the same time.

BOOL SIPEndPoint::MWIUnsubscribe ( const PString &  host,
const PString &  user 
)

Unsubscribe from a notifier. This function is synchronous.

virtual BOOL SIPEndPoint::NewIncomingConnection ( OpalTransport transport  )  [virtual]

Handle new incoming connection from listener.

The default behaviour does nothing.

Parameters:
transport  Transport connection came in on

Reimplemented from OpalEndPoint.

virtual void SIPEndPoint::OnMessageFailed ( const SIPURL messageUrl,
SIP_PDU::StatusCodes  reason 
) [virtual]

Callback called when a message sent by the endpoint didn't reach its destination or when the proxy or remote endpoint returns an error code.

virtual void SIPEndPoint::OnMessageReceived ( const SIPURL from,
const PString &  body 
) [virtual]

Callback called when MWI is received

virtual void SIPEndPoint::OnMWIReceived ( const PString &  host,
const PString &  user,
SIPMWISubscribe::MWIType  type,
const PString &  msgs 
) [virtual]

Callback called when MWI is received

virtual void SIPEndPoint::OnReceivedAuthenticationRequired ( SIPTransaction transaction,
SIP_PDU response 
) [virtual]

Handle an incoming Proxy Authentication Required response PDU

virtual BOOL SIPEndPoint::OnReceivedINVITE ( OpalTransport transport,
SIP_PDU pdu 
) [virtual]

Handle an incoming INVITE request.

virtual void SIPEndPoint::OnReceivedMESSAGE ( OpalTransport transport,
SIP_PDU response 
) [virtual]

Handle an incoming MESSAGE PDU.

virtual BOOL SIPEndPoint::OnReceivedNOTIFY ( OpalTransport transport,
SIP_PDU response 
) [virtual]

Handle an incoming NOTIFY PDU.

virtual void SIPEndPoint::OnReceivedOK ( SIPTransaction transaction,
SIP_PDU response 
) [virtual]

Handle an incoming OK response PDU. This actually gets any PDU of the class 2xx not just 200.

virtual BOOL SIPEndPoint::OnReceivedPDU ( OpalTransport transport,
SIP_PDU pdu 
) [virtual]

Handle an incoming SIP PDU that has been full decoded

virtual void SIPEndPoint::OnReceivedResponse ( SIPTransaction transaction,
SIP_PDU response 
) [virtual]

Handle an incoming response PDU.

virtual void SIPEndPoint::OnRegistered ( const PString &  host,
const PString &  userName,
BOOL  wasRegistering 
) [virtual]

Callback called when a registration or an unregistration is successful. The BOOL indicates if the operation that failed was a registration or not.

virtual void SIPEndPoint::OnRegistrationFailed ( const PString &  host,
const PString &  userName,
SIP_PDU::StatusCodes  reason,
BOOL  wasRegistering 
) [virtual]

Callback called when a registration to a SIP registrars fails. The BOOL indicates if the operation that failed was a REGISTER or an (UN)REGISTER.

virtual void SIPEndPoint::OnRTPStatistics ( const SIPConnection connection,
const RTP_Session session 
) const [virtual]

Callback from the RTP session for statistics monitoring. This is called every so many packets on the transmitter and receiver threads of the RTP session indicating that the statistics have been updated.

The default behaviour does nothing.

Parameters:
connection  Connection for the channel
session  Session with statistics

void SIPEndPoint::ParsePartyName ( const PString &  remoteParty,
PString &  party 
) [protected]

Parsed party name, after e164 lookup.

Parameters:
remoteParty  Party name string.

SIPEndPoint::PDECLARE_NOTIFIER ( PTimer  ,
SIPEndPoint  ,
RegistrationRefresh   
) [protected]

SIPEndPoint::PDECLARE_NOTIFIER ( PTimer  ,
SIPEndPoint  ,
NATBindingRefresh   
) [protected]

SIPEndPoint::PDECLARE_NOTIFIER ( PThread  ,
SIPEndPoint  ,
TransportThreadMain   
) [protected]

BOOL SIPEndPoint::Register ( const PString &  host,
const PString &  username = PString::Empty(),
const PString &  autName = PString::Empty(),
const PString &  password = PString::Empty(),
const PString &  authRealm = PString::Empty(),
int  timeout = 0 
)

Register to a registrar. This function is asynchronous to permit several registrations to occur at the same time. It can be called several times for different hosts and users.

The username can be of the form user. In that case, the From field will be set to that value.

The realm can be specified when registering, this will allow to find the correct authentication information when being requested. If no realm is specified, authentication will occur with the "best guess" of authentication parameters.

void SIPEndPoint::RemoveTransaction ( SIPTransaction transaction  )  [inline]

BOOL SIPEndPoint::SendMessage ( const SIPURL url,
const PString &  body 
)

Send a message to the given URL.

void SIPEndPoint::SetAckTimeout ( const PTimeInterval &  t  )  [inline]

void SIPEndPoint::SetInviteTimeout ( const PTimeInterval &  t  )  [inline]

void SIPEndPoint::SetMaxRetries ( unsigned  r  )  [inline]

void SIPEndPoint::SetMIMEForm ( BOOL  v  )  [inline]

void SIPEndPoint::SetNATBindingRefreshMethod ( const NATBindingRefreshMethod  m  )  [inline]

Set the NAT Binding Refresh Method

void SIPEndPoint::SetNATBindingTimeout ( const PTimeInterval &  t  )  [inline]

void SIPEndPoint::SetNonInviteTimeout ( const PTimeInterval &  t  )  [inline]

void SIPEndPoint::SetNotifierTimeToLive ( const PTimeInterval &  t  )  [inline]

void SIPEndPoint::SetPduCleanUpTimeout ( const PTimeInterval &  t  )  [inline]

void SIPEndPoint::SetProxy ( const PString &  hostname,
const PString &  username,
const PString &  password 
)

Set the outbound proxy URL.

void SIPEndPoint::SetProxy ( const SIPURL url  ) 

Set the outbound proxy URL.

void SIPEndPoint::SetRegistrarTimeToLive ( const PTimeInterval &  t  )  [inline]

void SIPEndPoint::SetRetryTimeouts ( const PTimeInterval &  t1,
const PTimeInterval &  t2 
) [inline]

virtual BOOL SIPEndPoint::SetupTransfer ( const PString &  token,
const PString &  callIdentity,
const PString &  remoteParty,
void *  userData = NULL 
) [virtual]

Setup a connection transfer a connection for the SIP endpoint.

Parameters:
token  Existing connection to be transferred
callIdentity  Call identity of the secondary call (if it exists)
remoteParty  Remote party to transfer the existing call to
userData  user data to pass to CreateConnection

void SIPEndPoint::SetUserAgent ( const PString &  str  )  [inline]

Set the User Agent for the endpoint.

BOOL SIPEndPoint::TransmitSIPInfo ( SIP_PDU::Methods  method,
const PString &  host,
const PString &  username,
const PString &  authName = PString::Empty(),
const PString &  password = PString::Empty(),
const PString &  authRealm = PString::Empty(),
const PString &  body = PString::Empty(),
int  timeout = 0 
) [protected]

BOOL SIPEndPoint::TransmitSIPUnregistrationInfo ( const PString &  host,
const PString &  username,
SIP_PDU::Methods  method 
) [protected]

BOOL SIPEndPoint::Unregister ( const PString &  host,
const PString &  user 
)

Unregister from a registrar. This function is synchronous.

static BOOL SIPEndPoint::WriteSIPInfo ( OpalTransport transport,
void *  info 
) [static, protected]


Member Data Documentation

PTimeInterval SIPEndPoint::ackTimeout [protected]

RegistrationList SIPEndPoint::activeSIPInfo [protected]

PMutex SIPEndPoint::connectionsActiveInUse [protected]

PTimeInterval SIPEndPoint::inviteTimeout [protected]

unsigned SIPEndPoint::lastSentCSeq [protected]

unsigned SIPEndPoint::maxRetries [protected]

SIPTransactionList SIPEndPoint::messages [protected]

BOOL SIPEndPoint::mimeForm [protected]

PTimeInterval SIPEndPoint::natBindingTimeout [protected]

PTimer SIPEndPoint::natBindingTimer [protected]

NATBindingRefreshMethod SIPEndPoint::natMethod [protected]

PTimeInterval SIPEndPoint::nonInviteTimeout [protected]

PTimeInterval SIPEndPoint::notifierTimeToLive [protected]

PTimeInterval SIPEndPoint::pduCleanUpTimeout [protected]

SIPURL SIPEndPoint::proxy [protected]

PTimeInterval SIPEndPoint::registrarTimeToLive [protected]

PTimer SIPEndPoint::registrationTimer [protected]

PTimeInterval SIPEndPoint::retryTimeoutMax [protected]

PTimeInterval SIPEndPoint::retryTimeoutMin [protected]

SIPTransactionDict SIPEndPoint::transactions [protected]

PMutex SIPEndPoint::transactionsMutex [protected]

PString SIPEndPoint::userAgentString [protected]


The documentation for this class was generated from the following file:
Generated on Mon Sep 25 16:21:54 2006 for OPAL by  doxygen 1.4.7