This article describes how to set up SAFR Actions to perform a variety of actions when certain events occur such as access being granted or detection of a known threat.


Prerequisites


This article assumes you are running the following:


  • SAFR Desktop Client connected to a camera running on either a phone, tablet, Mac or a PC.
    • Note: Support for iOS, Android or Surface is available for phones and tablets.
  • SAFR Actions application installed on either a Mac or PC


Set up SAFR and SAFR Actions


This section assumes you are installing on a PC that has a built-in or USB camera.


Configure SAFR Desktop Client

  1. Start the Desktop Client.
  2. Select a camera from the dropdown in the top left of the main window. (By default the local camera should be selected.)
  3. Choose the desired video processing mode in the drop-down menu in the top left of Camera Analyzer.  "Enrolled and Stranger Monitoring" is a good choice.
  4. Open the SAFR Preferences Menu by clicking on Tools > Preferences and configure it as follows:
    • Account Tab:
      • Change User Site and User Source to desired values.
    • Events Tab:
      • Ensure that "Listen for Event Replies" and "Display Reply Message" are checked. This helps during setup to know if events are being triggered.
      • Check the event types you'd like triggered (Identified, Stranger, or Unrecognizable).
      • If you wish to give feedback to recognized people, configure settings under Positive, Neutral, and Negative Reply sections.  
    • Recognition Tab: If individuals are not being recognized you may want to adjust thresholds in the Recognition Preferences. Use the Recognition Details panel (View menu) to view the current values of face size, center pose quality, sharpness, and contrast for subjects in the camera view.  If values reported in the Recognition Details panel are lower than configured values, try reducing configured values. Note that lowering these values will increase chance of false matches.
      • Minimum required face size/For recognition - Set to 120.
      • Minimum required center pose quality/For recognition: Decrease to allow for faces not looking toward camera.
      • Minimum required face sharpness quality/For recognition: Decrease to allow for less sharp faces.
      • Minimum required face contrast quality/For recognition: Decrease to allow for lower contrast faces.


Configure SAFR Actions

  1. Start SAFR Actions.
  2. Fill in your SAFR username and password, environment, and user directory.
  3. Edit the existing default rule.
    • If desired, make sure that daysOfWeek and timesOfDay are set to all the desired days/times.
      • If needed, add Saturday and Sunday and extend the time to the desired hours. (e.g. 00:00 to 24:00)
    • Change the reply/message if desired.
    • Add the command to be executed (see SAFR ActionHTTP POST command below) to the actions list.
  4. Save the changes from the File Menu.
    • Changes will take effect immediately.


Test the Action


Before proceeding, you should test that the rule you set up is working and the action is being triggered. Do so by doing the following:


  1. Hide your face from the camera on the device running the SAFR client.
  2. Unhide your face.
  3. Wait for the recognition event.
  4. Upon recognition, the message should appear on screen and, a voice will sound. (assuming you configured a voice reply to occur).


If you do not get a message displayed, check the SAFR Actions log to see if there are any clues there. You can find the log here:


  • Windows: C:\ProgramData\RealNetworks\SAFR\ares\logs
  • macOS: /Library/RealNetworks/SAFR/ares


Possible issues and resolutions:


  • If you see login errors, correct the account info that you entered.
  • If you see "Too Late", the machine running the SAFR client and the machine running SAFR Actions may not be set to the same times. They should be within 1-2 seconds of each other. Correct this and try again.
  • If you see any other error, either check messages and attempt to correct it yourself or contact RealNetworks.


Set Up and Test the Script


If you wish to run a script when an event is triggered, you need to add your script to the rule you created in SAFR Actions described above. If your rule is a single line command, it can go directly in the rule's action text field.  You'll need to make sure that the command you're running is in the system PATH variable so that SAFR Actions can find it. If you want to run a script file, the script file should be placed in one of the following directories:


  • Windows: C:\Program Files\RealNetworks\SAFR\ares\scripts
  • macOS: /Library/RealNetworks/SAFR/ares/scripts


Sample curl Test Script


The following assumes you want to run a curl command. For testing, we used the free service http://ptsv2.com which allows you to submit an HTTP POST request to a temporary bucket.


Below is the curl command you'll run:


curl -d name=#N&&site=#I&source=#S&msg=What's+up+ARES+on+Windows? -X POST http://user:pwd@ptsv2.com/<PATH>/post


  • You'll need to create a bucket on ptsv2.com and modify the path above accordingly. The URL will look something like ptsv2.com/t/novru-1548469537/post.
  • Some escape sequences have been added that get replaced with SAFR tags that may be useful. You can find more in the SAFR Documentation.
    • #N - Person name (if it was added)
    • #I and #S - The Site (e.g. MWC) and Source (e.g. iPad1) from the SAFR client that's performing recognition.


macOS and Windows 10 come with curl installed by default. If for some reason you need to manually install curl, the curl official source binaries can be downloaded at https://curl.haxx.se/windows/. If you manually install curl, don't forget to add it to your PATH environmental variable.


Test the above by pasting it into a command prompt or terminal window and checking the output on ptsv2.com.  Check that all your variables are passed correctly. Make sure you use the + symbol instead of spaces. Curl on Windows does not like quotes around the -d attribute value.


Add the Script to SAFR Actions Rule


Either replace the default action (the relay-numato.py script) with the curl script or create an Item 2 and add the curl script to the newly created item 2.