OPAL  Version 3.18.8
OpalIMEndPoint Class Reference

#include <im_ep.h>

Inheritance diagram for OpalIMEndPoint:
Collaboration diagram for OpalIMEndPoint:

Public Member Functions

OpalIMContext::MessageDisposition OnRawMessageReceived (OpalIM &message, OpalConnection *connnection, PString &errorInfo)
 
OpalManagerGetManager () const
 
Construction
 OpalIMEndPoint (OpalManager &manager)
 
 ~OpalIMEndPoint ()
 
Overrides from OpalEndPoint
virtual PSafePtr< OpalConnectionMakeConnection (OpalCall &call, const PString &party, void *userData=NULL, unsigned int options=0, OpalConnection::StringOptions *stringOptions=NULL)
 
virtual OpalMediaFormatList GetMediaFormats () const
 
virtual PBoolean GarbageCollection ()
 
virtual void ShutDown ()
 
Context management
PSafePtr< OpalIMContextCreateContext (const PURL &localURL, const PURL &remoteURL, const char *scheme=NULL)
 
PSafePtr< OpalIMContextCreateContext (OpalCall &call)
 
void RemoveContext (OpalIMContext *context, bool byRemote)
 
PSafePtr< OpalIMContextFindContextByIdWithLock (const PString &key, PSafetyMode mode=PSafeReadWrite)
 
PSafePtr< OpalIMContextFindContextByNamesWithLock (const PURL &local, const PURL &remote, PSafetyMode mode=PSafeReadWrite)
 
PSafePtr< OpalIMContextFindContextForMessageWithLock (OpalIM &im, OpalConnection *conn=NULL)
 
- Public Member Functions inherited from OpalEndPoint
 P_DECLARE_BITWISE_ENUM (Attributes, 2,(NoAttributes, IsNetworkEndPoint, SupportsE164))
 
 OpalEndPoint (OpalManager &manager, const PCaselessString &prefix, Attributes attributes)
 
 ~OpalEndPoint ()
 
void PrintOn (ostream &strm) const
 
bool StartListeners (const PStringArray &interfaces, bool add=true)
 
virtual bool StartListener (const PString &address)
 
virtual bool StartListener (OpalListener *listener)
 
virtual PStringArray GetDefaultListeners () const
 
virtual PString GetDefaultTransport () const
 
virtual WORD GetDefaultSignalPort () const
 
OpalListenerFindListener (const OpalTransportAddress &iface)
 
bool FindListenerForProtocol (const char *proto, OpalTransportAddress &addr)
 
PBoolean StopListener (const OpalTransportAddress &iface)
 
PBoolean RemoveListener (OpalListener *listener)
 
OpalTransportAddressArray GetInterfaceAddresses (const OpalTransport *associatedTransport=NULL) const
 
 PDECLARE_AcceptHandlerNotifier (OpalEndPoint, NewIncomingConnection)
 
virtual void OnNewConnection (OpalCall &call, OpalConnection &connection)
 
virtual PBoolean OnSetUpConnection (OpalConnection &connection)
 
virtual PBoolean OnIncomingConnection (OpalConnection &connection, unsigned options, OpalConnection::StringOptions *stringOptions)
 
virtual void OnProceeding (OpalConnection &connection)
 
virtual void OnAlerting (OpalConnection &connection, bool withMedia)
 
virtual void OnAlerting (OpalConnection &connection)
 
virtual
OpalConnection::AnswerCallResponse 
OnAnswerCall (OpalConnection &connection, const PString &caller)
 
virtual void OnConnected (OpalConnection &connection)
 
virtual void OnEstablished (OpalConnection &connection)
 
virtual void OnReleased (OpalConnection &connection)
 
virtual void OnHold (OpalConnection &connection, bool fromRemote, bool onHold)
 
virtual void OnHold (OpalConnection &connection)
 
virtual PBoolean OnForwarded (OpalConnection &connection, const PString &remoteParty)
 
virtual bool OnTransferNotify (OpalConnection &connection, const PStringToString &info, const OpalConnection *transferringConnection)
 
