# class RTPSession | Full RTP session. More...
Full name | `TelEngine::RTPSession`
Definition | `#include <libs/yrtp/yatertp.h>`
Inherits | TelEngine::Mutex [public ], TelEngine::UDPSession [public ]
List of all Methods
Annotated List
Files
Globals
Hierarchy
Index

#### Public Types

- enum Direction { FullStop = 0, RecvOnly = 1, SendOnly = 2, SendRecv = 3 }

#### Public Methods

- RTPSession ()
- virtual ~RTPSession ()
- virtual void getStats (String& stats) const
- virtual void rtpData (const void* data, int len)
- virtual void rtcpData (const void* data, int len)
- virtual bool rtpRecvData (bool marker, unsigned int timestamp, const void* data, int len)
- virtual bool rtpRecvEvent (int event, char key, int duration, int volume, unsigned int timestamp)
- virtual void rtpNewPayload (int payload, unsigned int timestamp)
- virtual void rtpNewSSRC (u_int32_t newSsrc, bool marker)
- virtual RTPSender* createSender ()
- virtual RTPReceiver* createReceiver ()
- virtual Cipher* createCipher (const String& name, Cipher::Direction dir)
- virtual bool checkCipher (const String& name)
- inline bool rtpSend (bool marker, int payload, unsigned int timestamp, const void* data, int len)
- inline bool rtpSendData (bool marker, unsigned int timestamp, const void* data, int len)
- inline bool rtpSendEvent (int event, int duration, int volume = 0, unsigned int timestamp = 0)
- inline bool rtpSendKey (char key, int duration, int volume = 0, unsigned int timestamp = 0)
- inline u_int32_t ioPacketsLost () const
- inline int padding () const
- inline bool padding (int chunk)
- inline void setDejitter (unsigned int mindelay = 20, unsigned int maxdelay = 50)
- virtual void transport (RTPTransport* trans)
- inline RTPSender* sender () const
- void sender (RTPSender* send)
- inline RTPReceiver* receiver () const
- void receiver (RTPReceiver* recv)
- inline Direction direction () const
- bool direction (Direction dir)
- inline bool addDirection (Direction dir)
- inline bool delDirection (Direction dir)
- bool dataPayload (int type)
- bool eventPayload (int type)
- bool silencePayload (int type)
- inline bool localAddr (SocketAddr& addr, bool rtcp = true)
- inline RTPSecure* security () const
- void security (RTPSecure* secure)
- void setReports (int interval)
- virtual void getStats (NamedList& stats) const
- virtual void incWrongSrc ()
- inline void setWarnSeq (bool on)

#### Protected Methods

- virtual void timerTick (const Time& when)
- void sendRtcpReport (const Time& when)
- void sendRtcpBye ()

## Detailed Description

An unidirectional or bidirectional RTP session

enum Direction { FullStop = 0, RecvOnly = 1, SendOnly = 2, SendRecv = 3 } | ### Direction

Direction of the session

RTPSession () | ### RTPSession

Default constructor, creates a detached session

~RTPSession () | ### ~RTPSession

[virtual]

Destructor - shuts down the session and destroys the transport

void getStats (String& stats) | ### getStats

[const virtual]

Retrieve MGCP P: style comma separated session parameters

Parameters:

stats | String to append parameters to

Reimplemented from RTPProcessor.

void rtpData (const void* data, int len) | ### rtpData

[virtual]

This method is called to process a RTP packet.

Parameters:

data | Pointer to raw RTP data
len | Length of the data packet

Reimplemented from RTPProcessor.

void rtcpData (const void* data, int len) | ### rtcpData

[virtual]

This method is called to process a RTCP packet.

Parameters:

data | Pointer to raw RTCP data
len | Length of the data packet

Reimplemented from RTPProcessor.

bool rtpRecvData (bool marker, unsigned int timestamp, const void* data, int len) | ### rtpRecvData

[virtual]

Process one RTP data packet

Parameters:

marker | Set to true if the marker bit is set
timestamp | Sampling instant of the packet data
data | Pointer to data block to process
len | Length of the data block in bytes

