Yate
SDPSession Class Referenceabstract

A holder for a SDP session. More...

#include <yatesdp.h>

Public Types

enum  { MediaMissing , MediaStarted , MediaMuted }
 

Public Member Functions

 SDPSession (SDPParser *parser)
 
 SDPSession (SDPParser *parser, NamedList &params)
 
virtual ~SDPSession ()
 
const StringgetHost () const
 
const StringgetRtpAddr () const
 
bool setMedia (ObjList *media, bool preserveExisting=false)
 
void putMedia (NamedList &msg, bool putPort=true)
 
SDPMediagetMedia (const String &name) const
 
void setRfc2833 (const String &value)
 
void setRfc2833 (const String *value)
 
bool dispatchRtp (SDPMedia *media, const char *addr, bool start, bool pick, RefObject *context=0)
 
bool dispatchRtp (const char *addr, bool start, RefObject *context=0)
 
bool startRtp (RefObject *context=0)
 
bool updateSDP (const NamedList &params, bool defaults=true)
 
bool updateRtpSDP (const NamedList &params)
 
MimeSdpBody * createSDP (const char *addr, ObjList *mediaList=0)
 
MimeSdpBody * createSDP ()
 
MimeSdpBody * createPasstroughSDP (NamedList &msg, bool update=true, bool allowEmptyAddr=false)
 
MimeSdpBody * createRtpSDP (const char *addr, const NamedList &msg)
 
MimeSdpBody * createRtpSDP (const char *addr, bool start)
 
MimeSdpBody * createRtpSDP (bool start)
 
void updateFormats (const NamedList &msg, bool changeMedia=false)
 
bool addSdpParams (NamedList &msg, const MimeBody *body)
 
bool addSdpParams (NamedList &msg, const String &rawSdp)
 
bool addRtpParams (NamedList &msg, const String &natAddr=String::empty(), const MimeBody *body=0, bool force=false, bool allowEmptyAddr=false)
 
virtual void resetSdp (bool all=true)
 
virtual Message * buildChanRtp (SDPMedia *media, const char *addr, bool start, RefObject *context)
 
virtual Message * buildChanRtp (RefObject *context)=0
 
bool localRtpChanged () const
 
void setLocalRtpChanged (bool chg=false)
 

Static Public Member Functions

static void putMedia (NamedList &msg, ObjList *media, bool putPort=true)
 
static ObjListupdateRtpSDP (const NamedList &params, String &rtpAddr, ObjList *oldList=0, bool allowEmptyAddr=false)
 

Protected Member Functions

virtual void mediaChanged (const SDPMedia &media)
 
virtual void dispatchingRtp (Message *&msg, SDPMedia *media)
 
void setSdpDebug (DebugEnabler *enabler=0, void *ptr=0, const String &traceId=String::empty())
 
void printRtpMedia (const char *reason)
 
void setFormatsExtra (const NamedList &list, bool out)
 

Protected Attributes

SDPParserm_parser
 
int m_mediaStatus
 
bool m_rtpForward
 
bool m_sdpForward
 
String m_originAddr
 
String m_externalAddr
 
String m_rtpAddr
 
String m_rtpLocalAddr
 
String m_rtpNatAddr
 
ObjListm_rtpMedia
 
int m_sdpSession
 
int m_sdpVersion
 
unsigned int m_sdpHash
 
String m_host
 
bool m_secure
 
int m_rfc2833
 
bool m_ipv6
 
NamedList m_amrExtra
 

Detailed Description

A holder for a SDP session.

This class holds RTP/SDP data for multiple media types NOTE: The SDPParser pointer held by this class is assumed to be non NULL

Member Enumeration Documentation

◆ anonymous enum

anonymous enum

RTP media status enumeration

Constructor & Destructor Documentation

◆ SDPSession() [1/2]

SDPSession ( SDPParser * parser)

Constructor

Parameters
parserThe SDP parser whose data this object will use

◆ SDPSession() [2/2]

SDPSession ( SDPParser * parser,
NamedList & params )

Constructor

Parameters
parserThe SDP parser whose data this object will use
paramsSDP session parameters

◆ ~SDPSession()

virtual ~SDPSession ( )
virtual

Destructor. Reset the object

Member Function Documentation

◆ addRtpParams()

bool addRtpParams ( NamedList & msg,
const String & natAddr = String::empty(),
const MimeBody * body = 0,
bool force = false,
bool allowEmptyAddr = false )

Add RTP forwarding parameters to a message (media and address)

