Show / Hide Table of Contents

Class RTPSession

The RTPSession class is the primary point for interacting with the Real-Time Protocol. It manages all the resources required for setting up and then sending and receiving RTP packets. This class IS designed to be inherited by child classes and for child classes to add audio and video processing logic.

Inheritance
System.Object
RTPSession
AudioSendOnlyMediaSession
VoIPMediaSession
RTCPeerConnection
Implements
IMediaSession
System.IDisposable
Inherited Members
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.ToString()
Namespace: SIPSorcery.Net
Assembly: SIPSorcery.dll
Syntax
public class RTPSession : IMediaSession, IDisposable
Remarks

The setting up of an RTP stream involved the exchange of Session Descriptions (SDP) with the remote party. This class has adopted the mechanism used by WebRTC. The steps are:

  1. If acting as the initiator: a. Create offer, b. Send offer to remote party and get their answer (external to this class, requires signalling), c. Set remote description, d. Optionally perform any additional set up, such as negotiating SRTP keying material, e. Call Start to commence RTCP reporting.
  2. If acting as the recipient: a. Receive offer, b. Set remote description. This step MUST be done before an SDP answer can be generated. This step can also result in an error condition if the codecs/formats offered aren't supported, c. Create answer, d. Send answer to remote party (external to this class, requires signalling), e. Optionally perform any additional set up, such as negotiating SRTP keying material, f. Call Start to commence RTCP reporting.

Constructors

| Improve this Doc View Source

RTPSession(RtpSessionConfig)

Creates a new RTP session. The synchronisation source and sequence number are initialised to pseudo random values.

Declaration
public RTPSession(RtpSessionConfig config)
Parameters
Type Name Description
RtpSessionConfig config

Contains required settings.

| Improve this Doc View Source

RTPSession(Boolean, Boolean, Boolean, IPAddress, Int32, PortRange)

Creates a new RTP session. The synchronisation source and sequence number are initialised to pseudo random values.

Declaration
public RTPSession(bool isMediaMultiplexed, bool isRtcpMultiplexed, bool isSecure, IPAddress bindAddress = null, int bindPort = 0, PortRange portRange = null)
Parameters
Type Name Description
System.Boolean isMediaMultiplexed

If true only a single RTP socket will be used for both audio and video (standard case for WebRTC). If false two separate RTP sockets will be used for audio and video (standard case for VoIP).

System.Boolean isRtcpMultiplexed

If true RTCP reports will be multiplexed with RTP on a single channel. If false (standard mode) then a separate socket is used to send and receive RTCP reports.

System.Boolean isSecure

If true indicated this session is using SRTP to encrypt and authorise RTP and RTCP packets. No communications or reporting will commence until the is explicitly set as complete.

System.Net.IPAddress bindAddress

Optional. If specified this address will be used as the bind address for any RTP and control sockets created. Generally this address does not need to be set. The default behaviour is to bind to [::] or 0.0.0.0,d depending on system support, which minimises network routing causing connection issues.

System.Int32 bindPort

Optional. If specified a single attempt will be made to bind the RTP socket on this port. It's recommended to leave this parameter as the default of 0 to let the Operating System select the port number.

PortRange portRange

Fields

| Improve this Doc View Source

audioRemoteSDPSsrcAttributes

Declaration
protected List<List<SDPSsrcAttribute>> audioRemoteSDPSsrcAttributes
Field Value
Type Description
System.Collections.Generic.List<System.Collections.Generic.List<SDPSsrcAttribute>>
| Improve this Doc View Source

DEFAULT_AUDIO_CLOCK_RATE

Declaration
protected const int DEFAULT_AUDIO_CLOCK_RATE = 8000
Field Value
Type Description
System.Int32
| Improve this Doc View Source

DEFAULT_DTMF_EVENT_PAYLOAD_ID

Declaration
public const int DEFAULT_DTMF_EVENT_PAYLOAD_ID = 101
Field Value
Type Description
System.Int32
| Improve this Doc View Source

DEFAULT_MEDIA_TYPE

Declaration
public const SDPMediaTypesEnum DEFAULT_MEDIA_TYPE = SDPMediaTypesEnum.audio
Field Value
Type Description
SDPMediaTypesEnum
| Improve this Doc View Source

DTMF_EVENT_DURATION

Declaration
public const int DTMF_EVENT_DURATION = 1200
Field Value
Type Description
System.Int32
| Improve this Doc View Source

DTMF_EVENT_PAYLOAD_ID