virtual PBoolean ClearCall (const PString &token, OpalConnection::CallEndReason reason=OpalConnection::EndedByLocalUser, PSyncPoint *sync=NULL)
 
virtual PBoolean ClearCallSynchronous (const PString &token, OpalConnection::CallEndReason reason=OpalConnection::EndedByLocalUser, PSyncPoint *sync=NULL)
 
virtual void ClearAllCalls (OpalConnection::CallEndReason reason=OpalConnection::EndedByLocalUser, PBoolean wait=true)
 
PSafePtr< OpalConnectionGetConnectionWithLock (const PString &token, PSafetyMode mode=PSafeReadWrite) const
 
template<class ConnClass >
PSafePtr< ConnClass > GetConnectionWithLockAs (const PString &token, PSafetyMode mode=PSafeReadWrite) const
 
PStringList GetAllConnections ()
 
PINDEX GetConnectionCount () const
 
virtual PBoolean HasConnection (const PString &token)
 
virtual void DestroyConnection (OpalConnection *connection)
 
virtual void AdjustMediaFormats (bool local, const OpalConnection &connection, OpalMediaFormatList &mediaFormats) const
 
virtual bool GetMediaTransportAddresses (const OpalConnection &provider, const OpalConnection &consumer, unsigned sessionId, const OpalMediaType &mediaType, OpalTransportAddressArray &transports) const
 
virtual PBoolean OnOpenMediaStream (OpalConnection &connection, OpalMediaStream &stream)
 
virtual void OnClosedMediaStream (const OpalMediaStream &stream)
 
virtual void OnFailedMediaStream (OpalConnection &connection, bool fromRemote, const PString &reason)
 
void SetMediaCryptoSuites (const PStringArray &security)
 
PStringArray GetMediaCryptoSuites () const
 
virtual PStringArray GetAllMediaCryptoSuites () const
 
virtual void OnUserInputString (OpalConnection &connection, const PString &value)
 
virtual void OnUserInputTone (OpalConnection &connection, char tone, int duration)
 
virtual PString ReadUserInput (OpalConnection &connection, const char *terminators="#\r\n", unsigned lastDigitTimeout=4, unsigned firstDigitTimeout=30)
 
virtual PBoolean Message (const PString &to, const PString &body)
 
virtual PBoolean Message (const PURL &to, const PString &type, const PString &body, PURL &from, PString &conversationId)
 
virtual PBoolean Message (OpalIM &Message)
 
virtual void OnMessageReceived (const OpalIM &message)
 
virtual void OnMWIReceived (const PString &party, OpalManager::MessageWaitingType type, const PString &extraInfo)
 
virtual bool GetConferenceStates (OpalConferenceStates &states, const PString &name=PString::Empty()) const
 
virtual void OnConferenceStatusChanged (OpalEndPoint &endpoint, const PString &uri, OpalConferenceState::ChangeType change)
 
virtual PStringList GetNetworkURIs (const PString &name) const
 
OpalManagerGetManager () const
 
const PString & GetPrefixName () const
 
bool HasAttribute (Attributes opt) const
 
const OpalProductInfoGetProductInfo () const
 
void SetProductInfo (const OpalProductInfo &info)
 
const PString & GetDefaultLocalPartyName () const
 
virtual void SetDefaultLocalPartyName (const PString &name)
 
const PString & GetDefaultDisplayName () const
 
void SetDefaultDisplayName (const PString &name)
 
OpalBandwidth GetInitialBandwidth (OpalBandwidth::Direction dir) const
 
bool SetInitialBandwidth (OpalBandwidth::Direction dir, OpalBandwidth bandwidth)
 
const OpalListenerList & GetListeners () const
 
const
OpalConnection::StringOptions
GetDefaultStringOptions () const
 
void SetDefaultStringOptions (const OpalConnection::StringOptions &opts, bool overwrite=false)
 
void SetDefaultStringOption (const PCaselessString &key, const PString &data)
 
void RemoveDefaultStringOption (const PCaselessString &key)
 
virtual PStringList GetAvailableStringOptions () const
 