Parameters
msgDestination list
natAddrOptional NAT address if detected
bodyPointer to the body to extract raw SDP from
forceTrue to override RTP forward flag
allowEmptyAddrAllow empty address in parameters (default: false)
Returns
True if RTP data was added. Media is always added if present and remote address is not empty

References String::empty().

◆ addSdpParams() [1/2]

bool addSdpParams ( NamedList & msg,
const MimeBody * body )

Add raw SDP forwarding parameter from body if SDP forward is enabled

Parameters
msgDestination list
bodyMime body to process
Returns
True if the parameter was added

◆ addSdpParams() [2/2]

bool addSdpParams ( NamedList & msg,
const String & rawSdp )

Add raw SDP forwarding parameter if SDP forward is enabled

Parameters
msgDestination list
rawSdpThe raw sdp content
Returns
True if the parameter was added

◆ buildChanRtp() [1/2]

virtual Message * buildChanRtp ( RefObject * context)
pure virtual

Build a chan.rtp message without media information

Parameters
contextPointer to reference counted user provided context
Returns
The message with user data set but no media information

◆ buildChanRtp() [2/2]

virtual Message * buildChanRtp ( SDPMedia * media,
const char * addr,
bool start,
RefObject * context )
virtual

Build a chan.rtp message and populate with media information

Parameters
mediaThe media list
addrRemote RTP address
startTrue to request RTP start
contextPointer to reference counted user provided context
Returns
The message with media information, NULL if media or addr are missing

◆ createPasstroughSDP()

MimeSdpBody * createPasstroughSDP ( NamedList & msg,
bool update = true,
bool allowEmptyAddr = false )

Creates a SDP from RTP address data present in message. Use the raw SDP if present.

Parameters
msgThe list of parameters
updateTrue to update RTP/SDP data if raw SDP is not found in the list
allowEmptyAddrAllow empty address in parameters (default: false)
Returns
MimeSdpBody pointer or 0

◆ createRtpSDP() [1/3]

MimeSdpBody * createRtpSDP ( bool start)
inline

Creates a set of started external RTP channels from remote addr and builds SDP from them

Parameters
startTrue to create a started RTP
Returns
MimeSdpBody pointer or 0

References createRtpSDP(), and createSDP().

◆ createRtpSDP() [2/3]

MimeSdpBody * createRtpSDP ( const char * addr,
bool start )
inline

Creates a set of RTP channels from address and media info and builds SDP from them

Parameters
addrRemote RTP address used when dispatching the chan.rtp message
startTrue to create a started RTP
Returns
MimeSdpBody pointer or 0

References createSDP(), dispatchRtp(), and getRtpAddr().

◆ createRtpSDP() [3/3]

MimeSdpBody * createRtpSDP ( const char * addr,
const NamedList & msg )
inline

Creates a set of unstarted external RTP channels from remote addr and builds SDP from them

Parameters
addrRemote RTP address used when dispatching the chan.rtp message
msgList of parameters used to update data
Returns
MimeSdpBody pointer or 0

References createRtpSDP(), and updateSDP().

Referenced by createRtpSDP(), and createRtpSDP().

◆ createSDP() [1/2]

MimeSdpBody * createSDP ( )

Creates a SDP body for current media status

Returns
MimeSdpBody pointer or 0 if media is missing

◆ createSDP() [2/2]

MimeSdpBody * createSDP ( const char * addr,
ObjList * mediaList = 0 )

Creates a SDP body from transport address and list of media descriptors

Parameters
addrThe address to set. Use own host if empty
mediaListOptional media list. Use own list if the given one is 0
Returns
MimeSdpBody pointer or 0 if there is no media to set

Referenced by createRtpSDP(), and createRtpSDP().

◆ dispatchingRtp()

virtual void dispatchingRtp ( Message *& msg,
SDPMedia * media )
protectedvirtual

Dispatch rtp notification. This method is called before dispatching the message. Clear the message to stop dispatch

Parameters
msgMessage to dispatch
mediaMedia for which the message is going to be dispatched

◆ dispatchRtp() [1/2]

bool dispatchRtp ( const char * addr,
bool start,
RefObject * context = 0 )

Calls dispatchRtp() for each media in the list Update it on success. Remove it on failure

Parameters
addrRemote RTP address
startTrue to request RTP start
contextPointer to user provided context, optional
Returns
True if the message was succesfully handled for at least one media

◆ dispatchRtp() [2/2]

bool dispatchRtp ( SDPMedia * media,
const char * addr,
bool start,
bool pick,
RefObject * context = 0 )

Build and dispatch a chan.rtp message for a given media. Update media on success

Parameters
mediaThe media to use
addrRemote RTP address
startTrue to request RTP start
pickTrue to update local parameters (other then media) from returned message
contextPointer to user provided context, optional
Returns
True if the message was succesfully handled

