Re: [Asterisk-java-devel] Retrieve list of all live extensions...
Brought to you by:
srt
From: Yves A. <yv...@gm...> - 2010-04-08 20:51:21
|
Hi, afaik, the feature you´re looking for is not that much "wishful thinking"... it is not impossible, but the amount of work you have to do also depends on the asterisk-version you are using. As i mentioned... depending on the asterisk-version, you could use: (*) 1st) "SIP subscriptions" this feature is known as BLF (Busy Line Feature) or Presence / HINTs. 2nd) since asterisk 1.6 via DEVSTATE (afaik there is a backport for asterisk 1.4) 3rd) Implement it yourself using listeners for peer-, extension- and channelevents.. and... there may be other ways that I am not aware right now.... (*) try to google for more information about the listed possibilities if one of them is of interest for you. If you're encountering problems in configuring one of the mentioned features, you could also mail the asterik-users mailing list for help as this is going to be out of focus of the asterisk-java mailing list. Makon Maki schrieb: > 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 > > _______________________________________________________________ > Get the Free email that has everyone talking at http://www.mail2world.com > Unlimited Email Storage – POP3 – Calendar – SMS – Translator – Much More! > > ------------------------------------------------------------------------ > > ------------------------------------------------------------------------------ > Download Intel® Parallel Studio Eval > Try the new software tools for yourself. Speed compiling, find bugs > proactively, and fine-tune applications for parallel performance. > See why Intel Parallel Studio got high marks during beta. > http://p.sf.net/sfu/intel-sw-dev > ------------------------------------------------------------------------ > > _______________________________________________ > Asterisk-java-devel mailing list > Ast...@li... > https://lists.sourceforge.net/lists/listinfo/asterisk-java-devel > |