Skip to content

Commit

Permalink
1. Allow custom SIPHeader.Date field format and time zone
Browse files Browse the repository at this point in the history
2. Expose the OnReportReadyToSend and OnTimeout events of RTCPSession for reuse
  • Loading branch information
pedoc authored and sipsorcery committed Jul 15, 2021
1 parent f2aace5 commit f48a65f
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 2 deletions.
6 changes: 6 additions & 0 deletions src/core/SIP/SIPHeader.cs
Original file line number Diff line number Diff line change
Expand Up @@ -2150,6 +2150,12 @@ public void SetDateHeader()
Date = DateTime.UtcNow.ToString("ddd, dd MMM yyyy HH:mm:ss ") + "GMT";
}

public void SetDateHeader(bool useLocalTime, string timeFormat)
{
var time = useLocalTime ? DateTime.Now : DateTime.UtcNow;
Date = time.ToString(timeFormat) + (useLocalTime ? "" : "GMT");
}

public SIPHeader Copy()
{
string headerString = this.ToString();
Expand Down
4 changes: 2 additions & 2 deletions src/net/RTCP/RTCPSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -161,13 +161,13 @@ public class RTCPSession
/// <summary>
/// Event handler for sending RTCP reports.
/// </summary>
internal event Action<SDPMediaTypesEnum, RTCPCompoundPacket> OnReportReadyToSend;
public event Action<SDPMediaTypesEnum, RTCPCompoundPacket> OnReportReadyToSend;

/// <summary>
/// Fires when the connection is classified as timed out due to not
/// receiving any RTP or RTCP packets within the given period.
/// </summary>
internal event Action<SDPMediaTypesEnum> OnTimeout;
public event Action<SDPMediaTypesEnum> OnTimeout;

/// <summary>
/// Default constructor.
Expand Down

0 comments on commit f48a65f

Please sign in to comment.