Knowledge Base Article
Article Type: How To
Product: Symphony
Product Version:
Component: Symphony Server
Device Brands:
Created: 7-Apr-2017 10:35:52 AM
Last Updated:

Trigger an alarm in Symphony with a TCP message

You can use the TCP Listener video analytic to trigger alarms in Symphony. When the TCP Listener receives a message with metadata, it triggers the alarm.

  1. In the Symphony server configuration interface, click Rules > Events.
  2. Click New Event.
  3. Type a name for the event.
  4. Add a camera to the event.
  5. Select TCP Listener as the video analytic.
  6. Select whether you want any metadata or specific metadata to trigger an alarm.
  7. If you select specific metadata, type the text.
    For example, select Alarm on metadata that contains and type Hello World.
  8. Click Save.

You can test the alarm by sending a TCP message to the Symphony server. The following steps use Netcat to send the TCP message and tests an alarm that triggers on the text "Hello World".

Note: The cat and netcat utilities are Unix utilities. To use these utilities on Windows, use Cygwin (https://www.cygwin.com/) or Bash on Windows (https://msdn.microsoft.com/en-us/commandline/wsl/about) for Windows 10 Anniversary Update build 14393 (64-bit) or later. Alternatively, you can use a computer or virtual machine running Linux.

To test your alarm, perform the following steps:

  1. Create a text file (for example: message.txt) that contains
    <metadata text="Hello World"></metadata>
    
  2. Send the message to the Symphony server. For example:
    cat message.txt | netcat ip_address camera_id_value
    

    Where ip_address is the IP address of the Symphony and camera_id_value is the value of the camera ID on which you have created the alarm. For example, if the camera ID in Symphony is 5, the camera ID value is 5 * 10 + 50003 = 50053. If the camera ID in Symphony is 10, the camera ID value is 10 * 10 + 50003 = 50103.

The message should trigger the rule in Symphony and cause the action set for that rule to activate.

The following example, written in Python, sends TCP messages to Symphony:

#!/usr/bin/env python
import socket
TCP_IP = 'ip_address'
TCP_PORT = port
BUFFER_SIZE = 1024
MESSAGE = '<metadata text="Hello World"></metadata>' s = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
s.connect((TCP_IP, TCP_PORT))
s.send(MESSAGE)
s.close()

Where ip_address is the IP addres of the Symphony Server and port is the port number on which the Symphony Server listens for TCP messages (50003 + (camera ID * 10) by default).

Average rating:
Please log in to rate.
Rated by 0, Viewed by 4508