Declaration
public const int DTMF_EVENT_PAYLOAD_ID = 101
Field Value
Type Description
System.Int32
| Improve this Doc View Source

logger

Declaration
protected static ILogger logger
Field Value
Type Description
Microsoft.Extensions.Logging.ILogger
| Improve this Doc View Source

m_primaryStream

Declaration
protected MediaStream m_primaryStream
Field Value
Type Description
MediaStream
| Improve this Doc View Source

MultiplexRtpChannel

Declaration
protected RTPChannel MultiplexRtpChannel
Field Value
Type Description
RTPChannel
| Improve this Doc View Source

RTCP_RR_NOSTREAM_SSRC

When there are no RTP packets being sent for an audio or video stream webrtc.lib still sends RTCP Receiver Reports with this hard coded SSRC. No doubt it's defined in an RFC somewhere but I wasn't able to find it from a quick search.

Declaration
public const uint RTCP_RR_NOSTREAM_SSRC = 4195875351U
Field Value
Type Description
System.UInt32
| Improve this Doc View Source

RTP_EVENT_DEFAULT_SAMPLE_PERIOD_MS

Declaration
public const int RTP_EVENT_DEFAULT_SAMPLE_PERIOD_MS = 50
Field Value
Type Description
System.Int32
| Improve this Doc View Source

RTP_MAX_PAYLOAD

Declaration
protected const int RTP_MAX_PAYLOAD = 1200
Field Value
Type Description
System.Int32
| Improve this Doc View Source

RTP_MEDIA_PROFILE

Declaration
public const string RTP_MEDIA_PROFILE = "RTP/AVP"
Field Value
Type Description
System.String
| Improve this Doc View Source

RTP_SECUREMEDIA_PROFILE

Declaration
public const string RTP_SECUREMEDIA_PROFILE = "RTP/SAVP"
Field Value
Type Description
System.String
| Improve this Doc View Source

rtpSessionConfig

Declaration
protected RtpSessionConfig rtpSessionConfig
Field Value
Type Description
RtpSessionConfig
| Improve this Doc View Source

SDP_SESSIONID_LENGTH

Declaration
protected const int SDP_SESSIONID_LENGTH = 10
Field Value
Type Description
System.Int32
| Improve this Doc View Source

SRTP_MAX_PREFIX_LENGTH

From libsrtp: SRTP_MAX_TRAILER_LEN is the maximum length of the SRTP trailer (authentication tag and MKI) supported by libSRTP.This value is the maximum number of octets that will be added to an RTP packet by srtp_protect().

srtp_protect(): @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN into the location in memory immediately following the RTP packet. Callers MUST ensure that this much writeable memory is available in the buffer that holds the RTP packet.

srtp_protect_rtcp(): @warning This function assumes that it can write SRTP_MAX_TRAILER_LEN+4 to the location in memory immediately following the RTCP packet. Callers MUST ensure that this much writeable memory is available in the buffer that holds the RTCP packet.

Declaration
public const int SRTP_MAX_PREFIX_LENGTH = 148
Field Value
Type Description
System.Int32
| Improve this Doc View Source

videoRemoteSDPSsrcAttributes

Declaration
protected List<List<SDPSsrcAttribute>> videoRemoteSDPSsrcAttributes
Field Value
Type Description
System.Collections.Generic.List<System.Collections.Generic.List<SDPSsrcAttribute>>

Properties

| Improve this Doc View Source

AcceptRtpFromAny

If set to true RTP will be accepted from ANY remote end point. If false certain rules are used to determine whether RTP should be accepted for a particular audio or video stream. It is recommended to leave the value to false unless a specific need exists.

