Hi again, i am still missing something 'cause i am not able to handle the PeerEntryEvent. The other Events are ok. Here is what i did.
public void run() throws IOException, AuthenticationFailedException, TimeoutException { managerConnection.login(); managerConnection.addEventListener(this); SipShowPeerAction sipShowPeerAction = new SipShowPeerAction("2001"); managerConnection.sendAction(sipShowPeerAction); } public void onManagerEvent(ManagerEvent event) { HashMap<String, JButton> hmap = new HashMap<String, JButton>(); hmap.put("SIP/2000", PresenceGUI.sButton2000); hmap.put("SIP/2001", PresenceGUI.sButton2001); hmap.put("SIP/2002", PresenceGUI.sButton2002); hmap.put("SIP/2003", PresenceGUI.sButton2003); hmap.put("SIP/2004", PresenceGUI.sButton2004); if (event instanceof PeerEntryEvent) { System.out.println(((PeerEntryEvent)event).getStatus()); } if (event instanceof PeerStatusEvent) { if (((PeerStatusEvent) event).getPeerStatus().equals(PeerStatusEvent.STATUS_REGISTERED)) { hmap.get(((PeerStatusEvent)event).getPeer()).setIcon(new ImageIcon("personal_green.png")); } if (((PeerStatusEvent) event).getPeerStatus().equals(PeerStatusEvent.STATUS_UNREGISTERED)) { hmap.get(((PeerStatusEvent)event).getPeer()).setIcon(new ImageIcon("personal_gray.png")); } } if (event instanceof NewChannelEvent) { if (((NewChannelEvent) event).getState().equals("Ringing")) { hmap.get(((NewChannelEvent)event).getChannel().substring(0, 8)).setIcon(new ImageIcon("personal_red.png")); } if (((NewChannelEvent) event).getState().equals("Ring")) { hmap.get(((NewChannelEvent)event).getChannel().substring(0, 8)).setIcon(new ImageIcon("personal_red.png")); } } if (event instanceof HangupEvent) { if(((HangupEvent)event).getChannel().substring(0, 5).equals("SIP/2")) { hmap.get(((HangupEvent)event).getChannel().substring(0, 8)).setIcon(new ImageIcon("personal_green.png")); } } } } thx in advance! --- Tim Panton <[EMAIL PROTECTED]> wrote: > > On 4 Oct 2006, at 16:33, richard Coco wrote: > > > Hi all, > > > > first of all sorry for the question. I know there > is > > an asterisk-java mailinglist but i am not > subscribed > > to this list and i am sure there are asterisk-java > > guru on this list who can help me. > > > > I am trying to get the status of a peer using > > "SipShowPeerAction". Unfortunately the getStatus > > method gives me everytime "null". > > > > SipShowPeerAction sipShowPeerAction = new > > SipShowPeerAction("2001"); > > managerConnection.sendAction(sipShowPeerAction); > > PeerEntryEvent peerEntryEvent = new > > PeerEntryEvent(sipShowPeerAction); > > System.out.println(peerEntryEvent.getStatus()); > > > > What wrong with this example? Maybe someone can > give > > me a working example. > > The way Java normally works is that you add register > yourself as an > event listener, and the framework then sends you an > event when > something happens. > > so your class needs to implement > ManagerEventListener > then you say something like : > > void doit(){ > managerConnection.addEventListener(this) > SipShowPeerAction sipShowPeerAction = > newSipShowPeerAction("2001"); > managerConnection.sendAction(sipShowPeerAction); > > } > > public void onManagerEvent(ManagerEvent event) { > if (event instanceof PeerEntryEvent){ > > System.out.println(((PeerEntryEvent)event).getStatus()); > } else { > System.out.println("Some other event"); > } > } > > > Tim Panton > > www.mexuar.com > > > > _______________________________________________ > --Bandwidth and Colocation provided by Easynews.com > -- > > asterisk-users mailing list > To UNSUBSCRIBE or update options visit: > > http://lists.digium.com/mailman/listinfo/asterisk-users > __________________________________________________ Do You Yahoo!? Tired of spam? Yahoo! Mail has the best spam protection around http://mail.yahoo.com _______________________________________________ --Bandwidth and Colocation provided by Easynews.com -- asterisk-users mailing list To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users