Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/app/Media/AudioSendOnlyMediaSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -32,10 +32,10 @@ public AudioSendOnlyMediaSession(
base.addTrack(audioTrack);
}

private void AudioFormatsNegotiated(List<AudioFormat> audoFormats)
private void AudioFormatsNegotiated(List<AudioFormat> audioFormats)
{
var audioFormat = audoFormats.First();
logger.LogDebug($"Setting audio source format to {audioFormat.FormatID}:{audioFormat.Codec}.");
var audioFormat = audioFormats.First();
logger.LogDebug("Setting audio source format to {AudioFormatID}:{AudioFormatCodec}.", audioFormat.FormatID, audioFormat.Codec);
AudioExtrasSource.SetAudioSourceFormat(audioFormat);
}

Expand Down
4 changes: 2 additions & 2 deletions src/app/Media/Sources/AudioExtrasSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -350,7 +350,7 @@ public void SetSource(AudioSourceOptions sourceOptions)
{
if (!string.IsNullOrWhiteSpace(_audioOpts.MusicFile))
{
Log.LogWarning($"Music file not set or not found, using default music resource.");
Log.LogWarning("Music file not set or not found, using default music resource.");
}

var assem = typeof(VideoTestPatternSource).GetTypeInfo().Assembly;
Expand Down Expand Up @@ -381,7 +381,7 @@ private void InitialiseSendAudioFromStreamTimer(Stream audioStream, AudioSamplin
{
if (!_isClosed && audioStream != null && audioStream.Length > 0)
{
Log.LogDebug($"Sending audio stream length {audioStream.Length}.");
Log.LogDebug("Sending audio stream length {AudioStreamLength}.", audioStream.Length);

_streamSendInProgress = true;
_streamSourceRate = streamSampleRate;
Expand Down
2 changes: 1 addition & 1 deletion src/app/Media/Sources/VideoTestPatternSource.cs
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public void SetFrameRate(int framesPerSecond)
{
if (framesPerSecond < MINIMUM_FRAMES_PER_SECOND || framesPerSecond > MAXIMUM_FRAMES_PER_SECOND)
{
logger.LogWarning($"Frames per second not in the allowed range of {MINIMUM_FRAMES_PER_SECOND} to {MAXIMUM_FRAMES_PER_SECOND}, ignoring.");
logger.LogWarning("{FramesPerSecond} fames per second not in the allowed range of {MinimumFramesPerSecond} to {MaximumFramesPerSecond}, ignoring.", framesPerSecond, MINIMUM_FRAMES_PER_SECOND, MAXIMUM_FRAMES_PER_SECOND);
}
else
{
Expand Down
14 changes: 7 additions & 7 deletions src/app/Media/VoIPMediaSession.cs
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ private async void VideoSource_OnVideoSourceError(string errorMessage)
{
_videoCaptureDeviceFailed = true;

logger.LogWarning($"Video source for capture device failure. {errorMessage}");
logger.LogWarning("Video source for capture device failure. {ErrorMessage}", errorMessage);

// Can't use the webcam, switch to the test pattern source.
await _videoTestPatternSource.StartVideo().ConfigureAwait(false);
Expand All @@ -183,13 +183,13 @@ private void AudioFormatsNegotiated(List<AudioFormat> audoFormats)
// the standard is very fuzzy in that area. See https://datatracker.ietf.org/doc/html/rfc3264#section-7 and note the "SHOULD" in the text.

var audioFormat = audoFormats.First();
logger.LogDebug($"Setting audio source format to {audioFormat.FormatID}:{audioFormat.Codec} {audioFormat.ClockRate} (RTP clock rate {audioFormat.RtpClockRate}).");
logger.LogDebug("Setting audio source format to {FormatID}:{Codec} {ClockRate} (RTP clock rate {RtpClockRate}).", audioFormat.FormatID, audioFormat.Codec, audioFormat.ClockRate, audioFormat.RtpClockRate);
Media.AudioSource?.SetAudioSourceFormat(audioFormat);
_audioExtrasSource.SetAudioSourceFormat(audioFormat);

if(AudioStream != null && AudioStream.LocalTrack.NoDtmfSupport == false)
if (AudioStream != null && AudioStream.LocalTrack.NoDtmfSupport == false)
{
logger.LogDebug($"Audio track negotiated DTMF payload ID {AudioStream.NegotiatedRtpEventPayloadID}.");
logger.LogDebug("Audio track negotiated DTMF payload ID {AudioStreamNegotiatedRtpEventPayloadID}.", AudioStream.NegotiatedRtpEventPayloadID);
}
}

Expand All @@ -201,7 +201,7 @@ private void VideoFormatsNegotiated(List<VideoFormat> videoFormats)
// the standard is very fuzzy in that area. See https://datatracker.ietf.org/doc/html/rfc3264#section-7 and note the "SHOULD" in the text.

var videoFormat = videoFormats.First();
logger.LogDebug($"Setting video sink and source format to {videoFormat.FormatID}:{videoFormat.Codec}.");
logger.LogDebug("Setting video sink and source format to {VideoFormatID}:{VideoCodec}.", videoFormat.FormatID, videoFormat.Codec);
Media.VideoSource?.SetVideoSourceFormat(videoFormat);
_videoTestPatternSource?.SetVideoSourceFormat(videoFormat);
}
Expand Down Expand Up @@ -234,7 +234,7 @@ public async override Task Start()
}
else
{
logger.LogWarning($"Webcam video source failed before start, switching to test pattern source.");
logger.LogWarning("Webcam video source failed before start, switching to test pattern source.");

// The webcam source failed to start. Switch to a test pattern source.
await _videoTestPatternSource.StartVideo().ConfigureAwait(false);
Expand Down Expand Up @@ -297,7 +297,7 @@ protected void RtpMediaPacketReceived(IPEndPoint remoteEndPoint, SDPMediaTypesEn

if (mediaType == SDPMediaTypesEnum.audio && Media.AudioSink != null)
{
logger.LogTrace($"{nameof(RtpMediaPacketReceived)} audio RTP packet received from {remoteEndPoint} ssrc {hdr.SyncSource} seqnum {hdr.SequenceNumber} timestamp {hdr.Timestamp} payload type {hdr.PayloadType}.");
logger.LogTrace(nameof(RtpMediaPacketReceived) + " audio RTP packet received from {RemoteEndPoint} ssrc {SyncSource} seqnum {SequenceNumber} timestamp {Timestamp} payload type {PayloadType}.", remoteEndPoint, hdr.SyncSource, hdr.SequenceNumber, hdr.Timestamp, hdr.PayloadType);

Media.AudioSink.GotAudioRtp(remoteEndPoint, hdr.SyncSource, hdr.SequenceNumber, hdr.Timestamp, hdr.PayloadType, marker, rtpPacket.Payload);
}
Expand Down
10 changes: 5 additions & 5 deletions src/app/SIPPacketMangler.cs
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ public static string MangleSDP(string sdpBody, string publicIPAddress, out bool
}
catch (Exception excp)
{
logger.LogError("Exception MangleSDP. " + excp.Message);
logger.LogError(excp, "Exception MangleSDP. {ErrorMessage}", excp.Message);
return sdpBody;
}
}
Expand Down Expand Up @@ -115,13 +115,13 @@ public static void MangleSIPRequest(SIPRequest sipRequest)
sipRequest.Body = mangledSDP;
sipRequest.Header.ContentLength = sipRequest.Body.Length;

logger.LogDebug("SDP mangled for " + sipRequest.Method.ToString() + " request from " + sipRequest.RemoteSIPEndPoint.ToString() + ", adjusted address " + bottomViaIPAddress + ".");
logger.LogDebug("SDP mangled for {Status} response from {RemoteSIPEndPoint}, adjusted address {RemoteEndPointAddress}.", sipRequest.Method, sipRequest.RemoteSIPEndPoint, bottomViaIPAddress);
}
}
}
catch (Exception excp)
{
logger.LogError("Exception MangleSIPRequest. " + excp.Message);
logger.LogError(excp, "Exception MangleSDP. {ErrorMessage}", excp.Message);
}
}

Expand Down Expand Up @@ -160,13 +160,13 @@ public static void MangleSIPResponse(SIPResponse sipResponse, SIPEndPoint remote
sipResponse.Body = mangledSDP;
sipResponse.Header.ContentLength = sipResponse.Body.Length;

logger.LogDebug("SDP mangled for " + sipResponse.Status.ToString() + " response from " + sipResponse.RemoteSIPEndPoint.ToString() + ", adjusted address " + remoteEndPoint.Address.ToString() + ".");
logger.LogDebug("SDP mangled for {Status} response from {RemoteSIPEndPoint}, adjusted address {RemoteEndPointAddress}.", sipResponse.Status, sipResponse.RemoteSIPEndPoint, remoteEndPoint.Address);
}
}
}
catch (Exception excp)
{
logger.LogError("Exception MangleSIPResponse. " + excp.Message);
logger.LogError(excp, "Exception MangleSIPResponse. {ErrorMessage}", excp.Message);
}
}

