OpalRTPConnection Class Reference

#include <rtpconn.h>

Inheritance diagram for OpalRTPConnection:

OpalConnection H323Connection SIPConnection

Public Member Functions

virtual void AttachRFC2833HandlerToPatch (PBoolean isSource, OpalMediaPatch &patch)
virtual PBoolean SendUserInputTone (char tone, unsigned duration=0)
virtual void SessionFailing (RTP_Session &session)
Construction
 OpalRTPConnection (OpalCall &call, OpalRTPEndPoint &endpoint, const PString &token, unsigned options=0, OpalConnection::StringOptions *stringOptions=NULL)
 ~OpalRTPConnection ()
RTP Session Management
virtual unsigned GetNextSessionID (const OpalMediaType &mediaType, bool isSource)
virtual RTP_SessionGetSession (unsigned sessionID) const
virtual OpalMediaSessionGetMediaSession (unsigned sessionID) const
virtual RTP_UDPFindSessionByLocalPort (WORD port) const
virtual RTP_SessionUseSession (const OpalTransport &transport, unsigned sessionID, const OpalMediaType &mediatype, RTP_QOS *rtpqos=NULL)
virtual void ReleaseSession (unsigned sessionID, PBoolean clearAll=PFalse)
virtual RTP_SessionCreateSession (const OpalTransport &transport, unsigned sessionID, const OpalMediaType &mediaType, RTP_QOS *rtpqos)
virtual RTP_UDPCreateRTPSession (unsigned sessionId, const OpalMediaType &mediaType, bool remoteIsNat)
virtual bool ChangeSessionID (unsigned fromSessionID, unsigned toSessionID)
NAT Management
virtual PBoolean RemoteIsNAT () const
virtual PBoolean IsRTPNATEnabled (const PIPSocket::Address &localAddr, const PIPSocket::Address &peerAddr, const PIPSocket::Address &signalAddr, PBoolean incoming)
Overrides from OpalConnection
virtual PBoolean GetMediaInformation (unsigned sessionID, MediaInformation &info) const
virtual PBoolean IsMediaBypassPossible (unsigned sessionID) const
virtual OpalMediaStreamCreateMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
virtual void AdjustMediaFormats (bool local, OpalMediaFormatList &mediaFormats, OpalConnection *otherConnection) const
virtual void OnPatchMediaStream (PBoolean isSource, OpalMediaPatch &patch)
void OnMediaCommand (OpalMediaCommand &command, INT extra)

Protected Member Functions

 PDECLARE_NOTIFIER (OpalRFC2833Info, OpalRTPConnection, OnUserInputInlineRFC2833)
 PDECLARE_NOTIFIER (OpalRFC2833Info, OpalRTPConnection, OnUserInputInlineCiscoNSE)

Protected Attributes

list< OpalRTPSessionManager * > m_allSessions
OpalRTPSessionManager m_rtpSessions
OpalRFC2833Protorfc2833Handler
PBoolean remoteIsNAT
PBoolean useRTPAggregation

Friends

class OpalRTPSessionManager

Data Structures

struct  MediaInformation

Detailed Description

This is the base class for OpalConnections that use RTP sessions, such as H.323 and SIPconnections to an endpoint.


Constructor & Destructor Documentation

OpalRTPConnection::OpalRTPConnection ( OpalCall call,
OpalRTPEndPoint endpoint,
const PString &  token,
unsigned  options = 0,
OpalConnection::StringOptions stringOptions = NULL 
)

Create a new connection.

Parameters:
call  Owner calll for connection
endpoint  Owner endpoint for connection
token  Token to identify the connection
options  Connection options
stringOptions  more complex options

OpalRTPConnection::~OpalRTPConnection (  ) 

Destroy connection.


Member Function Documentation

virtual void OpalRTPConnection::AdjustMediaFormats ( bool  local,
OpalMediaFormatList mediaFormats,
OpalConnection otherConnection 
) const [virtual]

Adjust media formats available on a connection. This is called by a connection after it has called OpalCall::GetMediaFormats() to get all media formats that it can use so that an application may remove or reorder the media formats before they are used to open media streams.

This function may also be executed to adjust the media format list for other connections in the call. If this happens then the "otherConnection" parameter will be non-NULL.

The default behaviour calls the OpalEndPoint function of the same name.

Parameters:
local  Media formats a local ones to be presented to remote
mediaFormats  Media formats to use
otherConnection  Other connection we are adjusting media for