OpalConnection::SendUserInputModes GetSendUserInputMode () const
 
void SetSendUserInputMode (OpalConnection::SendUserInputModes mode)
 
const PIPSocket::QoS & GetSignalQoS () const
 
void SetSignalQoS (const PIPSocket::QoS &qos)
 
const PIPSocket::QoS & GetMediaQoS (const OpalMediaType &type) const
 
void SetMediaQoS (const OpalMediaType &type, const PIPSocket::QoS &qos)
 
PINDEX GetMaxSizeUDP () const
 
void SetMaxSizeUDP (PINDEX size)
 

Static Public Member Functions

static const PCaselessString & Prefix ()
 

Protected Types

typedef PSafeDictionary
< PString, OpalIMContext
ContextsByConversationId
 
typedef std::multimap< PString,
PString > 
ContextsByNames
 
typedef std::multimap< PString,
ConversationNotifier
ConversationMap
 

Protected Member Functions

PSafePtr< OpalIMContextInternalCreateContext (const PURL &localURL, const PURL &remoteURL, const char *scheme, bool byRemote, OpalCall *call, const char *conversationID)
 
 PDECLARE_MUTEX (m_contextsByNamesMutex)
 
 PDECLARE_MUTEX (m_notifierMutex)
 
- Protected Member Functions inherited from OpalEndPoint
OpalConnectionAddConnection (OpalConnection *connection)
 

Protected Attributes

OpalManagerm_manager
 
ContextsByConversationId m_contextsByConversationId
 
ContextsByNames m_contextsByNames
 
ConversationMap m_notifiers
 
PTime m_lastGarbageCollection
 
bool m_deleting
 
- Protected Attributes inherited from OpalEndPoint
OpalManagerm_manager
 
PCaselessString m_prefixName
 
Attributes m_attributes
 
PINDEX m_maxSizeUDP
 
OpalProductInfo m_productInfo
 
PString m_defaultLocalPartyName
 
PString m_defaultDisplayName
 
PStringArray m_mediaCryptoSuites
 
PIPSocket::QoS m_signalQoS
 
OpalManager::MediaQoSMap m_mediaQoS
 
OpalBandwidth m_initialRxBandwidth
 
OpalBandwidth m_initialTxBandwidth
 
OpalConnection::StringOptions m_defaultStringOptions
 
OpalConnection::SendUserInputModes m_defaultSendUserInputMode
 
OpalListenerList m_listeners
 
OpalEndPoint::ConnectionDict m_connectionsActive
 

Conversation notification

typedef PNotifierTemplate
< OpalIMContext::ConversationInfo
ConversationNotifier
 Type for converstaion notifiers. More...
 
virtual void OnConversation (const OpalIMContext::ConversationInfo &info)
 
void AddNotifier (const ConversationNotifier &notifier, const PString &scheme)
 
bool RemoveNotifier (const ConversationNotifier &notifier, const PString &scheme)
 

Detailed Description

Endpoint for IM connections.

Member Typedef Documentation

typedef PSafeDictionary<PString, OpalIMContext> OpalIMEndPoint::ContextsByConversationId
protected
typedef std::multimap<PString, PString> OpalIMEndPoint::ContextsByNames
protected
typedef std::multimap<PString, ConversationNotifier> OpalIMEndPoint::ConversationMap
protected

Type for converstaion notifiers.

Constructor & Destructor Documentation

OpalIMEndPoint::OpalIMEndPoint ( OpalManager manager)
OpalIMEndPoint::~OpalIMEndPoint ( )

Member Function Documentation

void OpalIMEndPoint::AddNotifier ( const ConversationNotifier notifier,
const PString &  scheme 
)

Set the notifier for the OnConversation() function. The notifier can be called only for when a specific scheme is being used. If scheme is "*" then all scemes will call that notifier.

More than one notifier can be applied and all are called.

Parameters
notifierNew notifier to add
schemeScheme to be notified about
PSafePtr<OpalIMContext> OpalIMEndPoint::CreateContext ( const PURL &  localURL,
const PURL &  remoteURL,
const char *  scheme = NULL 
)
inline