Expand Down
8 changes: 4 additions & 4 deletions src/app/SIPRequestAuthoriser/SIPRequestAuthenticator.cs
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static SIPRequestAuthenticationResult AuthenticateSIPRequest(
}
else if (sipAccount.IsDisabled)
{
logger.LogWarning($"SIP account {sipAccount.SIPUsername}@{sipAccount.SIPDomain} is disabled for {sipRequest.Method}.");
logger.LogWarning("SIP account {SIPUsername}@{SIPDomain} is disabled for {Method}.", sipAccount.SIPUsername, sipAccount.SIPDomain, sipRequest.Method);

return new SIPRequestAuthenticationResult(SIPResponseStatusCodesEnum.Forbidden, null);
}
Expand Down Expand Up @@ -91,7 +91,7 @@ public static SIPRequestAuthenticationResult AuthenticateSIPRequest(
// Check for stale nonces.
if (IsNonceStale(requestNonce))
{
logger.LogWarning($"Authentication failed stale nonce for realm={sipAccount.SIPDomain}, username={sipAccount.SIPUsername}, uri={uri}, nonce={requestNonce}, method={sipRequest.Method}.");
logger.LogWarning("Authentication failed stale nonce for realm={SIPDomain}, username={SIPUsername}, uri={URI}, nonce={Nonce}, method={Method}.", sipAccount.SIPDomain, sipAccount.SIPUsername, uri, requestNonce, sipRequest.Method);

SIPAuthenticationHeader authHeader = new SIPAuthenticationHeader(SIPAuthorisationHeadersEnum.WWWAuthenticate, sipAccount.SIPDomain, GetNonce());
return new SIPRequestAuthenticationResult(SIPResponseStatusCodesEnum.Unauthorised, authHeader);
Expand Down Expand Up @@ -122,7 +122,7 @@ public static SIPRequestAuthenticationResult AuthenticateSIPRequest(
}
else
{
logger.LogWarning("Authentication token check failed for realm=" + sipAccount.SIPDomain + ", username=" + sipAccount.SIPUsername + ", uri=" + uri + ", nonce=" + requestNonce + ", method=" + sipRequest.Method + ".");
logger.LogWarning("Authentication token check failed for realm={SIPDomain}, username={SIPUsername}, uri={Uri}, nonce={RequestNonce}, method={SipRequestMethod}.", sipAccount.SIPDomain, sipAccount.SIPUsername, uri, requestNonce, sipRequest.Method);

SIPAuthenticationHeader authHeader = new SIPAuthenticationHeader(SIPAuthorisationHeadersEnum.WWWAuthenticate, sipAccount.SIPDomain, GetNonce());
return new SIPRequestAuthenticationResult(SIPResponseStatusCodesEnum.Unauthorised, authHeader);
Expand All @@ -133,7 +133,7 @@ public static SIPRequestAuthenticationResult AuthenticateSIPRequest(
}
catch (Exception excp)
{
logger.LogError(0, excp, "Exception AuthoriseSIPRequest. " + excp.Message);
logger.LogError(0, excp, "Exception AuthoriseSIPRequest. {ErrorMessage}", excp.Message);
return new SIPRequestAuthenticationResult(SIPResponseStatusCodesEnum.InternalServerError, null);
}
}
Expand Down
6 changes: 3 additions & 3 deletions src/app/SIPUserAgents/SIPB2BUserAgent.cs
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public SIPB2BUserAgent(

private void SIPServerUserAgent_CallCancelled(ISIPServerUserAgent uas, SIPRequest sipCancelRequest)
{
logger.LogDebug($"B2BUserAgent server call was cancelled with reason {sipCancelRequest?.Header.Reason}");
logger.LogDebug("B2BUserAgent server call was cancelled with reason {CancelReason}", sipCancelRequest?.Header.Reason);
m_uac?.Cancel();
}

Expand Down Expand Up @@ -93,7 +93,7 @@ private void ClientCallFailed(ISIPClientUserAgent uac, string error, SIPResponse
{
if (!base.IsCancelled)
{
logger.LogDebug($"B2BUserAgent client call failed {error}.");
logger.LogDebug("B2BUserAgent client call failed {Error}.", error);

var status = (errResponse != null) ? errResponse.Status : SIPResponseStatusCodesEnum.Decline;
var errResp = SIPResponse.GetResponse(m_uasTransaction.TransactionRequest, status, errResponse?.ReasonPhrase);
Expand All @@ -105,7 +105,7 @@ private void ClientCallFailed(ISIPClientUserAgent uac, string error, SIPResponse

private void ClientCallAnswered(ISIPClientUserAgent uac, SIPResponse resp)
{
logger.LogDebug($"B2BUserAgent client call answered {resp.ShortDescription}.");
logger.LogDebug("B2BUserAgent client call answered {ShortDescription}.", resp.ShortDescription);

if (resp.Status == SIPResponseStatusCodesEnum.Ok)
{
Expand Down
6 changes: 3 additions & 3 deletions src/app/SIPUserAgents/SIPCallDescriptor.cs
Original file line number Diff line number Diff line change
Expand Up @@ -448,7 +448,7 @@ public static List<string> ParseCustomHeaders(string customHeaders)
}
else if (customHeader.IndexOf(':') == -1)
{
logger.LogWarning("ParseCustomHeaders skipping custom header due to missing colon, " + customHeader + ".");
logger.LogWarning("ParseCustomHeaders skipping custom header due to missing colon, {CustomHeader}.", customHeader);
continue;
}
else
Expand All @@ -459,7 +459,7 @@ public static List<string> ParseCustomHeaders(string customHeaders)

if (Regex.Match(customHeader.Trim(), "^(Via|From|Contact|CSeq|Call-ID|Max-Forwards|Content-Length)$", RegexOptions.IgnoreCase).Success)
{
logger.LogWarning("ParseCustomHeaders skipping custom header due to an non-permitted string in header name, " + customHeader + ".");
logger.LogWarning("ParseCustomHeaders skipping custom header due to an non-permitted string in header name, {CustomHeader}.", customHeader);
continue;
}
else
Expand All @@ -473,7 +473,7 @@ public static List<string> ParseCustomHeaders(string customHeaders)
}
catch (Exception excp)
{
logger.LogError("Exception ParseCustomHeaders (" + customHeaders + "). " + excp.Message);
logger.LogError(excp, "Exception ParseCustomHeaders ({CustomHeaders}). {Message}", customHeaders, excp.Message);
}

return customHeaderList;
Expand Down
Loading