I want to be able to check if my primary endpoint is up and running from DialPlan. If my primary is down I want to be able to find out so I can route traffic to a backup endpoint.
For testing, I have used an ip address I know won’t work, 1.1.1.1, I will be referring to this endpoint as the ‘broken primary’. The ‘backup’ endpoint, is an asterisk PBX I have verified works.
I setup OPTIONS pings for both the broken primary and backup, and as expected, I don’t receive a response from the broken primary, but I do receive a response from the working backup. So far so good.
I get the following message from the asterisk CLI to indicate that the broken primary is unreachable after the qualify timeout is reached, as expected.
– Contact X.X.X.X/sip:1.1.1.1:5060 is now Unreachable. RTT: 0.000 msec
The problem is, that I haven’t found a good way to check the qualify status of the ‘broken primary’ endpoint in my dial plan.
I did some research and saw that there was a SIPPEER function, so I tried to register the working backup endpoint as a peer by doing the following in my sip.conf:
[test-peer]
type=friend
context=phone
allow=ulaw,alaw
secret=1234
host=X.X.X.X ; in my conf this is a valid IP
But I get the following error when I run the asterisk CLI, indicating that the peer is unreachable.
[2019-07-31 14:24:48] NOTICE[5691]: chan_sip.c:30181 sip_poke_noanswer: Peer ‘test-peer’ is now UNREACHABLE! Last qualify: 0
So essentially I am asking a few things:
-
Is there an analogous function to SIPPEER for endpoints in dial plan? I didn’t find one after extensive search in the documentation, but I could be wrong. Note that I specifically need something that would tell me if an endpoint is up i.e. the “status” item of SIPPEER as I understand it.
-
Where is the following message logged:
– Contact X.X.X.X/sip:1.1.1.1:5060 is now Unreachable. RTT: 0.000 msec
Perhaps I can check this log and do some parsing to leverage it for my purposes, but I was unable to locate its source. -
Is it even possible in asterisk to determine the status of a remote endpoint using options pings?
*** This is my first post and I am fairly new to asterisk so excuse any missteps in jargon.