Auto-Restart PortSIP WebRTC Gateway when it fails

How to Automatically Restart PortSIP WebRTC Gateway with Service Protector

Monitor the PortSIP WebRTC Gateway Windows Service and keep it running 24/7 — even in the face of crashes and other interruptions.

PortSIP WebRTC Gateway provides an intelligent bridge between traditional Voice over Internet Protocol (VoIP) networks and the Internet. It runs in the background as a Windows Service and automatically starts when your computer boots:

To protect the PortSIP WebRTC Gateway Windows Service with Service Protector:

  1. Download and install PortSIP WebRTC Gateway, if necessary.

    Consult the user guide if you need help setting things up.

  2. Download and install Service Protector, if necessary.

  3. Start Service Protector.

  4. Select Protector > Add to open the Add Protector window:

    Add Protector

  5. On the General tab, in the Service to protect field, choose PortSIP WebRTC Gateway Service.

    You will notice a green circle on the left if the gateway is already running, as was the case on our server:

    PortSIP WebRTC Gateway Windows Service: General Tab

  6. If you are interested in monitoring the gateway's HTTP endpoint and detecting when it stops responding to requests (or returns a 5XX error), click over to the Monitor tab where we'll set up a failure detection script to tell Service Protector when PortSIP WebRTC Gateway has run into trouble.

    1. First, identify the URL that you can use to monitor the gateway. Since we have stuck with the default port, this URL works for us:

      Next, with your URL in hand, follow these instructions to create the failure detection BAT file.

      We have called our file check-webrtc-gateway.bat and placed it in the PortSIP WebRTC Gateway installation folder, "C:\Program Files\PortSIP\WebRTC\".

    2. Now back on the Monitor tab in AlwaysUp, Check the Whenever it fails a "sanity check" box and click the "..." button to open the Configure Sanity Check window.

      Enter the full path to the batch file you created, enclosing the whole value in quotes if it contains a space.

      The default to check every 30 seconds is probably overkill, so change the Every controls to 5 minutes. Of course you can adjust this frequency as you see fit.

      Sanity check settings

      Press the OK button to save your sanity check settings.

    PortSIP WebRTC Gateway Windows Service: Monitor Tab

  7. We're now done configuring PortSIP WebRTC Gateway so click the Save button to record your settings. In a few seconds, an entry will show up in the Service Protector window.

    The service is already being protected from failure, as evidenced by the green shield:

    PortSIP WebRTC Gateway Windows Service: Monitor Tab

  8. That's it! Next time your computer boots, PortSIP WebRTC Gateway will start as normal and Service Protector will begin monitoring the service to promptly restart it if it fails or stops for any reason.

    We encourage you to edit PortSIP WebRTC Gateway in Service Protector and check out the many other settings that may be appropriate for your environment. For example, send an email when the service fails, recycle the gateway during the wee hours to minimize memory leaks, and much more.

Trouble protecting the PortSIP WebRTC Gateway Windows Service?