Class SdpUtils
Static class that provides various functions for working with the Session Description Protocol (SDP)
Inherited Members
Namespace: SipLib.Sdp
Assembly: SipLib.dll
Syntax
public static class SdpUtils
Methods
| Edit this page View SourceAddDtlsSrtp(MediaDescription, string)
Adds DTLS-SRTP attributes to a MediaDescription object that will be sent out as part of an SDP offer.
Declaration
public static void AddDtlsSrtp(MediaDescription mediaDescription, string fingerPrintAttribute)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaDescription | mediaDescription | Input MediaDescription to modify |
| string | fingerPrintAttribute | Fingerprint from the X.509 certificate. For example: "SHA-256 4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB" |
AddSdesSrtpEncryption(MediaDescription)
Adds SDES-SRTP attributes to a MediaDescription object that will be sent out as part of an SDP offer.
Declaration
public static void AddSdesSrtpEncryption(MediaDescription mediaDescription)
Parameters
| Type | Name | Description |
|---|---|---|
| MediaDescription | mediaDescription | Input MediaDescription to modify |
BuildSimpleAudioSdp(IPAddress, int, string)
Builds an Sdp for offering G.711 Mu-Law audio.
Declaration
public static Sdp BuildSimpleAudioSdp(IPAddress iPAddress, int Port, string UaName)
Parameters
| Type | Name | Description |
|---|---|---|
| IPAddress | iPAddress | IP address that the remote endpoint should send audio to. Audio data must also be sent from this address. |
| int | Port | Specifies the UDP port number that audio will be sent from and received on |
| string | UaName | User agent or server name to used for the origin name (o=). Also used to create a unique name for the audio session. |
Returns
| Type | Description |
|---|---|
| Sdp | Returns an Sdp object with an audio media description |
CreateAudioMediaDescription(int)
Creates a basic MediaDescription object for offering G.711 Mu-Law audio media.
Declaration
public static MediaDescription CreateAudioMediaDescription(int Port)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that audio will be sent and received on |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object. |
CreateAudioMediaDescription(int, List<string>, RtpEncryptionEnum, string)
Creates a MediaDescriptionobject for offerring multiple audio codecs.
Declaration
public static MediaDescription CreateAudioMediaDescription(int port, List<string> OfferAudioCodecs, RtpEncryptionEnum rtpEncryptionType, string fingerprint)
Parameters
| Type | Name | Description |
|---|---|---|
| int | port | Port number to used for audio media. |
| List<string> | OfferAudioCodecs | List of audio codecs to offer. |
| RtpEncryptionEnum | rtpEncryptionType | Specifies the type of media encryption to offer. |
| string | fingerprint | Specifies the fingerprint of the X.509 certificate that will be used for DTLS-SRTP encryption. It is best to pass in RtpChannel.CertificateFingerprint. |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object to add to the Sdp for offering audio media |
CreateDtlsSrtpAudioMediaDescription(int, string)
Creates a basic MediaDescription object for offering G.711 Mu-Law audio media that will be encrypted using DTLS-SRTP. See RFC 5763, RFC 5764 and RFC 3711.
Declaration
public static MediaDescription CreateDtlsSrtpAudioMediaDescription(int Port, string fingerPrintAttribute)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that audio will be sent and received on |
| string | fingerPrintAttribute | Fingerprint from the X.509 certificate. For example: "SHA-256 4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB" |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object. |
CreateDtlsSrtpRttMediaDescription(int, string)
Creates a basic MediaDescription object for offerring Real Time Text (RTT) media that will be encrypted using DTLS-SRTP. See RFC 5763, RFC 5764 and RFC 3711.
Declaration
public static MediaDescription CreateDtlsSrtpRttMediaDescription(int Port, string fingerPrintAttribute)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that RTT will be sent and received on |
| string | fingerPrintAttribute | Fingerprint from the X.509 certificate. For example: "SHA-256 4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB" |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object. |
CreateDtlsSrtpVideoMediaDescription(int, string)
Builds a basic MediaDescription object for offering H.264 video using the Basic Level 1 video profile that will be encrypted using DTLS-SRTP. See RFC 5763, RFC 5764 and RFC 3711.
Declaration
public static MediaDescription CreateDtlsSrtpVideoMediaDescription(int Port, string fingerPrintAttribute)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that video will be sent and received on |
| string | fingerPrintAttribute | Fingerprint from the X.509 certificate. For example: "SHA-256 4A:AD:B9:B1:3F:82:18:3B:54:02:12:DF:3E:5D:49:6B:19:E5:7C:AB" |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object. |
CreateMsrpMediaDescription(IPAddress, int, bool, SetupType, X509Certificate2?, string?)
Creates a basic MediaDescription object for offering Message Session Relay Protocol (MSRP, see RFC 4975).
Declaration
public static MediaDescription CreateMsrpMediaDescription(IPAddress ipAddress, int Port, bool UseTls, SetupType setupType, X509Certificate2? localCert = null, string? user = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IPAddress | ipAddress | Specifies the IPv4 or IPv6 IP address to use for the MSRP URI in the path attribute. This is address to which MSRP messages will be sent to and from which MSRP messages will be sent. |
| int | Port | Specifies the local port for the MSRP URI. |
| bool | UseTls | If true then offer MSRP over TLS (MSRPS), else offer MSRP over TCP. |
| SetupType | setupType | Specifies the setup type (active/passive) value to use for the setup attribute. |
| X509Certificate2 | localCert | Used to build the fingerprint attribute of the client's X.509 certificate. Optional. Defaults to null. This is required if UseTls is true and the SetupType is passive or actpass (i.e. the new MsrpConnection can become a server). |
| string | user | User name portion of the MSRP URI. Optional. |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object for offering MSRP. |
Exceptions
| Type | Condition |
|---|---|
| ArgumentException | Thrown if UseTls is true, and localCert is null and setupType is passive or actpass |
CreateRttMediaDescription(int)
Creates a basic MediaDescription object for offering Real Time Text (RTT) media.
Declaration
public static MediaDescription CreateRttMediaDescription(int Port)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that RTT will be sent and received on |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object. |
CreateSdesSrtpAudioMediaDescription(int)
Creates a basic MediaDescription object for offerring G.711 Mu-Law audio media that will be encrypted using SDES-SRTP. See RFC 4568, RFC 3711 and RFC 6188.
Declaration
public static MediaDescription CreateSdesSrtpAudioMediaDescription(int Port)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that audio will be sent and received on |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object. |
CreateSdesSrtpRttMediaDescription(int)
Creates a basic MediaDescription object for offerring Real Time Text (RTT) media that will be encrypted using SDES-SRTP. See RFC 4568, RFC 3711 and RFC 6188.
Declaration
public static MediaDescription CreateSdesSrtpRttMediaDescription(int Port)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that RTT will be sent and received on |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object. |
CreateSdesSrtpVideoMediaDescription(int)
Builds a basic MediaDescription object for offering H.264 video using the Basic Level 1 video profile that will be encrypted using SDES-SRTP. See RFC 4568, RFC 3711 and RFC 6188.
Declaration
public static MediaDescription CreateSdesSrtpVideoMediaDescription(int Port)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that video will be sent and received on |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object. |
CreateVideoMediaDescription(int)
Builds a basic MediaDescription object for offering H.264 video using the Basic Level 1 video profile.
Declaration
public static MediaDescription CreateVideoMediaDescription(int Port)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that video will be sent and received on |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object. |
CreateVideoMediaDescription(int, List<string>, RtpEncryptionEnum, string)
Builds a MediaDescription object offering one or more video codecs.
Declaration
public static MediaDescription CreateVideoMediaDescription(int Port, List<string> offerVideoCodecs, RtpEncryptionEnum rtpEncryptionType, string fingerprint)
Parameters
| Type | Name | Description |
|---|---|---|
| int | Port | Specifies the UDP port number that video will be sent and received on |
| List<string> | offerVideoCodecs | List of video codec names to offer. For example: H264, VP8, etc. |
| RtpEncryptionEnum | rtpEncryptionType | Specifies the type of encryption to offer. |
| string | fingerprint | Fingerprint of the X.509 certificate that will be used for DTLS-SRTP encryption. It is best to pass in RtpChannel.CertificateFingerprint. |
Returns
| Type | Description |
|---|---|
| MediaDescription | Returns a new MediaDescription object that can be added to an Sdp object that will be offered. |