The Boring Lab

Boring Blog

Configure Axis Loitering Guard to send events to Milestone XProtect

We wanted to use Axis Loitering Guard ACAP analytic last week but found there is little to no documentation on how to get it to work with Milestone XProtect VMS.  So here is how we connected the alerts from Axis Loitering Guard video analytics to alert in Milestone.

Edit 04/08/2020: After a great discussion on LinkedIn there is another method supported on some Axis cameras called Dynamic Device Event Handling.  This method has been added below.

Install Axis Loitering Guard

If you are not familiar with Axis’s camera platform they allow you to install applications on top of the camera much like your iPhone.  These applications are called AXIS Camera Application Platform applications or ACAP for short and installation is quite straightforward.

Axis camera settings app tab
  • Click the large + (Add) and upload the ACAP in the pop up as seen below
Axis Camera ACAP installation

Enable the ACAP application

  • Once installed click on the AXIS Loitering Guard puzzle piece in the settings section
  • Flip the switch to turn on Axis Loitering Guard
Axis Camera Loitering Guard start up

Configure the ACAP

Each ACAP will be different but for AXIS Loitering Guard you configure basic settings that will allow you to identify zones of interest, the dwell time of an object and perspective of the field of view.

Axis has a video on configuring Loitering Guard so I will not go into that here but below is an image that shows the calibration of the perspective, Axis calls this depth.  Also note that you can have different loitering profiles, I changed the profile name in this case to FrontLoiter you can choose a name that makes sense for your deployment but we will need to know this later when we create events.

Method 1: Using Milestone Generic Event integration

Once the ACAP is configured we can start working on sending these alerts to Milestone.  To do this we will configure events in the Axis camera which will be received in Milestone as a generic event or, if supported, you can use dynamic device event handling.

Configure a Recipient

The recipient in our case is the Milestone Event Server.

  • Close the Loitering Guard configuration page and return to the Axis camera admin page
  • Click on the System tab
  • Click the Events icon
  • Click on Recipients
  • Click +
    • Name = Something Recognizable (ie: Milestone Server)
    • Type = TCP
    • Host = IP of Milestone Event Server
    • Port = Port associated with Generic Events in Milestone (Default=1234)

Create a Rule in the Axis Camera

The rule is what listens for a trigger event and then performs an action.  In this case the action is to send a TCP message to the Milestone Event server.

  • Click Rules
  • Click +
    • Use this rule = checked
    • Name = Something identifiable (ie: Send Loitering to milestone)
    • Wait between actions = If you want to suppress sequential alerts (optional)
    • Condition = Application > Loitering Guard > Loitering Profile 
      • Note: The Loitering Profile is the name used when we configured the ACAP
    • Use this condition as a trigger = checked
    • Action = Notifications > Send notification through TCP
    • Recipient = You will see the name of the recipient you previously set up here already
    • Message = Unique message that Milestone can parse (ie: FrontEntranceLoitering)
    • Use this condition as a trigger = checked
    • Action = Notifications > Send notification through TCP
    • Recipient = You will see the name of the recipient you previously set up here already
    • Message = Unique message that Milestone can parse (ie: FrontEntranceLoitering)

Configuring Milestone to receive Generic Events from Axis ACAP

Now that we have the camera set up lets get Milestone ready to accept the notifications so that we can create rules and alarms based on the loitering events.

Generic Events in Milestone allow you to receive and parse HTTP or TCP messages that come in from any analytic or IOT device without the need for special drivers.  In this case we will be receiving the TCP messages that the Axis camera will be sending us via the rule we set up.

Enable Generic Events

  • Log into XProtect Management Client
  • Click Tools > Options > Generic Events tab
  • In the Generic Events tab
    • Enabled = Checked
    • Allowed External IPv4 addresses = IP of the camera
    • Everything else is default
Enable Generic Events in Milestone Xprotect

Create a Generic Event

  • In the management client’s main navigation right-click Generic Events
  • Select Add New…
  • Name = Something identifiable (ie: Front Entrance Loitering)
  • Define the event details
    • Expression defines what Milestone should consider an event.  In our case it is the message we configured in the ACAP rule.  
    • The unique message we set up in the camera was FrontEntranceLoitering and so to tell Milestone that we are looking for exactly that message we will set the expression to be “FrontEntranceLoitering”
milestone xprotect generic event definition

Method 2: Using Milestone dynamic device events

To simplify this process some Axis cameras support the ability to dynamically add the new ACAP events to Milestone. 


  • XProtect 2018R3 +
  • Express+, Pro+, Expert, Corporate
  • Device Pack 9.9 +

Here is the process:

  • In Milestone management client find the camera hardware under your recording server
  • Right-click and Replace
  • One you replace, click on the camera device
  • Click on the Events tab
  • Click Add
  • You will now see a list of new events including LoiteringGuard.
  • Add both raising and falling events which reference your profile
Milestone Dynamic Device Event Handling

Testing the integration

We can now test our integration by creating a simple rule in XProtect that will create a log in the Milestone Log Server when the Milestone Event Server identifies a message sent from the Axis Loitering Guard analytic.

Create the rule in Milestone

  • In the management client, right-click Rules, click Add Rule…
  • Name the rule (ie: Front Entrance Loitering Rule)
  • Perform action on
    • In the rule description section click event
    • If using Generic Events
      • External Events > Generic Events > Front Entrance Loitering
        • Front Entrance Loitering is the name of the Generic Event in this example but your name may vary.
    • If using dynamic driver events
      • Devices > Configurable Events > Loitering Guard
    • Click Next > Next again
  • Scroll through the Actions list and find and check Make new
    • In the rule description section click log entry
    • Click Rule name
    • Click OK and then Finish to close the rule dialog

Test from the Axis camera

We will go back to the Axis Loitering Guard configuration page and test the alarm.  When we do this, a log entry should appear in the rule-triggered server logs in management client.

  • Log back into the camera, navigate to the Axis Loitering Guard ACAP configuration page
  • Click the on-screen button of Test alarm
  • When you do this the included area will turn red
  • Head back over to Milestone management client
  • In the main navigation find and click, Server Log
  • Click the Rule-triggered logs tab
  • You should see a new log entry there with the rule name you created earlier
Milestone XProtect log message from Axis ACAP

What's next

Now that you have the integration setup you can create more complex rules, set up schedules, create alarms, etc. To add additional cameras just repeat the above steps for each.

The Best Milestone XProtect Technology Solutions for Retail

It’s a well-known fact that retail businesses are some of the most likely to suffer from theft and loss. Retail is also one of the industries where video surveillance systems can provide the greatest peace of mind. For these reasons, we’ve compiled a list of our top XProtect solutions for retail business owners and managers who are looking to make their stores as safe as possible. We hope you enjoy!

Read More »
3 best xprotect integrations for cannabis businesses by The Boring Lab

The Best 3 XProtect Integrations for Video Security in the Cannabis Industry

To run a successful cannabis company today, you need to meet a growing number of video security requirements. Your VMS can’t be any Average Joe system. Try these three integrations for your Milestone XProtect system to optimize storage, enhance video retention and reporting, and bolster your access control means to keep your company in compliance with every security regulation.

Read More »

The 3 Coolest Access Control Solutions for Milestone XProtect

Take your company’s security to the next level by restricting physical areas with these access control solutions for your Milestone XProtect VMS. With these integrations, you can customize and integrate your system to fit your security needs. Keep reading to learn more about some of our favorite technology partners and solutions.

Read More »