Turn on more accessible mode
Skip Ribbon Commands
Skip to main content
SIP Stack Monitoring
One of the features of Interaction Monitor is the ability for it to poll SIP devices and make sure that the SIP stack was responding to messages properly.  It was a request from support to add that feature because the Interaction Gateway could sometimes hit a deadlock which would cause the SIP stack to stop responding.  According to source control, I wrote that feature in September of 2007 back when software engineering was very different then it is today.  Interaction Monitor is a c# based service and at the time we decided to use our internal SIPEngine library which was unfortunately c++ based, so we had to write a managed c++ wrapper to be able to use it in the project.  The entire process took several week from learning how SIPEngine worked, to writing the wrapper to doing the client and server work in Interaction Monitor.  

I decided to give it another go this week to see how easy things would be today and was pleasantly surprised.  First let met give an overview of the SIP OPTIONS message because it is at the core of ho​w this application works.  When an OPTIONS message is sent to a SIP device, it is a query for what capabilities the server has.  It is a message that doesn't have any pre-requirements to be sent and doesn't effect the state of the server.  

When looking to rewrite the functionality, I had three goals.
  1. Send OPTIONS messages to devices and get responses
  2. Have a UI to show the status
  3. Be able to report status changes via Email and Webhooks 

I decided the simplest way to achieve these was by using NodeJS.  NodeJS has simple support for web UIs, a web server was a bit simpler to architect than a client/server model but the only thing I was worried about was how to send the OPTIONS messages.  One of the things that has changed the most from 2007 is the increase in free and open source libraries available for use so I started a search and ended up settling on the sip.js SIP stack.  This library allowed me to not have to worry about making sure the message was properly formatted or synchronize responses to requests and let me send an OPTIONS message and handle the result in a line of code.

The UI is fairly simple, just a web page with a table of devices and polls the server for updates.
While not the greatest UI I've ever designed, it satisfied my second requirement.  The last requirement of outbound notifications was also achieved simple by another open source package emailjs and the NodeJS http package.  Both made it super simple to send the notifications.  The webhook is just an outbound HTTP POST to a web service with a JSON payload of information about the server and the status of the server; it can be used to kick off other processes from the web service.

The end result is a project that is less than 200 lines of code and took under 3 hours to research and write, much simpler than writing it into Interaction Monitor years ago.  The full project can be found with our other open source code on GitHub https://github.com/InteractiveIntelligence/sip_stack_verification​