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.
hope someone can help...
thx in advance
__________________________________________________
Do You Yahoo!?
Tired of spam? Yahoo! Mail has the best spam protection around
http://mail.yahoo.com
I'm no java or Asterisk guru, but, if what you have below is the exact
syntax you are using you might want to look at your capitulation of your
statements. I see "sipShowPeerAction" as well as
"SipShowPeerAction".
If this is of no value please ignore.
Zack
-----Original Message-----
From: asterisk-users-bounces@lists.digium.com
[mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of richard Coco
Sent: Wednesday, October 04, 2006 11:33 AM
To: asterisk-users@lists.digium.com
Subject: [asterisk-users] [Asterisk-Java] SipShowPeerAction
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.
hope someone can help...
thx in advance
__________________________________________________
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
I think you have to implement the ManagerEventHandler interface to handle the
PeerEntryEvent.
ManagerEventHandler mgrHdlr = new ManagerEventHandler {
public void handleEvent(ManagerEvent event) {
PeerEntryEvent peerEntryEvent = (PeerEntryEvent) event;
System.out.println(peerEntryEvent.getStatus());
}
}
And you have to register to receive your eventHandler
managerConnection.addEventHandle(mgrHdlr);
HTH.
richard Coco <coco_richard@yahoo.com> 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.
hope someone can help...
thx in advance
-------------- next part --------------
An HTML attachment was scrubbed...
URL:
http://lists.digium.com/pipermail/asterisk-users/attachments/20061004/80543b4c/attachment.htm
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