ONVIF Bridge GetMediaAttributes method causes the ONVIF server to crash.

Hi,

I am working with the version XProtect 2023 R1 and calling the ONVIF methods to retrieve recordings using the following code.

foreach (var profile in profiles)

{

Console.WriteLine($“Profile Name: {profile.Profile.Name}”);

Console.WriteLine($“Profile CameName: {profile.Profile.VideoSourceConfiguration.Name}”);

Console.WriteLine($“Profile Uri: {profile.UriStreaming}”);

DateTime targetDate = new DateTime(2024, 12, 11, 0, 0, 0, DateTimeKind.Utc); // Medianoche del día deseado

DateTime endDate = new DateTime(2024, 12, 11, 23, 59, 59, DateTimeKind.Utc); // Fin del día deseado

// Calcular tiempo en milisegundos desde el timestamp

double millisecondsBefore = (targetDate - targetDate.AddDays(-1)).TotalMilliseconds;

double millisecondsAfter = (endDate - targetDate).TotalMilliseconds;

SourceReference sourceReference = new SourceReference()

{

Token = profile.Profile.VideoSourceConfiguration.SourceToken

};

// Configurar el filtro

SearchScope scope = new SearchScope()

{

IncludedSources = new SourceReference\[\] { sourceReference },

RecordingInformationFilter = $"boolean(//Track\[TrackType = 'Video'\]),{targetDate:yyyy-MM-ddTHH:mm:ssZ},1,1000,{millisecondsAfter},1000"

};

EventFilter eventFilter = new EventFilter()

{

};

var summary = await camera.Search.GetRecordingSummaryAsync();

Onvif.Search.GetRecordingSearchResultsResponse searchRecordings = new GetRecordingSearchResultsResponse();

try

{

var recordings = await camera.Search.FindRecordingsAsync(scope, 100, "PT30S");

searchRecordings = await camera.Search.GetRecordingSearchResultsAsync(recordings.SearchToken, 100, 100, "PT30S");

}

catch (Exception ex)

{

Console.WriteLine($"Se ha producido un errror al buscar grbaciones {ex.Message}");

}

GetEventSearchResultsResponse searchEvents = new GetEventSearchResultsResponse();

try

{

var events = await camera.Search.FindEventsAsync(targetDate, endDate, scope, eventFilter, true, 100, "PT30S");

searchEvents = await camera.Search.GetEventSearchResultsAsync(events.SearchToken, 100, 100, "PT30S");

}

catch (Exception ex)

{

Console.WriteLine($"Se ha producido un errror al buscar eventos {ex.Message}");

}

var recordingInfoList = new List();

if (searchRecordings.ResultList != null && searchRecordings.ResultList.RecordingInformation != null)

{

foreach (var recording in searchRecordings.ResultList.RecordingInformation)

{

  var mediaatributtes = await camera.Search.GetMediaAttributesAsync(new string\[\] { recording.RecordingToken }, targetDate);

  var streamUri = await camera.Replay.GetReplayUriAsync(

      new Onvif.Replay.StreamSetup

      {

        Stream = Onvif.Replay.StreamType.RTPUnicast,

        Transport = new Onvif.Replay.Transport { Protocol = Onvif.Replay.TransportProtocol.RTSP }

      }, recording.RecordingToken

      );

  Console.WriteLine($"Fechas Grabación {recording.EarliestRecording},{recording.LatestRecording}");

  Console.WriteLine($"Uri Replay:{streamUri.Uri}");

  //var recordingJobs = await camera.Recording.GetRecordingJobsAsync();

}

}

else

{

Console.WriteLine("No se han encontrado grabaciones");

}

//foreach (var events in searchEvents.ResultList.Result.ToList())

//{

// Console.WriteLine($“Eventos {events.Event.Message.InnerXml},{events.Time}”);

//}

}

When the GetMediaAttributesmethod is executed, the ONVIF server crashes. The same issue occurs with the GetRecordingJobs and FindEvents methods, which also return errors.

The error visible in the Event Viewer on the Milestone server is as follows:

Thanks

Hi,

Can you please try with Open Network Bridge 24.2 ?

If you continue to experience the same issue please :

  • Get Event Viewer logs (make an export)
  • Set Open Network bridge logs to Trace, reproduce the issue and provide all logs ([C:\ProgramData\Milestone)](file:C:/ProgramData/Milestone)) and a date\time stamp when the issue was reproduced
  • Provide Wireshark traces of the communication between your client and the Open Network Bridge.
  • When you say that some methods return error - does it crash or just an error

Thank you !