Referenced by createRtpSDP().

◆ getHost()

const String & getHost ( ) const
inline

Get RTP local host

Returns
RTP local host

◆ getMedia()

SDPMedia * getMedia ( const String & name) const
inline

Retrieve a single media description

Parameters
nameName of the media to retrieve
Returns
Pointer to media descriptor, NULL if no such media set

◆ getRtpAddr()

const String & getRtpAddr ( ) const
inline

Get local RTP address

Returns
Local RTP address (external or local)

Referenced by createRtpSDP().

◆ localRtpChanged()

bool localRtpChanged ( ) const

Check if local RTP data changed for at least one media

Returns
True if local RTP data changed for at least one media

◆ mediaChanged()

virtual void mediaChanged ( const SDPMedia & media)
protectedvirtual

Media changed notification. This method is called when setting new media and an old one changed

Parameters
mediaOld media that changed

◆ printRtpMedia()

void printRtpMedia ( const char * reason)
protected

Print current media to output

Parameters
reasonReason to print

◆ putMedia() [1/2]

void putMedia ( NamedList & msg,
bool putPort = true )
inline

Put session media parameters into a list of parameters

Parameters
msgDestination list
putPortTrue to add the media port

References putMedia().

◆ putMedia() [2/2]

static void putMedia ( NamedList & msg,
ObjList * media,
bool putPort = true )
static

Put specified media parameters into a list of parameters

Parameters
msgDestination list
mediaList of SDP media information
putPortTrue to add the media port

Referenced by putMedia().

◆ resetSdp()

virtual void resetSdp ( bool all = true)
virtual

Reset this object to default values

Parameters
allTrue to reset all parameters including configuration

◆ setFormatsExtra()

void setFormatsExtra ( const NamedList & list,
bool out )
protected

Set extra parameters for formats

Parameters
listList of parameters
outTrue if session is outgoing, false otherwise

◆ setLocalRtpChanged()

void setLocalRtpChanged ( bool chg = false)

Set or reset the local RTP data changed flag for all media

Parameters
chgThe new value for local RTP data changed flag of all media

◆ setMedia()

bool setMedia ( ObjList * media,
bool preserveExisting = false )

Set a new media list

Parameters
mediaNew media list
preserveExistingTry to preserve existing started media
Returns
True if media changed

◆ setRfc2833() [1/2]

void setRfc2833 ( const String & value)

Update the RFC 2833 availability and payload

Parameters
valueString to get payload or availability

Referenced by setRfc2833().

◆ setRfc2833() [2/2]

void setRfc2833 ( const String * value)
inline

Update the RFC 2833 availability and payload

Parameters
valuePointer to string to get payload or availability

References setRfc2833().

◆ setSdpDebug()

void setSdpDebug ( DebugEnabler * enabler = 0,
void * ptr = 0,
const String & traceId = String::empty() )
protected

Set data used in debug

Parameters
enablerThe DebugEnabler to use (0 to to use the parser)
ptrPointer to print, 0 to use the session pointer
traceIdTrace ID to use for debugging

References String::empty().

◆ startRtp()

bool startRtp ( RefObject * context = 0)

Try to start RTP (calls dispatchRtp()) for each media in the list

Parameters
contextPointer to user provided context, optional
Returns
True if at least one media was started

◆ updateFormats()

void updateFormats ( const NamedList & msg,
bool changeMedia = false )

Update media format lists from parameters

Parameters
msgParameter list
changeMediaTrue to update media list if required

◆ updateRtpSDP() [1/2]

bool updateRtpSDP ( const NamedList & params)

Update RTP/SDP data from parameters

Parameters
paramsList of parameters to update from
Returns
True if media or local address changed

◆ updateRtpSDP() [2/2]

static ObjList * updateRtpSDP ( const NamedList & params,
String & rtpAddr,
ObjList * oldList = 0,
bool allowEmptyAddr = false )
static

Update RTP/SDP data from parameters

Parameters
paramsParameter list
rtpAddrString to be filled with rtp address from the list
oldListOptional existing media list (found media will be removed from it and added to the returned list
allowEmptyAddrAllow empty address in parameters (default: false)
Returns
List of media or 0 if not found or rtpAddr is empty

◆ updateSDP()

bool updateSDP ( const NamedList & params,
bool defaults = true )

Update from parameters and optionally build a default SDP.

Parameters
paramsList of parameters to update from
defaultsBuild a default SDP from parser formats if no media is found in params
Returns
True if media changed

Referenced by createRtpSDP().


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