<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML><HEAD>
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=us-ascii">
<TITLE>Messaggio</TITLE>
<META content="MSHTML 6.00.2900.2627" name=GENERATOR></HEAD>
<BODY>
<DIV><FONT face=Arial size=2>For a presence application, I need to know the
status (free, ringing, talking) of the phones in the sip network managed by
asterisk; to do this I tried to use Manager Api<SPAN
class=649274310-13062005>.</SPAN> <SPAN class=649274310-13062005>A</SPAN>
little sample java program connects correctly with Asterisk<SPAN
class=649274310-13062005> server </SPAN>and sends the commands to the engine;
but when I look at the response I see always a generic "success"; any action is
then tracked in </FONT><FONT face=Arial size=2>the handleEvent function, but
even here I can see only the event type, the date<SPAN
class=649274310-13062005>, </SPAN>and no status info.<BR>Where have I to look
for the data? <SPAN class=649274310-13062005>does exist </SPAN>a more
complete code sample? or any documentation, <SPAN
class=649274310-13062005>richer</SPAN> than the java docs?</FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=649274310-13062005>thanks in
advance,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=649274310-13062005>Franco.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN
class=649274310-13062005></SPAN></FONT> </DIV>
<DIV><FONT face=Arial size=2>These are excerpts from the code and the resulting
printout: <BR>----------------------<BR>package ....<BR>import
....<BR>public class ProEvents implements ManagerEventHandler<BR>{<BR>....<SPAN
class=649274310-13062005>..</SPAN><BR> public void run()
throws IOException,
AuthenticationFailedException,<BR>
TimeoutException, InterruptedException<BR>
{<BR>
managerconnection.addEventHandler(this);<BR>
managerconnection.login();<BR> ManagerResponse
managerresponse;<BR>
ExtensionStateAction extensionstateaction = new
ExtensionStateAction();<BR>
extensionstateaction.setExten("203");<BR>
managerresponse = managerconnection.sendAction(extensionstateaction,
30000);<BR>
System.out.println("response=" +
managerresponse.getAttribute("response"));<BR>
System.out.println("status=" +
managerresponse.getAttribute("status"));</FONT></DIV>
<DIV><SPAN class=649274310-13062005></SPAN><FONT face=Arial size=2>.<SPAN
class=649274310-13062005>.....</SPAN><BR>
StatusAction statusaction = new
StatusAction();<BR> managerresponse =
managerconnection.sendAction(statusaction,
30000);<BR>
System.out.println("response=" +
managerresponse.getAttribute("response"));<BR>
System.out.println("status=" +
managerresponse.getAttribute("status"));<BR></FONT><FONT><SPAN
class=649274310-13062005></SPAN><FONT face=Arial size=2>.<SPAN
class=649274310-13062005>.....</SPAN><BR>
managerconnection.logoff();<BR> }</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT> </DIV>
<DIV><FONT face=Arial size=2> public void
handleEvent(ManagerEvent event)
{<BR> try {<SPAN
class=649274310-13062005> </SPAN>System.out.println(event.toString());
}<BR>....<SPAN class=649274310-13062005>..</SPAN><BR>
}</FONT></DIV>
<DIV> </DIV>
<DIV><FONT face=Arial size=2> public static void main(String[]
args) throws Exception
{<BR> ProEvents proevents = new
ProEvents();<BR>
proevents.run();<BR> }</FONT></DIV>
<DIV><FONT face=Arial size=2>}</FONT></DIV>
<DIV><FONT face=Arial size=2>---------------------<BR>....<SPAN
class=649274310-13062005>..</SPAN><BR>INFO: Connected via Asterisk Call
Manager/1.0net.sf.asterisk.manager.event.ConnectEvent: dateReceived=Mon Jun 13
11:36:49 <BR>CEST 2005; systemHashcode=23047631<BR>....<SPAN
class=649274310-13062005>..</SPAN><BR>INFO: Successfully logged
in<BR></FONT></DIV>
<DIV><FONT><FONT face=Arial
size=2>response=Success<BR>status=-1<BR>message=Extension
Status<BR>context=default<BR>actionid=4898828_2#<BR>exten=203<BR>channel=null<BR><SPAN
class=649274310-13062005> </SPAN></FONT></FONT></DIV>
<DIV><FONT><FONT><SPAN class=649274310-13062005></SPAN><FONT face=Arial
size=2>net.sf.asterisk.manager.event.StatusCompleteEvent: dateReceived=Mon Jun
13 12:21:25 CEST 2005;
systemHashcode=6166383<BR>response=Success<BR>status=null<BR>message=Channel
status will follow<BR>context=null<BR>actionid=4898828_3#<BR>exten=null<BR><SPAN
class=649274310-13062005> </SPAN></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT><SPAN class=649274310-13062005></SPAN><FONT face=Arial
size=2>net.sf.asterisk.manager.event.NewChannelEvent: dateReceived=Mon Jun 13
12:21:40 CEST 2005;
systemHashcode=22323092<BR>net.sf.asterisk.manager.event.NewExtenEvent:
dateReceived=Mon Jun 13 12:21:40 CEST 2005;
systemHashcode=17478435<BR>net.sf.asterisk.manager.event.NewExtenEvent:
dateReceived=Mon Jun 13 12:21:40 CEST 2005;
systemHashcode=24569170<BR>net.sf.asterisk.manager.event.NewExtenEvent:
dateReceived=Mon Jun 13 12:21:40 CEST 2005;
systemHashcode=5309741<BR>net.sf.asterisk.manager.event.NewExtenEvent:
dateReceived=Mon Jun 13 12:21:40 CEST 2005;
systemHashcode=19583390<BR>net.sf.asterisk.manager.event.NewExtenEvent:
dateReceived=Mon Jun 13 12:21:40 CEST 2005;
systemHashcode=2628939<BR>net.sf.asterisk.manager.event.NewExtenEvent:
dateReceived=Mon Jun 13 12:21:40 CEST 2005;
systemHashcode=23994289<BR>net.sf.asterisk.manager.event.NewExtenEvent:
dateReceived=Mon Jun 13 12:21:42 CEST 2005;
systemHashcode=14863189<BR>net.sf.asterisk.manager.event.NewExtenEvent:
dateReceived=Mon Jun 13 12:21:42 CEST 2005;
systemHashcode=26435810<BR>net.sf.asterisk.manager.event.NewExtenEvent:
dateReceived=Mon Jun 13 12:21:43 CEST 2005;
systemHashcode=12432643<BR>net.sf.asterisk.manager.event.NewStateEvent:
dateReceived=Mon Jun 13 12:21:43 CEST 2005; systemHashcode=11985823<BR>...<SPAN
class=649274310-13062005>...</SPAN><BR>net.sf.asterisk.manager.event.DisconnectEvent:
dateReceived=Mon Jun 13 12:21:55 CEST 2005; systemHashcode=7056873<BR>...<SPAN
class=649274310-13062005>...</SPAN></FONT></FONT></FONT></FONT></DIV>
<DIV><FONT><FONT><FONT><FONT face=Arial size=2><SPAN
class=649274310-13062005></SPAN>INFO: Closing
socket.<BR></DIV></FONT></FONT></FONT></FONT></BODY></HTML>