Declaration
public bool AcceptRtpFromAny { get; set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

AudioControlDestinationEndPoint

The primary Audio remote RTP control end point this stream is sending to RTCP reports for the media stream to.

Declaration
public IPEndPoint AudioControlDestinationEndPoint { get; }
Property Value
Type Description
System.Net.IPEndPoint
| Improve this Doc View Source

AudioDestinationEndPoint

The primary Audio remote RTP end point this stream is sending media to.

Declaration
public IPEndPoint AudioDestinationEndPoint { get; }
Property Value
Type Description
System.Net.IPEndPoint
| Improve this Doc View Source

AudioLocalTrack

The primary local audio stream for this session. Will be null if we are not sending audio.

Declaration
public MediaStreamTrack AudioLocalTrack { get; }
Property Value
Type Description
MediaStreamTrack
| Improve this Doc View Source

AudioRemoteTrack

The primary remote audio track for this session. Will be null if the remote party is not sending audio.

Declaration
public MediaStreamTrack AudioRemoteTrack { get; }
Property Value
Type Description
MediaStreamTrack
| Improve this Doc View Source

AudioRtcpSession

The primary reporting session for the audio stream. Will be null if only video is being sent.

Declaration
public RTCPSession AudioRtcpSession { get; }
Property Value
Type Description
RTCPSession
| Improve this Doc View Source

AudioStream

The primary Audio Stream for this session

Declaration
public AudioStream AudioStream { get; }
Property Value
Type Description
AudioStream
| Improve this Doc View Source

AudioStreamList

List of all Audio Streams for this session

Declaration
public List<AudioStream> AudioStreamList { get; }
Property Value
Type Description
System.Collections.Generic.List<AudioStream>
| Improve this Doc View Source

HasAudio

Indicates whether this session is using audio.

Declaration
public bool HasAudio { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

HasVideo

Indicates whether this session is using video.

Declaration
public bool HasVideo { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsClosed

Indicates whether the session has been closed. Once a session is closed it cannot be restarted.

Declaration
public bool IsClosed { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

IsStarted

Indicates whether the session has been started. Starting a session tells the RTP socket to start receiving,

Declaration
public bool IsStarted { get; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

MaxReconstructedVideoFrameSize

Indicates the maximum frame size that can be reconstructed from RTP packets during the depacketisation process.

Declaration
public int MaxReconstructedVideoFrameSize { get; set; }
Property Value
Type Description
System.Int32
| Improve this Doc View Source

PrimaryStream

The primary stream for this session - can be an AudioStream or a VideoStream

Declaration
public MediaStream PrimaryStream { get; }
Property Value
Type Description
MediaStream
| Improve this Doc View Source

RemoteDescription

The SDP offered by the remote call party for this session.

Declaration
public SDP RemoteDescription { get; protected set; }
Property Value
Type Description
SDP
| Improve this Doc View Source

RequireRenegotiation

Track if current remote description is invalid (used in Renegotiation logic)

Declaration
public virtual bool RequireRenegotiation { get; protected set; }
Property Value
Type Description
System.Boolean
| Improve this Doc View Source

RtpBindAddress

Set if the session has been bound to a specific IP address. Normally not required but some esoteric call or network set ups may need.

Declaration
public IPAddress RtpBindAddress { get; }
Property Value
Type Description
System.Net.IPAddress
| Improve this Doc View Source

SrtpCryptoSuites

If this session is using a secure context this list MAY contain custom Crypto Suites

Declaration
public List<SDPSecurityDescription.CryptoSuites> SrtpCryptoSuites { get; set; }
Property Value
Type Description
System.Collections.Generic.List<SDPSecurityDescription.CryptoSuites>
| Improve this Doc View Source

VideoControlDestinationEndPoint

The primary Video remote RTP control end point this stream is sending to RTCP reports for the media stream to.

Declaration
public IPEndPoint VideoControlDestinationEndPoint { get; }
Property Value
Type Description
System.Net.IPEndPoint
| Improve this Doc View Source

VideoDestinationEndPoint

The primary Video remote RTP end point this stream is sending media to.

Declaration
public IPEndPoint VideoDestinationEndPoint { get; }
Property Value
Type Description
System.Net.IPEndPoint
| Improve this Doc View Source

VideoLocalTrack

The primary local video track for this session. Will be null if we are not sending video.

Declaration
public MediaStreamTrack VideoLocalTrack { get; }
Property Value
Type Description
MediaStreamTrack
| Improve this Doc View Source

VideoRemoteTrack

The primary remote video track for this session. Will be null if the remote party is not sending video.

Declaration
public MediaStreamTrack VideoRemoteTrack { get; }
Property Value
Type Description
MediaStreamTrack
| Improve this Doc View Source

VideoRtcpSession

The primary reporting session for the video stream. Will be null if only audio is being sent.

Declaration
public RTCPSession VideoRtcpSession { get; }
Property Value
Type Description
RTCPSession
| Improve this Doc View Source

VideoStream

The primary Video Stream for this session

Declaration
public VideoStream VideoStream { get; }
Property Value
Type Description
VideoStream
| Improve this Doc View Source

VideoStreamList

List of all Video Streams for this session

Declaration
public List<VideoStream> VideoStreamList { get; }
Property Value
Type Description
System.Collections.Generic.List<VideoStream>

Methods

| Improve this Doc View Source

AddRemoteSDPSsrcAttributes(SDPMediaTypesEnum, List<SDPSsrcAttribute>)

Declaration
protected void AddRemoteSDPSsrcAttributes(SDPMediaTypesEnum mediaType, List<SDPSsrcAttribute> sdpSsrcAttributes)
Parameters
Type Name Description
SDPMediaTypesEnum mediaType
System.Collections.Generic.List<SDPSsrcAttribute> sdpSsrcAttributes
| Improve this Doc View Source

addSingleTrack(Boolean)

Used for child classes that require a single RTP channel for all RTP (audio and video) and RTCP communications.

Declaration
protected void addSingleTrack(bool videoAsPrimary)
Parameters
Type Name Description
System.Boolean videoAsPrimary
| Improve this Doc View Source

addTrack(MediaStreamTrack)

Adds a media track to this session. A media track represents an audio or video stream and can be a local (which means we're sending) or remote (which means we're receiving).

Declaration
public virtual void addTrack(MediaStreamTrack track)
Parameters
Type Name Description
MediaStreamTrack track

The media track to add to the session.

| Improve this Doc View Source

Close(String)

Close the session and RTP channel.

Declaration
public virtual void Close(string reason)
Parameters
Type Name Description
System.String reason
| Improve this Doc View Source

CreateAnswer(IPAddress)

Generates an SDP answer in response to an offer. The remote description MUST be set prior to calling this method.

Declaration
public virtual SDP CreateAnswer(IPAddress connectionAddress)
Parameters
Type Name Description
System.Net.IPAddress connectionAddress

Optional. If set this address will be used as the SDP Connection address. If not specified the Operating System routing table will be used to lookup the address used to connect to the SDP connection address from the remote offer. Any and IPv6Any are special cases. If they are set the respective Internet facing IPv4 or IPv6 address will be used.

Returns
Type Description
SDP

A task that when complete contains the SDP answer.

Remarks

As specified in https://tools.ietf.org/html/rfc3264#section-6.1. "If the answerer has no media formats in common for a particular offered stream, the answerer MUST reject that media stream by setting the port to zero."

| Improve this Doc View Source

CreateOffer(IPAddress)

Generates the SDP for an offer that can be made to a remote user agent.

Declaration
public virtual SDP CreateOffer(IPAddress connectionAddress)
Parameters
Type Name Description
System.Net.IPAddress connectionAddress

Optional. If specified this IP address will be used as the address advertised in the SDP offer. If not provided the kernel routing table will be used to determine the local IP address used for Internet access. Any and IPv6Any are special cases. If they are set the respective Internet facing IPv4 or IPv6 address will be used.

Returns
Type Description
SDP

A task that when complete contains the SDP offer.

| Improve this Doc View Source

CreateRtpChannel()

Creates a new RTP channel (which manages the UDP socket sending and receiving RTP packets) for use with this session.

Declaration
protected virtual RTPChannel CreateRtpChannel()
Returns
Type Description
RTPChannel

A new RTPChannel instance.

| Improve this Doc View Source

Dispose()

Close the session if the instance is out of scope.

Declaration
public virtual void Dispose()
| Improve this Doc View Source

Dispose(Boolean)

Close the session if the instance is out of scope.

Declaration
protected virtual void Dispose(bool disposing)
Parameters
Type Name Description
System.Boolean disposing
| Improve this Doc View Source

GetMediaStreams()

Gets the media streams available in this session. Will only be audio, video or both. media streams represent an audio or video source that we are sending to the remote party.

Declaration
protected List<MediaStream> GetMediaStreams()
Returns
Type Description
System.Collections.Generic.List<MediaStream>

A list of the local tracks that have been added to this session.

| Improve this Doc View Source

GetNextAudioStreamByLocalTrack()

Declaration
protected virtual AudioStream GetNextAudioStreamByLocalTrack()
Returns
Type Description
AudioStream
| Improve this Doc View Source

GetNextVideoStreamByLocalTrack()

Declaration
protected virtual VideoStream GetNextVideoStreamByLocalTrack()
Returns
Type Description
VideoStream
| Improve this Doc View Source

GetOrCreateAudioStream(Int32)

Declaration
protected virtual AudioStream GetOrCreateAudioStream(int index)
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
AudioStream
| Improve this Doc View Source

GetOrCreateVideoStream(Int32)

Declaration
protected virtual VideoStream GetOrCreateVideoStream(int index)
Parameters
Type Name Description
System.Int32 index
Returns
Type Description
VideoStream
| Improve this Doc View Source

IsSecureContextReady()

If this session is using a secure context this flag MUST be set to indicate the security delegate (SrtpProtect, SrtpUnprotect etc) have been set.

Declaration
public bool IsSecureContextReady()
Returns
Type Description
System.Boolean
| Improve this Doc View Source

LogRemoteSDPSsrcAttributes()

Declaration
protected void LogRemoteSDPSsrcAttributes()
| Improve this Doc View Source

OnReceive(Int32, IPEndPoint, Byte[])

Declaration
protected void OnReceive(int localPort, IPEndPoint remoteEndPoint, byte[] buffer)
Parameters
Type Name Description
System.Int32 localPort
System.Net.IPEndPoint remoteEndPoint
System.Byte[] buffer
| Improve this Doc View Source

removeTrack(MediaStreamTrack)

Removes a media track from this session. A media track represents an audio or video stream and can be a local (which means we're sending) or remote (which means we're receiving).

Declaration
public virtual bool removeTrack(MediaStreamTrack track)
Parameters
Type Name Description
MediaStreamTrack track

The media track to add to the session.

Returns
Type Description
System.Boolean
| Improve this Doc View Source

ResetRemoteSDPSsrcAttributes()

Declaration
protected void ResetRemoteSDPSsrcAttributes()
| Improve this Doc View Source

SendAudio(UInt32, Byte[])

Sends an audio sample to the remote peer. (on the primary one)

Declaration
public void SendAudio(uint durationRtpUnits, byte[] sample)
Parameters
Type Name Description
System.UInt32 durationRtpUnits

The duration in RTP timestamp units of the audio sample. This value is added to the previous RTP timestamp when building the RTP header.

System.Byte[] sample

The audio sample to set as the RTP packet payload.

| Improve this Doc View Source

SendDtmf(Byte, CancellationToken)

Sends a DTMF toneas an RTP event to the remote party. (on the primary one)

Declaration
public virtual Task SendDtmf(byte key, CancellationToken ct)
Parameters
Type Name Description
System.Byte key

The DTMF tone to send.

System.Threading.CancellationToken ct

RTP events can span multiple RTP packets. This token can be used to cancel the send.

Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

SendDtmfEvent(RTPEvent, CancellationToken, Int32, Int32)

Declaration
public Task SendDtmfEvent(RTPEvent rtpEvent, CancellationToken cancellationToken, int clockRate = 8000, int samplePeriod = 50)
Parameters
Type Name Description
RTPEvent rtpEvent
System.Threading.CancellationToken cancellationToken
System.Int32 clockRate
System.Int32 samplePeriod
Returns
Type Description
System.Threading.Tasks.Task
| Improve this Doc View Source

SendRtcpFeedback(SDPMediaTypesEnum, RTCPFeedback)

Allows sending of RTCP feedback reports (on the primary one)

Declaration
public void SendRtcpFeedback(SDPMediaTypesEnum mediaType, RTCPFeedback feedback)
Parameters
Type Name Description
SDPMediaTypesEnum mediaType

The media type of the RTCP report being sent. Must be audio or video.

RTCPFeedback feedback

The feedback report to send.

| Improve this Doc View Source

SendRtcpRaw(SDPMediaTypesEnum, Byte[])

Allows additional control for sending raw RTCP payloads (on the primary one).

Declaration
public void SendRtcpRaw(SDPMediaTypesEnum mediaType, byte[] payload)
Parameters
Type Name Description
SDPMediaTypesEnum mediaType

The media type of the RTCP packet being sent. Must be audio or video.

System.Byte[] payload

The RTCP packet payload.

| Improve this Doc View Source

SendRtcpReport(SDPMediaTypesEnum, RTCPCompoundPacket)

Sends the RTCP report to the remote call party. (on the primary one)

Declaration
public void SendRtcpReport(SDPMediaTypesEnum mediaType, RTCPCompoundPacket report)
Parameters
Type Name Description
SDPMediaTypesEnum mediaType
RTCPCompoundPacket report

RTCP report to send.

| Improve this Doc View Source

SendRtpRaw(SDPMediaTypesEnum, Byte[], UInt32, Int32, Int32)

Allows additional control for sending raw RTP payloads (on the primary one). No framing or other processing is carried out.

Declaration
public void SendRtpRaw(SDPMediaTypesEnum mediaType, byte[] payload, uint timestamp, int markerBit, int payloadTypeID)
Parameters
Type Name Description
SDPMediaTypesEnum mediaType

The media type of the RTP packet being sent. Must be audio or video.

System.Byte[] payload

The RTP packet payload.

System.UInt32 timestamp

The timestamp to set on the RTP header.

System.Int32 markerBit

The value to set on the RTP header marker bit, should be 0 or 1.

System.Int32 payloadTypeID

The payload ID to set in the RTP header.

| Improve this Doc View Source

SendRtpRaw(SDPMediaTypesEnum, Byte[], UInt32, Int32, Int32, UInt16)

Allows additional control for sending raw RTP payloads (on the primary one). No framing or other processing is carried out.

Declaration
public void SendRtpRaw(SDPMediaTypesEnum mediaType, byte[] payload, uint timestamp, int markerBit, int payloadTypeID, ushort seqNum)
Parameters
Type Name Description
SDPMediaTypesEnum mediaType

The media type of the RTP packet being sent. Must be audio or video.

System.Byte[] payload

The RTP packet payload.

System.UInt32 timestamp

The timestamp to set on the RTP header.

System.Int32 markerBit

The value to set on the RTP header marker bit, should be 0 or 1.

System.Int32 payloadTypeID

The payload ID to set in the RTP header.

System.UInt16 seqNum

The sequence number of the packet.

| Improve this Doc View Source

SendVideo(UInt32, Byte[])

Sends a video sample to the remote peer. (on the primary one)

Declaration
public void SendVideo(uint durationRtpUnits, byte[] sample)
Parameters
Type Name Description
System.UInt32 durationRtpUnits

The duration in RTP timestamp units of the video sample. This value is added to the previous RTP timestamp when building the RTP header.

System.Byte[] sample

The video sample to set as the RTP packet payload.

| Improve this Doc View Source

SetDestination(SDPMediaTypesEnum, IPEndPoint, IPEndPoint)

Sets the remote end points for a media type supported by this RTP session. (on the primary one)

Declaration
public void SetDestination(SDPMediaTypesEnum mediaType, IPEndPoint rtpEndPoint, IPEndPoint rtcpEndPoint)
Parameters
Type Name Description
SDPMediaTypesEnum mediaType

The media type, must be audio or video, to set the remote end point for.

System.Net.IPEndPoint rtpEndPoint

The remote end point for RTP packets corresponding to the media type.

System.Net.IPEndPoint rtcpEndPoint

The remote end point for RTCP packets corresponding to the media type.

| Improve this Doc View Source

SetGlobalDestination(IPEndPoint, IPEndPoint)

Declaration
protected void SetGlobalDestination(IPEndPoint rtpEndPoint, IPEndPoint rtcpEndPoint)
Parameters
Type Name Description
System.Net.IPEndPoint rtpEndPoint
System.Net.IPEndPoint rtcpEndPoint
| Improve this Doc View Source

SetGlobalSecurityContext(ProtectRtpPacket, ProtectRtpPacket, ProtectRtpPacket, ProtectRtpPacket)

Declaration
protected void SetGlobalSecurityContext(ProtectRtpPacket protectRtp, ProtectRtpPacket unprotectRtp, ProtectRtpPacket protectRtcp, ProtectRtpPacket unprotectRtcp)
Parameters
Type Name Description
ProtectRtpPacket protectRtp
ProtectRtpPacket unprotectRtp
ProtectRtpPacket protectRtcp
ProtectRtpPacket unprotectRtcp
| Improve this Doc View Source

SetMediaStreamStatus(SDPMediaTypesEnum, MediaStreamStatusEnum)

Sets the stream status on the primary local audio or primary video media track.

Declaration
public void SetMediaStreamStatus(SDPMediaTypesEnum kind, MediaStreamStatusEnum status)
Parameters
Type Name Description
SDPMediaTypesEnum kind

The type of the media track. Must be audio or video.

MediaStreamStatusEnum status

The stream status for the media track.

| Improve this Doc View Source

SetRemoteDescription(SdpType, SDP)

Sets the remote SDP description for this session.

Declaration
public virtual SetDescriptionResultEnum SetRemoteDescription(SdpType sdpType, SDP sessionDescription)
Parameters
Type Name Description
SdpType sdpType

Whether the remote SDP is an offer or answer.

SDP sessionDescription

The SDP that will be set as the remote description.

Returns
Type Description
SetDescriptionResultEnum

If successful an OK enum result. If not an enum result indicating the failure cause.

| Improve this Doc View Source

Start()

Starts the RTCP session(s) that monitor this RTP session.

Declaration
public virtual Task Start()
Returns
Type Description
System.Threading.Tasks.Task

Events

| Improve this Doc View Source

OnAudioFormatsNegotiated

Gets fired when the remote SDP is received and the set of common audio formats is set. (on the primary one)

Declaration
public event Action<List<AudioFormat>> OnAudioFormatsNegotiated
Event Type
Type Description
System.Action<System.Collections.Generic.List<SIPSorceryMedia.Abstractions.AudioFormat>>
| Improve this Doc View Source

OnAudioFormatsNegotiatedByIndex

Gets fired when the remote SDP is received and the set of common audio formats is set. (using its index)

Declaration
public event Action<int, List<AudioFormat>> OnAudioFormatsNegotiatedByIndex
Event Type
Type Description
System.Action<System.Int32, System.Collections.Generic.List<SIPSorceryMedia.Abstractions.AudioFormat>>
| Improve this Doc View Source

OnClosed

Gets fired when the session is closed. This is the point audio and video source should stop generating samples.

Declaration
public event Action OnClosed
Event Type
Type Description
System.Action
| Improve this Doc View Source

OnReceiveReport

Gets fired when an RTCP report is received (the primary one). This event is for diagnostics only.

Declaration
public event Action<IPEndPoint, SDPMediaTypesEnum, RTCPCompoundPacket> OnReceiveReport
Event Type
Type Description
System.Action<System.Net.IPEndPoint, SDPMediaTypesEnum, RTCPCompoundPacket>
| Improve this Doc View Source

OnReceiveReportByIndex

Gets fired when an RTCP report is received (using its index). This event is for diagnostics only.

Declaration
public event Action<int, IPEndPoint, SDPMediaTypesEnum, RTCPCompoundPacket> OnReceiveReportByIndex
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, SDPMediaTypesEnum, RTCPCompoundPacket>
| Improve this Doc View Source

OnRtcpBye

Gets fired when an RTCP BYE packet is received from the remote party. The string parameter contains the BYE reason. Normally a BYE report means the RTP session is finished. But... cases have been observed where an RTCP BYE is received when a remote party is put on hold and then the session resumes when take off hold. It's up to the application to decide what action to take when n RTCP BYE is received.

Declaration
public event Action<string> OnRtcpBye
Event Type
Type Description
System.Action<System.String>
| Improve this Doc View Source

OnRtpClosed

Gets fired when the RTP session and underlying channel are closed.

Declaration
public event Action<string> OnRtpClosed
Event Type
Type Description
System.Action<System.String>
| Improve this Doc View Source

OnRtpEvent

Gets fired when an RTP event is detected on the remote call party's RTP stream (on the primary one).

Declaration
public event Action<IPEndPoint, RTPEvent, RTPHeader> OnRtpEvent
Event Type
Type Description
System.Action<System.Net.IPEndPoint, RTPEvent, RTPHeader>
| Improve this Doc View Source

OnRtpEventByIndex

Gets fired when an RTP event is detected on the remote call party's RTP stream (using its index).

Declaration
public event Action<int, IPEndPoint, RTPEvent, RTPHeader> OnRtpEventByIndex
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, RTPEvent, RTPHeader>
| Improve this Doc View Source

OnRtpHeaderReceived

Gets fired when an RTP Header packet is received from a remote party. (on the primary one) Parameters are:

  • Remote endpoint packet was received from,
  • The media type the packet contains, will be audio or video,
  • The RTP Header extension URI,
  • Object/Value of the header
Declaration
public event Action<IPEndPoint, SDPMediaTypesEnum, string, object> OnRtpHeaderReceived
Event Type
Type Description
System.Action<System.Net.IPEndPoint, SDPMediaTypesEnum, System.String, System.Object>
| Improve this Doc View Source

OnRtpHeaderReceivedByIndex

Gets fired when an RTP Header packet is received from a remote party. Parameters are:

  • index of the AudioStream or VideoStream
  • Remote endpoint packet was received from,
  • The media type the packet contains, will be audio or video,
  • The RTP Header extension URI,
  • Object/Value of the header
Declaration
public event Action<int, IPEndPoint, SDPMediaTypesEnum, string, object> OnRtpHeaderReceivedByIndex
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, SDPMediaTypesEnum, System.String, System.Object>
| Improve this Doc View Source

OnRtpPacketReceived

Gets fired when an RTP packet is received from a remote party. (on the primary one) Parameters are:

  • Remote endpoint packet was received from,
  • The media type the packet contains, will be audio or video,
  • The full RTP packet.
Declaration
public event Action<IPEndPoint, SDPMediaTypesEnum, RTPPacket> OnRtpPacketReceived
Event Type
Type Description
System.Action<System.Net.IPEndPoint, SDPMediaTypesEnum, RTPPacket>
| Improve this Doc View Source

OnRtpPacketReceivedByIndex

Gets fired when an RTP packet is received from a remote party (using its index). Parameters are:

  • index of the AudioStream or VideoStream
  • Remote endpoint packet was received from,
  • The media type the packet contains, will be audio or video,
  • The full RTP packet.
Declaration
public event Action<int, IPEndPoint, SDPMediaTypesEnum, RTPPacket> OnRtpPacketReceivedByIndex
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, SDPMediaTypesEnum, RTPPacket>
| Improve this Doc View Source

OnSendReport

Gets fired when an RTCP report is sent (the primary one). This event is for diagnostics only.

Declaration
public event Action<SDPMediaTypesEnum, RTCPCompoundPacket> OnSendReport
Event Type
Type Description
System.Action<SDPMediaTypesEnum, RTCPCompoundPacket>
| Improve this Doc View Source

OnSendReportByIndex

Gets fired when an RTCP report is sent (using its nidex). This event is for diagnostics only.

Declaration
public event Action<int, SDPMediaTypesEnum, RTCPCompoundPacket> OnSendReportByIndex
Event Type
Type Description
System.Action<System.Int32, SDPMediaTypesEnum, RTCPCompoundPacket>
| Improve this Doc View Source

OnStarted

Gets fired when the start method is called on the session. This is the point audio and video sources should commence generating samples.

Declaration
public event Action OnStarted
Event Type
Type Description
System.Action
| Improve this Doc View Source

OnTimeout

Fires when the connection for a media type (the primary one) is classified as timed out due to not receiving any RTP or RTCP packets within the given period.

Declaration
public event Action<SDPMediaTypesEnum> OnTimeout
Event Type
Type Description
System.Action<SDPMediaTypesEnum>
| Improve this Doc View Source

OnTimeoutByIndex

Fires when the connection for a media type (using its index) is classified as timed out due to not receiving any RTP or RTCP packets within the given period.

Declaration
public event Action<int, SDPMediaTypesEnum> OnTimeoutByIndex
Event Type
Type Description
System.Action<System.Int32, SDPMediaTypesEnum>
| Improve this Doc View Source

OnVideoFormatsNegotiated

Gets fired when the remote SDP is received and the set of common video formats is set. (on the primary one)

Declaration
public event Action<List<VideoFormat>> OnVideoFormatsNegotiated
Event Type
Type Description
System.Action<System.Collections.Generic.List<SIPSorceryMedia.Abstractions.VideoFormat>>
| Improve this Doc View Source

OnVideoFormatsNegotiatedByIndex

Gets fired when the remote SDP is received and the set of common video formats is set. (using its index)

Declaration
public event Action<int, List<VideoFormat>> OnVideoFormatsNegotiatedByIndex
Event Type
Type Description
System.Action<System.Int32, System.Collections.Generic.List<SIPSorceryMedia.Abstractions.VideoFormat>>
| Improve this Doc View Source

OnVideoFrameReceived

Gets fired when a full video frame is reconstructed from one or more RTP packets received from the remote party. (on the primary one)

Declaration
public event Action<IPEndPoint, uint, byte[], VideoFormat> OnVideoFrameReceived
Event Type
Type Description
System.Action<System.Net.IPEndPoint, System.UInt32, System.Byte[], SIPSorceryMedia.Abstractions.VideoFormat>
Remarks
  • Received from end point,
  • The frame timestamp,
  • The encoded video frame payload.
  • The video format of the encoded frame.
| Improve this Doc View Source

OnVideoFrameReceivedByIndex

Gets fired when a full video frame is reconstructed from one or more RTP packets received from the remote party. (using its index)

Declaration
public event Action<int, IPEndPoint, uint, byte[], VideoFormat> OnVideoFrameReceivedByIndex
Event Type
Type Description
System.Action<System.Int32, System.Net.IPEndPoint, System.UInt32, System.Byte[], SIPSorceryMedia.Abstractions.VideoFormat>
Remarks
  • Index of the VideoStream
  • Received from end point,
  • The frame timestamp,
  • The encoded video frame payload.
  • The video format of the encoded frame.

Implements

IMediaSession
System.IDisposable

Extension Methods

JSONWriter.ToJson(Object)
  • Improve this Doc
  • View Source
In This Article
Back to top Generated by DocFX