How to get a specific peer status in asterisk

Arun Unnikrishnan picture Arun Unnikrishnan · Jun 18, 2013 · Viewed 9.1k times · Source

Asterisk Call Manager/1.3 .After login I am able to retrieve all peer detail as a string.

fwrite($socket, "Action: Command\r\n");
fwrite($socket, "Command: sip show peer ".$sip_no."\r\n\r\n");

I need to know whether the channel is busy or not.

How Can I get only the status like

function checkstatus(sip_no){
   .....
  return status;
}

Based on the status I need to do further processing.

Answer

Filippos Karapetis picture Filippos Karapetis · Jun 18, 2013

You can query the Asterisk manager and get a response for each of your peers, using the sip command, in your case, i.e.:

sip show peer PEERNAME

Where PEERNAME is the name of your peer.

Here's a page with an example script for this:

http://www.venturevoip.com/news.php?rssid=2217