Returns: True if data was handled

bool rtpRecvEvent (int event, char key, int duration, int volume, unsigned int timestamp) | ### rtpRecvEvent

[virtual]

Process one RTP event

Parameters:

event | Received event code
key | Received key (for events 0-16) or zero
duration | Duration of the event as number of samples
volume | Attenuation of the tone, zero for don't care
timestamp | Sampling instant of the initial packet data

Returns: True if data was handled

void rtpNewPayload (int payload, unsigned int timestamp) | ### rtpNewPayload

[virtual]

Method called for unknown payload types just before attempting to call rtpRecvData(). This is a good opportunity to change the payload type and continue.

Parameters:

payload | Payload number
timestamp | Sampling instant of the unexpected packet data

void rtpNewSSRC (u_int32_t newSsrc, bool marker) | ### rtpNewSSRC

[virtual]

Method called when a packet with an unexpected SSRC is received just before processing further. This is a good opportunity to change the SSRC and continue

Parameters:

newSsrc | SSRC received in packet
marker | True if marker bit is set in the RTP packet

RTPSender* createSender () | ### createSender

[virtual]

Create a new RTP sender for this session. Override this method to create objects derived from RTPSender.

Returns: Pointer to the new sender or NULL on failure

RTPReceiver* createReceiver () | ### createReceiver

[virtual]

Create a new RTP receiver for this session. Override this method to create objects derived from RTPReceiver.

Returns: Pointer to the new receiver or NULL on failure

Cipher* createCipher (const String& name, Cipher::Direction dir) | ### createCipher

[virtual]

Create a cipher when required for SRTP

Parameters:

name | Name of the cipher to create
dir | Direction the cipher must be able to handle

Returns: Pointer to newly allocated Cipher or NULL

bool checkCipher (const String& name) | ### checkCipher

[virtual]

Check if a cipher is supported for SRTP

Parameters:

name | Name of the cipher to check

Returns: True if the specified cipher is supported

inline bool rtpSend (bool marker, int payload, unsigned int timestamp, const void* data, int len) | ### rtpSend

Send one RTP payload packet

Parameters:

marker | Set to true if the marker bit must be set
payload | Payload number
timestamp | Sampling instant of the packet data
data | Pointer to data block to send
len | Length of the data block

Returns: True if data sending was attempted

inline bool rtpSendData (bool marker, unsigned int timestamp, const void* data, int len) | ### rtpSendData

Send one RTP data packet

Parameters:

marker | Set to true if the marker bit must be set
timestamp | Sampling instant of the packet data
data | Pointer to data block to send
len | Length of the data block

Returns: True if data sending was attempted

inline bool rtpSendEvent (int event, int duration, int volume = 0, unsigned int timestamp = 0) | ### rtpSendEvent

Send one RTP event

Parameters:

event | Event code to send
duration | Duration of the event as number of samples
volume | Attenuation of the tone, zero for don't care
timestamp | Sampling instant of the packet data, zero to use current

Returns: True if data sending was attempted

inline bool rtpSendKey (char key, int duration, int volume = 0, unsigned int timestamp = 0) | ### rtpSendKey

Send one RTP key event

Parameters:

key | Key to send
duration | Duration of the event as number of samples
volume | Attenuation of the tone, zero for don't care
timestamp | Sampling instant of the packet data, zero to use current

Returns: True if data sending was attempted

inline u_int32_t ioPacketsLost () | ### ioPacketsLost

[const]

Retrieve the number of lost packets in current received

Returns: Number of packets in sequence gaps

inline int padding () | ### padding

[const]

Get the payload padding size

Returns: Chunk size to pad the payload to a multiple of

inline bool padding (int chunk) | ### padding

Set the padding to a multiple of a data chunk

Parameters:

chunk | Size to pad the payload to a multiple of

Returns: True if the new chunk size is valid

inline void setDejitter (unsigned int mindelay = 20, unsigned int maxdelay = 50) | ### setDejitter

Allocate and set a new dejitter buffer for the receiver in the session

Parameters:

