<!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>&nbsp;<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?&nbsp;<SPAN class=649274310-13062005>does exist </SPAN>a more 
complete code sample? or any documentation,&nbsp;<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>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>These are excerpts from the code and the resulting 
printout:&nbsp; <BR>----------------------<BR>package ....<BR>import 
....<BR>public class ProEvents implements ManagerEventHandler<BR>{<BR>....<SPAN 
class=649274310-13062005>..</SPAN><BR>&nbsp;&nbsp;&nbsp; public void run() 
throws IOException, 
AuthenticationFailedException,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
TimeoutException, InterruptedException<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
managerconnection.addEventHandler(this);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
managerconnection.login();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ManagerResponse 
managerresponse;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ExtensionStateAction extensionstateaction = new 
ExtensionStateAction();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
extensionstateaction.setExten("203");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
managerresponse = managerconnection.sendAction(extensionstateaction, 
30000);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("response=" + 
managerresponse.getAttribute("response"));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
StatusAction statusaction = new 
StatusAction();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; managerresponse = 
managerconnection.sendAction(statusaction, 
30000);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println("response=" + 
managerresponse.getAttribute("response"));<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
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>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
managerconnection.logoff();<BR>&nbsp;&nbsp;&nbsp; }</FONT></FONT></DIV>
<DIV><FONT face=Arial size=2></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; public void 
handleEvent(ManagerEvent event)&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try {<SPAN 
class=649274310-13062005>&nbsp;</SPAN>System.out.println(event.toString());&nbsp;&nbsp; 
}<BR>....<SPAN class=649274310-13062005>..</SPAN><BR>&nbsp;&nbsp;&nbsp; 
}</FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2>&nbsp;&nbsp;&nbsp; public static void main(String[] 
args) throws Exception&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ProEvents proevents = new 
ProEvents();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
proevents.run();<BR>&nbsp;&nbsp;&nbsp; }</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>&nbsp;</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>&nbsp;</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>