Re: [Asterisk-java-devel] Retrieve list of all live extensions...
Brought to you by:
srt
From: Makon M. <mac...@ma...> - 2010-04-08 01:23:40
|
Hi Yves, Thanks for your prompt reply... I'm sorry I've emailed you directly 'cause I really didn't know how to reply to the list so that it would continue my original thread instead of creating a new one. I've had success with getting the extension status (reachable, registered etc.) when an extension comes online but still unable to figure out how to get extension state as in whether it is off-hook or idle. Is there a way to get such an extension state or is it just wishful thinking. Here is some code of how I got the PeerEntryEvents and PeerStatusEvents while running the class as a thread so it continuously keeps sending the SipPeersAction. /** * This method sets up the StatusAction which requests the state of all * active channels */ public void readAsteriskStatus() { try { managerConnection.sendAction(new StatusAction()); } catch (Exception e) { utility.logE(classCode, "readAsteriskStatus", e); } } /** * This method sets up the SipPeersAction which requests status of all active * extensions */ public void readPeerStatus() { try { managerConnection.sendAction(new SipPeersAction()); } catch (Exception e) { utility.logE(classCode, "readPeerStatus", e); } } /** * Event handler for a PeerEntryEvent on the CAN Server */ public void handleEvent(PeerEntryEvent event) { utility.logA("PeerEntryEvent", "Handle PeerEntry Event"); printPeerEntry(event); } /** * Event handler for a PeerStatusEvent on the CAN Server */ public void handleEvent(PeerStatusEvent event) { utility.logA("PeerStatusEvent", "Handle PeerStatus Event"); printPeerStatus(event); } private void printPeerEntry(PeerEntryEvent e) { System.out.println("---PeerEntry---------------------"); System.out.println("ActionID " + e.getActionId()); System.out.println("ChannelType " + e.getChannelType()); System.out.println("File " + e.getFile()); System.out.println("ChanObjType " + e.getChanObjectType()); System.out.println("Server " + e.getServer()); System.out.println("Privilege " + e.getPrivilege()); System.out.println("Function " + e.getFunc()); System.out.println("SeqNo " + e.getSequenceNumber()); System.out.println("Timestamp " + e.getTimestamp()); System.out.println("DateReceived " + e.getDateReceived()); System.out.println("Line " + e.getLine()); System.out.println("Encryption " + e.getEncryption()); System.out.println("InternalActID " + e.getInternalActionId()); System.out.println("IPAddress " + e.getIpAddress()); System.out.println("ObjectName " + e.getObjectName()); System.out.println("ObjUserName " + e.getObjectUserName()); System.out.println("RealTymDevice " + e.getRealtimeDevice()); System.out.println("Status " + e.getStatus()); System.out.println("------------------------"); } private void printPeerStatus(PeerStatusEvent e) { System.out.println("---PeerStatus---------------------"); System.out.println("Address " + e.getAddress()); System.out.println("ChannelType " + e.getChannelType()); System.out.println("File " + e.getFile()); System.out.println("Cause " + e.getCause()); System.out.println("Server " + e.getServer()); System.out.println("Privilege " + e.getPrivilege()); System.out.println("Function " + e.getFunc()); System.out.println("SeqNo " + e.getSequenceNumber()); System.out.println("Timestamp " + e.getTimestamp()); System.out.println("DateReceived " + e.getDateReceived()); System.out.println("Line " + e.getLine()); System.out.println("Peer " + e.getPeer()); System.out.println("PeerStatus " + e.getPeerStatus()); System.out.println("Port " + e.getPort()); System.out.println("------------------------"); } Thank your for your help, Makon <span id=m2wTl><p><font face="Arial, Helvetica, sans-serif" size="2" style="font-size:13.5px">_______________________________________________________________<BR>Get the Free email that has everyone talking at <a href=http://www.mail2world.com target=new>http://www.mail2world.com</a><br> <font color=#999999>Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much More!</font></font></span> |