mindelay | Minimum length of the dejitter buffer in microseconds
maxdelay | Maximum length of the dejitter buffer in microseconds

void transport (RTPTransport* trans) | ### transport

[virtual]

Set the RTP/RTCP transport of data handled by this session

Parameters:

trans | A pointer to the new RTPTransport for this session

Reimplemented from UDPSession.

inline RTPSender* sender () | ### sender

[const]

Get the RTP/RTCP sender of this session

Returns: A pointer to the RTPSender of this session

void sender (RTPSender* send) | ### sender

Set the RTP/RTCP sender of this session

Parameters:

send | A pointer to the new RTPSender of this session or NULL

inline RTPReceiver* receiver () | ### receiver

[const]

Get the RTP/RTCP receiver of this session

Returns: A pointer to the RTPReceiver of this session

void receiver (RTPReceiver* recv) | ### receiver

Set the RTP/RTCP receiver of this session

Parameters:

recv | A pointer to the new RTPReceiver of this session or NULL

inline Direction direction () | ### direction

[const]

Get the direction of this session

Returns: Session's direction as a Direction enum

bool direction (Direction dir) | ### direction

Set the direction of this session. A transport must exist for this method to succeed.

Parameters:

dir | New Direction for this session

Returns: True if direction was set, false if a failure occured

inline bool addDirection (Direction dir) | ### addDirection

Add a direction of this session. A transport must exist for this method to succeed.

Parameters:

dir | New Direction to add for this session

Returns: True if direction was set, false if a failure occured

inline bool delDirection (Direction dir) | ### delDirection

Delete a direction of this session. A transport must exist for this method to succeed.

Parameters:

dir | Direction to remove for this session

Returns: True if direction was set, false if a failure occured

bool dataPayload (int type) | ### dataPayload

Set the data payload type for both receiver and sender.

Parameters:

type | Payload type, -1 to disable

Returns: True if changed, false if invalid payload type

bool eventPayload (int type) | ### eventPayload

Set the event payload type for both receiver and sender.

Parameters:

type | Payload type, -1 to disable

Returns: True if changed, false if invalid payload type

bool silencePayload (int type) | ### silencePayload

Set the silence payload type for both receiver and sender.

Parameters:

type | Payload type, -1 to disable

Returns: True if changed, false if invalid payload type

inline bool localAddr (SocketAddr& addr, bool rtcp = true) | ### localAddr

Set the local network address of the RTP transport of this session

Parameters:

addr | New local RTP transport address
rtcp | Enable RTCP in this session

Returns: True if address set, false if a failure occured

inline RTPSecure* security () | ### security

[const]

Get the stored security provider or of the sender

Returns: A pointer to the RTPSecure or NULL

void security (RTPSecure* secure) | ### security

Store a security provider for the sender

Parameters:

secure | Pointer to the new RTPSecure or NULL

void setReports (int interval) | ### setReports

Set the RTCP report interval

Parameters:

interval | Average interval between reports in msec, zero to disable

void getStats (NamedList& stats) | ### getStats

[const virtual]

Put the collected statistical data

Parameters:

stats | NamedList to populate with the data

Reimplemented from RTPProcessor.

void incWrongSrc () | ### incWrongSrc

[virtual]

Increase the counter for number of RTP packets received from a wrong source

Reimplemented from RTPProcessor.

inline void setWarnSeq (bool on) | ### setWarnSeq

Set the packet with invalid sequence warn mode

Parameters:

on | True to show a message at DebugWarn level, false to show at DebugInfo level

void timerTick (const Time& when) | ### timerTick

[protected virtual]

Method called periodically to push any asynchronous data or statistics

Parameters:

when | Time to use as base in all computing

Reimplemented from RTPProcessor.

void sendRtcpReport (const Time& when) | ### sendRtcpReport

[protected]

Send a RTCP report

Parameters:

when | Time to use as base for timestamps

void sendRtcpBye () | ### sendRtcpBye

[protected]

Send a RTCP BYE when the sender is stopped or replaced

Generated by: paulc on bussard on Mon Feb 10 13:15:47 2014, using kdoc 2.0a54.