The idea is to monitor the connection of SIP clients to an Asterisk server. SIP clients could be for example important phones or a SIP uplink to a provider.
The attached SIPPeerPoller connects to an Asterisk box using the Asterisk Manager Interface (AMI) and executes a sip show peers command and checks the connection state for a given SIP peer. (it has to be configured in Asterisk's sip.conf, that Asterisk monitors the connection to that SIP peer with the option qualify=yes option). If the result from asterisk is "OK (x ms)", then the poller gives back an up message, if not it gives back a down message.
The monitor reads the OpenNMS AMI configuration file (ami-config.xml) to get the data accessing the asterisk box. In the poller-configuration.xml it needs the parameter sip-peer to be set as the sip peer, that should be monitored. Here is an example:
Ronny has done some refactoring for better JUnit testing:
In the attachment, there is also a patched opennms-asterisk.jar file for the OpenNMS/lib directory, if somebody wants to try it.