1
0

Updated UnitTests, bump to first release.

This commit is contained in:
2025-08-28 17:23:32 +02:00
parent 2d825563f8
commit 411244ba16
6 changed files with 244 additions and 12 deletions

View File

@@ -26,11 +26,11 @@ namespace AMWD.Net.Api.Fritz.CallMonitor
/// <summary>
/// Initializes a new instance of the <see cref="CallMonitorClient"/> class.
/// </summary>
/// <param name="host">The hostname or IP address of the FRITZ!Box to monitor.</param>
/// <param name="host">The hostname or IP address of the FRITZ!Box to monitor (Default: fritz.box).</param>
/// <param name="port">The port to connect to (Default: 1012).</param>
/// <exception cref="ArgumentNullException">The hostname is not set.</exception>
/// <exception cref="ArgumentOutOfRangeException">The port is not in valid range of 1 to 65535.</exception>
public CallMonitorClient(string host, int port = 1012)
/// <exception cref="ArgumentNullException">Thrown if the <paramref name="host"/> is not set.</exception>
/// <exception cref="ArgumentOutOfRangeException">Thrown if the <paramref name="port"/>is not in a valid range of 1 to 65535.</exception>
public CallMonitorClient(string host = "fritz.box", int port = 1012)
{
if (string.IsNullOrWhiteSpace(host))
throw new ArgumentNullException(nameof(host));

View File

@@ -24,7 +24,7 @@ namespace AMWD.Net.Api.Fritz.CallMonitor
public int? ConnectionId { get; private set; }
/// <summary>
/// Gets the line / port of signaled.
/// Gets the signaled line / port.
/// </summary>
public int? LinePort { get; private set; }
@@ -39,7 +39,7 @@ namespace AMWD.Net.Api.Fritz.CallMonitor
public string? CalleeNumber { get; private set; }
/// <summary>
/// Gets the duarion of the call (only on <see cref="EventType.Disconnect"/> event).
/// Gets the duration of the call (only on <see cref="EventType.Disconnect"/> event).
/// </summary>
public TimeSpan? Duration { get; private set; }

View File

@@ -46,6 +46,10 @@ namespace AMWD.Net.Api.Fritz.CallMonitor.Utils
_isDisposed = true;
// Ensure no connection attempts are running
_connectLock.WaitAsync().Wait();
// Stop the client
StopAsyncInternally(CancellationToken.None).Wait();
_connectLock.Dispose();
@@ -84,6 +88,7 @@ namespace AMWD.Net.Api.Fritz.CallMonitor.Utils
var stopTask = Task.Run(async () =>
{
_stopCts?.Cancel();
try
{
await _monitorTask.ConfigureAwait(false);