Event generation from SDK

Hi,

Is there a way to generate analytics/ generic events programmatically from SDK like the one below

Thanks,

Vega

On Analytics Events the recommended sample is Analytics Event Trigger via library -https://doc.developer.milestonesys.com/html/index.html?base=samples/componentsamples/analyticseventtriggervialibrary/readme.html&tree=tree_2.html

On Generic Events the recommended sample is Trigger Generic Event Stream - https://doc.developer.milestonesys.com/html/index.html?base=samples/protocolsamples/triggergenericeventstream/readme.html&tree=tree_3.html

I would recommend using Analytics Events.

Please also see - https://developer.milestonesys.com/s/article/exploring-the-MIP-SDK-recommended-top-SDK-samples

All sample source codes are found here - https://github.com/milestonesys

Not getting the event in multisitestatusviewer

Lets try to narrow down the possibilities. It could be that the event is not generated, it could be the multisitestatusviewer not picking up..

Do you see the event in the multisitestatusviewer if you use the Management Client Test Event?

Do you see the event from analytics event trigger if you use it in a rule or if you setup Smart Client to show event?

Do you see the event in the multisitestatusviewer if you use the Management Client Test Event? - Yes

Do you see the event from analytics event trigger if you use it in a rule - No

if you setup Smart Client to show event? - No

So the suspicion must be that the event is not sent and properly received. I would like you to test in the Smart Client like this: In the Smart Client on the Alarm Manager tab go into setup, pick the Alarm List, change it from Alarm to Event,

-

What product and version is the XProtect VMS you are using?

Can you confirm you use the newest sample building using the newest NuGet?

not getting events

using XProtect Corporate 2023 R2

using latest samples taken from github

even from other app not getting events

This sample uses a different method, could you try this one too? (I Expect it to works as it is much like the test button, but still it might be of interest to determine whether it works.)

https://doc.developer.milestonesys.com/html/index.html?base=samples/protocolsamples/triggeranalyticseventxml/readme.html&tree=tree_3.html

I wonder if the logs give us any clues.

A number of logs could be of interest.

MIP log for the standalone apps, at - [C:\ProgramData\Milestone\MIPSDK](file:C:/ProgramData/Milestone/MIPSDK)

Event Server log, at - [C:\ProgramData\Milestone\XProtect](file:C:/ProgramData/Milestone/XProtect) Event Server\logs

Event Server MIP log, at - [C:\ProgramData\Milestone\XProtect](file:C:/ProgramData/Milestone/XProtect) Event Server\logs\MIPLogs

2024-05-29 02:08:13.913 Error: BaseEventHandler (): Exception source: mscorlib

Exception type: System.ServiceModel.FaultException

Exception message: An error occurred when verifying security for the message.

Exception target site: HandleReturnMessage

Server stack trace:

at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

at IAlarmCommand.AddEvent(BaseEvent baseEvent)

at VideoOS.Platform.Proxy.AlarmClient.AlarmClientCredentials.AddEvent(BaseEvent baseEvent)

at VideoOS.Platform.SDK.Platform.MessageManager.BaseEventHandler(Message message, FQID dest, FQID source)

Which of the logs is this?

Known issue but a new scenario. I did not recognize it but I have a feeling it is a case of this know issue, explained in the knowledge base article I link to. Please try to apply the latest patches.

https://developer.milestonesys.com/s/article/Getting-Alarm-list-error-occurred-when-verifying-security-for-message-troubleshooting

Please let me know if it fixes the issue.

Did a fresh install of corporate 2023 R3 with all hotfix applied , still getting error

applied all listed patch(SC,MC and event server), still getting Alarm list returns error — ‘An error occurred when verifying security for the message.’ (troubleshooting) (milestonesys.com)

[C:\ProgramData\Milestone\MIPSDK\MIP20240529.txt](file:C:/ProgramData/Milestone/MIPSDK/MIP20240529.txt)

2024-05-29 11:11:36.730 Error: BaseEventHandler (): Exception source: mscorlib

Exception type: System.ServiceModel.FaultException

Exception message: An error occurred when verifying security for the message.

Exception target site: HandleReturnMessage

Server stack trace:

at System.ServiceModel.Channels.ServiceChannel.HandleReply(ProxyOperationRuntime operation, ProxyRpc& rpc)

at System.ServiceModel.Channels.ServiceChannel.Call(String action, Boolean oneway, ProxyOperationRuntime operation, Object[] ins, Object[] outs, TimeSpan timeout)

at System.ServiceModel.Channels.ServiceChannelProxy.InvokeService(IMethodCallMessage methodCall, ProxyOperationRuntime operation)

at System.ServiceModel.Channels.ServiceChannelProxy.Invoke(IMessage message)

Exception rethrown at [0]:

at System.Runtime.Remoting.Proxies.RealProxy.HandleReturnMessage(IMessage reqMsg, IMessage retMsg)

at System.Runtime.Remoting.Proxies.RealProxy.PrivateInvoke(MessageData& msgData, Int32 type)

at IAlarmCommand.AddEvent(BaseEvent baseEvent)

at VideoOS.Platform.Proxy.AlarmClient.AlarmClientCredentials.AddEvent(BaseEvent baseEvent)

at VideoOS.Platform.SDK.Platform.MessageManager.BaseEventHandler(Message message, FQID dest, FQID source)

Please answer a quick question. Does this site have encryption turned on or off (secure communication)? If unsure please check Server Configurator.

encryption is OFF

I know now why it fails. I haven’t figured out what goes wrong, so this is only a temporary answer.

When I have patched the Event Server it includes VideoOS.Platform.dll version 23.3.44.1

When I have built AnalyticsEventTriggerViaLibrary with the public NuGet it includes VideoOS.Platform.dll version 23.3.25.1

If I then use take a copy of the VideoOS.Platform,dll from Event Server installation folder and uses it to replace the file in the sample executable’s folder. In essence use the newest VideoOS.Platform.dll everywhere. Then the AnalyticsEventTriggerViaLibrary sample works!

As I hinted I will need to dig deeper to find out how and where it fails. If you urgently need a solution here and now you can copy the VideoOS.Platform.dll you can see my post below.

Ok, I will check this out.

Any patch for 2023 R2 release, we are using 2023 R2 here

I now have a deeper insight to share. The issue is not solved by patching the XProtect VMS. The issue is caused by a bug in the VideoOS.Platform.dll introduced in 23.3. So in essence what you need is to have the newer VideoOS.Platform.dll that is fixed.

So the conclusion is that your standalone MIP SDK based application needs the new dll no matter what the version of the XProtect VMS you connect to is!

The new dll ought to be in the VideoOS.Platform NuGet. We need to have an investigation at Milestone why it isn’t. Please wait for an update from Milestone on a final resolution.

While we are investigating a temporary quick fix is to steal the dll from a patched Event Server, Management Client or Smart Client (patched 2023R3).

Workaround

Please do not copy the dll, I have a safer workaround method.

If you unload the AnalyticsEventTriggerViaLibrary project and the edit the project file you can find:

Please change this section to:

The issue is that the newest “MilestoneSystems.VideoOS.Platform.SDK” NuGet references “MilestoneSystems.VideoOS.Platform” NuGet but must be doing it in way that does not ensure that the newest “MilestoneSystems.VideoOS.Platform” NuGet is used.

We will have Milestone Development investigate and we will post an update here when a solution is found.

Milestone Development have now built and published a new set of NuGet, and this issue is now solved and the workaround is not needed.