Poll SIP line to check availability

Hi, I have setup a SIP line on my asterisk and configured it on my server. Now I need to monitor the status of my SIP line whether it is up or not at regular intervals.

The issue is basically because asterisk stops responding to the incoming calls sometimes and when user call he keeps getting a busy tone. Later when I restart asterisk the line starts working fine.

I tried adding automated calls from another server but it did not prove to be a good solution as the calls were chargeable. I had also installed asterisk in debug_mode to get a trace of asterisk if it goes down and to detect in case of any deadlocks but there was no such trace created when the line was showing busy.

Is there any other way that I can poll the SIP line from asterisk to get a signal which returns the status of the line so that I can be notified if Line is in working state or not?

While you can’t poll the “line” you can set qualify=yes (if using chan_sip) or qualify_frequency=30 (if using chan_pjsip) which will send a message to the device and wait for the response. Do you have NAT in use at all?

Never used but still maybe it will be helpful for you.
app_chanisavail application.

https://wiki.asterisk.org/wiki/display/AST/Asterisk+11+Application_ChanIsAvail
http://www.voip-info.org/wiki/view/Asterisk+cmd+ChanIsAvail

Chanisavail just reads the result of qualify=yes. You will know that the qualify has failed from the logs, without using this.

I had enabled qualify=yes in the setting. The problem is that sometimes the line that I am calling on goes busy and I am unable to detect it. I had even setup automated calls to check the availability of the line but even that did not work. The problem is that everything looks fine on asterisk but the line keeps giving a busy message. Though everything works fine once I restart asterisk. Basically, I need a system wherein I can get the status of my line on regular intervals so that in a production scenario I am able to monitor it.

No NAT is not used on this server.