/// <summary>
/// Creates a new RTP session. The synchronisation source and sequence number are initialised to
/// pseudo random values.
/// </summary>
/// <param name="formatTypeID">The format type ID for the media. It's what gets set in the payload
/// type ID field in the RTP header. A default media announcement will be created.</param>
/// <param name="srtpProtect">Optional secure DTLS context for encrypting RTP packets.</param>
/// <param name="srtcpProtect">Optional secure DTLS context for encrypting RTCP packets.</param>
/// <param name="rtpEventSupport">True if RTP event sending and receiving should be supported.</param>
/// <param name="addrFamily">Determines whether the RTP channel will use an IPv4 or IPv6 socket.</param>
public RTPSession(int formatTypeID, ProtectRtpPacket srtpProtect, ProtectRtpPacket srtcpProtect, bool rtpEventSupport, AddressFamily addrFamily)
{
MediaFormat = new SDPMediaFormat(formatTypeID);
MediaAnnouncement = new SDPMediaAnnouncement
{
Media = SDPMediaTypesEnum.audio,
MediaFormats = new List <SDPMediaFormat> {
MediaFormat
},
MediaStreamStatus = MediaStreamStatusEnum.SendRecv
};
if (rtpEventSupport)
{
int clockRate = MediaFormat.GetClockRate();
SDPMediaFormat rtpEventFormat = new SDPMediaFormat(DTMF_EVENT_PAYLOAD_ID);
rtpEventFormat.SetFormatAttribute($"{TELEPHONE_EVENT_ATTRIBUTE}/{clockRate}");
rtpEventFormat.SetFormatParameterAttribute("0-16");
MediaAnnouncement.MediaFormats.Add(rtpEventFormat);
}
m_rtpEventSupport = rtpEventSupport;
FormatTypeID = formatTypeID;
SrtpProtect = srtpProtect;
Initialise(addrFamily, srtcpProtect);
}