Reimplemented from OpalConnection.

virtual void OpalRTPConnection::AttachRFC2833HandlerToPatch ( PBoolean  isSource,
OpalMediaPatch patch 
) [virtual]

Attaches the RFC 2833 handler to the media patch This method may be called from subclasses, e.g. within OnPatchMediaStream()

Reimplemented from OpalConnection.

virtual bool OpalRTPConnection::ChangeSessionID ( unsigned  fromSessionID,
unsigned  toSessionID 
) [virtual]

Change the sessionID for an existing session. This will adjust the RTP session and media streams.

Return false if no such session exists.

Parameters:
fromSessionID  Session ID to search for
toSessionID  Session ID to change to

virtual OpalMediaStream* OpalRTPConnection::CreateMediaStream ( const OpalMediaFormat mediaFormat,
unsigned  sessionID,
PBoolean  isSource 
) [virtual]

Create a new media stream. This will create a media stream of an appropriate subclass as required by the underlying connection protocol. For instance H.323 would create an OpalRTPStream.

The sessionID parameter may not be needed by a particular media stream and may be ignored. In the case of an OpalRTPStream it us used.

Note that media streams may be created internally to the underlying protocol. This function is not the only way a stream can come into existance.

Parameters:
mediaFormat  Media format for stream
sessionID  Session number for stream
isSource  Is a source stream

Reimplemented from OpalConnection.

virtual RTP_UDP* OpalRTPConnection::CreateRTPSession ( unsigned  sessionId,
const OpalMediaType mediaType,
bool  remoteIsNat 
) [virtual]

Create a new underlying RTP session instance.

virtual RTP_Session* OpalRTPConnection::CreateSession ( const OpalTransport transport,
unsigned  sessionID,
const OpalMediaType mediaType,
RTP_QOS rtpqos 
) [virtual]

Create and open a new RTP session. The type of RTP session that is created will be compatible with the transport. At this time only IP (RTP over UDP) is supported.

virtual RTP_UDP* OpalRTPConnection::FindSessionByLocalPort ( WORD  port  )  const [virtual]

Find an RTP session for the specified local port. If there is no session, NULL is returned.

Parameters:
port  Local port number

virtual PBoolean OpalRTPConnection::GetMediaInformation ( unsigned  sessionID,
MediaInformation info 
) const [virtual]

Get information on the media channel for the connection. The default behaviour checked the mediaTransportAddresses dictionary for the session ID and returns information based on that. It also uses the rfc2833Handler variable for that part of the info.

It is up to the descendant class to assure that the mediaTransportAddresses dictionary is set correctly before OnIncomingCall() is executed.

Parameters:
sessionID  Session ID for media channel
info  Information on media channel

virtual OpalMediaSession* OpalRTPConnection::GetMediaSession ( unsigned  sessionID  )  const [virtual]

Parameters:
sessionID  RTP session number

virtual unsigned OpalRTPConnection::GetNextSessionID ( const OpalMediaType mediaType,
bool  isSource 
) [virtual]

Get next available session ID for the media type.

Parameters:
mediaType  Media type of stream being opened
isSource  Stream is a source/sink

Reimplemented from OpalConnection.

Reimplemented in H323Connection.

virtual RTP_Session* OpalRTPConnection::GetSession ( unsigned  sessionID  )  const [virtual]

Get an RTP session for the specified ID. If there is no session of the specified ID, NULL is returned.

Parameters:
sessionID  RTP session number

virtual PBoolean OpalRTPConnection::IsMediaBypassPossible ( unsigned  sessionID  )  const [virtual]

See if the media can bypass the local host.

The default behaviour returns PTrue if the session is audio or video.

Parameters:
sessionID  Session ID for media channel

Reimplemented from OpalConnection.

virtual PBoolean OpalRTPConnection::IsRTPNATEnabled ( const PIPSocket::Address &  localAddr,
const PIPSocket::Address &  peerAddr,
const PIPSocket::Address &  signalAddr,
PBoolean  incoming 
) [virtual]

Determine if the RTP session needs to accommodate a NAT router. For endpoints that do not use STUN or something similar to set up all the correct protocol embeddded addresses correctly when a NAT router is between the endpoints, it is possible to still accommodate the call, with some restrictions. This function determines if the RTP can proceed with special NAT allowances.

The special allowance is that the RTP code will ignore whatever the remote indicates in the protocol for the address to send RTP data and wait for the first packet to arrive from the remote and will then proceed to send all RTP data back to that address AND port.

The default behaviour checks the values of the physical link (localAddr/peerAddr) against the signaling address the remote indicated in the protocol, eg H.323 SETUP sourceCallSignalAddress or SIP "To" or "Contact" fields, and makes a guess that the remote is behind a NAT router.

Parameters:
localAddr  Local physical address of connection
peerAddr  Remote physical address of connection
signalAddr  Remotes signaling address as indicated by protocol of connection
incoming  Incoming/outgoing connection

void OpalRTPConnection::OnMediaCommand ( OpalMediaCommand command,
INT  extra 
)

Notifier function for OpalVideoUpdatePicture. Calls the SendIntraFrameRequest on the rtp session

Reimplemented in H323Connection, and SIPConnection.

virtual void OpalRTPConnection::OnPatchMediaStream ( PBoolean  isSource,
OpalMediaPatch patch 
) [virtual]

Call back when patching a media stream. This function is called when a connection has created a new media patch between two streams. This is usually called twice per media patch, once for the source stream and once for the sink stream.

Note this is not called within the context of the patch thread and is called before that thread has started.

Parameters:
isSource  Is source/sink call
patch  New patch

Reimplemented from OpalConnection.

OpalRTPConnection::PDECLARE_NOTIFIER ( OpalRFC2833Info  ,
OpalRTPConnection  ,
OnUserInputInlineCiscoNSE   
) [protected]

OpalRTPConnection::PDECLARE_NOTIFIER ( OpalRFC2833Info  ,
OpalRTPConnection  ,
OnUserInputInlineRFC2833   
) [protected]

virtual void OpalRTPConnection::ReleaseSession ( unsigned  sessionID,
PBoolean  clearAll = PFalse 
) [virtual]

Release the session.

Parameters:
sessionID  RTP session number
clearAll  Clear all sessions

virtual PBoolean OpalRTPConnection::RemoteIsNAT (  )  const [inline, virtual]

Return PTrue if the remote appears to be behind a NAT firewall

virtual PBoolean OpalRTPConnection::SendUserInputTone ( char  tone,
unsigned  duration = 0 
) [virtual]

Send a user input indication to the remote endpoint. This sends DTMF emulation user input. If something more sophisticated than the simple tones that can be sent using the SendUserInput() function.

A duration of zero indicates that no duration is to be indicated. A non-zero logical channel indicates that the tone is to be syncronised with the logical channel at the rtpTimestamp value specified.

The tone parameter must be one of "0123456789#*ABCD!" where '!' indicates a hook flash. If tone is a ' ' character then a signalUpdate PDU is sent that updates the last tone indication sent. See the H.245 specifcation for more details on this.

The default behaviour sends the tone using RFC2833.

Parameters:
tone  DTMF tone code
duration  Duration of tone in milliseconds

Reimplemented from OpalConnection.

Reimplemented in H323Connection, and SIPConnection.

virtual void OpalRTPConnection::SessionFailing ( RTP_Session session  )  [virtual]

virtual RTP_Session* OpalRTPConnection::UseSession ( const OpalTransport transport,
unsigned  sessionID,
const OpalMediaType mediatype,
RTP_QOS rtpqos = NULL 
) [virtual]

Use an RTP session for the specified ID. This will find a session of the specified ID and uses it if available.

If there is no session of the specified ID one is created.

The type of RTP session that is created will be compatible with the transport. At this time only IP (RTP over UDP) is supported.

Parameters:
transport  Transport of signalling
sessionID  RTP session number
mediatype  media type
rtpqos  Quiality of Service information

Reimplemented in H323Connection.


Friends And Related Function Documentation

friend class OpalRTPSessionManager [friend]


Field Documentation

list<OpalRTPSessionManager *> OpalRTPConnection::m_allSessions [protected]

OpalRTPSessionManager OpalRTPConnection::m_rtpSessions [protected]

PBoolean OpalRTPConnection::remoteIsNAT [protected]

OpalRFC2833Proto* OpalRTPConnection::rfc2833Handler [protected]

PBoolean OpalRTPConnection::useRTPAggregation [protected]


The documentation for this class was generated from the following file:
Generated on Mon Feb 21 20:19:24 2011 for OPAL by  doxygen 1.4.7