# OpalRTPConnection Class Reference

`#include <rtpconn.h>`

Inheritance diagram for OpalRTPConnection:

List of all members.

## Public Member Functions

virtual void | AttachRFC2833HandlerToPatch (PBoolean isSource, OpalMediaPatch &patch)
virtual PBoolean | SendUserInputTone (char tone, unsigned duration=0)
virtual PBoolean | GetMediaInformation (unsigned sessionID, MediaInformation &info) const
virtual PBoolean | IsMediaBypassPossible (unsigned sessionID) const
virtual OpalMediaStream * | CreateMediaStream (const OpalMediaFormat &mediaFormat, unsigned sessionID, PBoolean isSource)
virtual void | OnPatchMediaStream (PBoolean isSource, OpalMediaPatch &patch)
virtual void | SetSecurityMode (const PString &v)
virtual PString | GetSecurityMode () const
virtual void * | GetSecurityData ()
virtual void | SetSecurityData (void *data)
void | OnMediaCommand (OpalMediaCommand &command, INT extra)
| PDECLARE_NOTIFIER (OpalRFC2833Info, OpalRTPConnection, OnUserInputInlineRFC2833)
| PDECLARE_NOTIFIER (OpalRFC2833Info, OpalRTPConnection, OnUserInputInlineCiscoNSE)
RTP Session Management
virtual RTP_Session * | GetSession (unsigned sessionID) const
virtual RTP_Session * | UseSession (const OpalTransport &transport, unsigned sessionID, const OpalMediaType &mediatype, RTP_QOS *rtpqos=NULL)
virtual void | ReleaseSession (unsigned sessionID, PBoolean clearAll=PFalse)
virtual RTP_Session * | CreateSession (const OpalTransport &transport, unsigned sessionID, RTP_QOS *rtpqos)
virtual PBoolean | RemoteIsNAT () const
virtual PBoolean | IsRTPNATEnabled (const PIPSocket::Address &localAddr, const PIPSocket::Address &peerAddr, const PIPSocket::Address &signalAddr, PBoolean incoming)

## Protected Attributes

PString | securityMode
void * | securityData
OpalRTPSessionManager | m_rtpSessions
OpalRFC2833Proto * | rfc2833Handler
OpalRFC2833Proto * | ciscoNSEHandler
PBoolean | remoteIsNAT
PBoolean | useRTPAggregation

## Classes

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.

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 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 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.

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

Release the session.

Parameters:

  sessionID | RTP session number
  clearAll | Clear all sessions

virtual RTP_Session* OpalRTPConnection::CreateSession | ( | const OpalTransport & | transport,
|  | unsigned | sessionID,
|  | 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 PBoolean OpalRTPConnection::RemoteIsNAT | ( |  | ) | const`[inline, virtual]`

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

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

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 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 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 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 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 void OpalRTPConnection::OnPatchMediaStream | ( | PBoolean | isSource,
|  | OpalMediaPatch & | patch |
| ) |  |  | `[virtual]`

Overrides from OpalConnection

Reimplemented from OpalConnection.

virtual void OpalRTPConnection::SetSecurityMode | ( | const PString & | v | ) | `[inline, virtual]`

virtual PString OpalRTPConnection::GetSecurityMode | ( |  | ) | const`[inline, virtual]`

virtual void* OpalRTPConnection::GetSecurityData | ( |  | ) | `[virtual]`

virtual void OpalRTPConnection::SetSecurityData | ( | void * | data | ) | `[virtual]`

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

Reimplemented in H323Connection, and SIPConnection.

OpalRTPConnection::PDECLARE_NOTIFIER | ( | OpalRFC2833Info | ,
|  | OpalRTPConnection | ,
|  | OnUserInputInlineRFC2833 |  |
| ) |  |  |

OpalRTPConnection::PDECLARE_NOTIFIER | ( | OpalRFC2833Info | ,
|  | OpalRTPConnection | ,
|  | OnUserInputInlineCiscoNSE |  |
| ) |  |  |

## Member Data Documentation

PString OpalRTPConnection::securityMode `[protected]`

void* OpalRTPConnection::securityData `[protected]`

OpalRTPSessionManager OpalRTPConnection::m_rtpSessions `[protected]`

OpalRFC2833Proto* OpalRTPConnection::rfc2833Handler `[protected]`

OpalRFC2833Proto* OpalRTPConnection::ciscoNSEHandler `[protected]`

PBoolean OpalRTPConnection::remoteIsNAT `[protected]`

PBoolean OpalRTPConnection::useRTPAggregation `[protected]`

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

- rtpconn.h