Create a Instant Messaging context based on URL scheme. This uses a factory to create an approriate concrete type for the protocol indicated by the scheme of the remoteURL.

The localURL may be empty and will be derived from the remoteURL and the default user name from the manager.

Parameters
localURLLocal URL for conversation
remoteURLRemote URL for conversation
schemeScheme to use, default to remoteURL.GetScheme()

References InternalCreateContext().

PSafePtr<OpalIMContext> OpalIMEndPoint::CreateContext ( OpalCall call)

Create a Instant Messaging context based on an existing call.

PSafePtr<OpalIMContext> OpalIMEndPoint::FindContextByIdWithLock ( const PString &  key,
PSafetyMode  mode = PSafeReadWrite 
)

Find a context given a key. Generally only used internally.

PSafePtr<OpalIMContext> OpalIMEndPoint::FindContextByNamesWithLock ( const PURL &  local,
const PURL &  remote,
PSafetyMode  mode = PSafeReadWrite 
)

Find a context given a from/to addresses. Generally only used internally.

PSafePtr<OpalIMContext> OpalIMEndPoint::FindContextForMessageWithLock ( OpalIM im,
OpalConnection conn = NULL 
)

Find a context given a message. Generally only used internally.

virtual PBoolean OpalIMEndPoint::GarbageCollection ( )
virtual

Look for old conversations and remove them. Generally only used internally. This will call notifiers indicating converstaion end.

Reimplemented from OpalEndPoint.

OpalManager& OpalIMEndPoint::GetManager ( ) const
inline

References m_manager.

virtual OpalMediaFormatList OpalIMEndPoint::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.

PSafePtr<OpalIMContext> OpalIMEndPoint::InternalCreateContext ( const PURL &  localURL,
const PURL &  remoteURL,
const char *  scheme,
bool  byRemote,
OpalCall call,
const char *  conversationID 
)
protected

Referenced by CreateContext().

virtual PSafePtr<OpalConnection> OpalIMEndPoint::MakeConnection ( OpalCall call,
const PString &  party,
void *  userData = NULL,
unsigned int  options = 0,
OpalConnection::StringOptions stringOptions = 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
callOwner of connection
partyRemote party to call
userDataArbitrary data to pass to connection
optionsOptions bit mask to pass to conneciton
stringOptionsOptions to pass to connection

Implements OpalEndPoint.

virtual void OpalIMEndPoint::OnConversation ( const OpalIMContext::ConversationInfo info)
virtual

Called when a context state changes, e.g. openign or closing. Default implementation calls the notifier, if set. If no notifier is set, then the OpalManager::OnConversation() function is called.

OpalIMContext::MessageDisposition OpalIMEndPoint::OnRawMessageReceived ( OpalIM message,
OpalConnection connnection,
PString &  errorInfo 
)
OpalIMEndPoint::PDECLARE_MUTEX ( m_contextsByNamesMutex  )
protected
OpalIMEndPoint::PDECLARE_MUTEX ( m_notifierMutex  )
protected
static const PCaselessString& OpalIMEndPoint::Prefix ( )
static
void OpalIMEndPoint::RemoveContext ( OpalIMContext context,
bool  byRemote 
)

Remove a new context. Generally only used internally. This will call notifiers indicating converstaion end.

bool OpalIMEndPoint::RemoveNotifier ( const ConversationNotifier notifier,
const PString &  scheme 
)

Remove notifier for the OnConversation() function.

virtual void OpalIMEndPoint::ShutDown ( )
virtual

Shut down all conversations.

Reimplemented from OpalEndPoint.

Field Documentation

ContextsByConversationId OpalIMEndPoint::m_contextsByConversationId
protected
ContextsByNames OpalIMEndPoint::m_contextsByNames
protected
bool OpalIMEndPoint::m_deleting
protected
PTime OpalIMEndPoint::m_lastGarbageCollection
protected
OpalManager& OpalIMEndPoint::m_manager
protected

Referenced by GetManager().

ConversationMap OpalIMEndPoint::m_notifiers
protected

The documentation for this class was generated from the following file: