<!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><SPAN class=914154208-14062005>The code is based on 
the sample program provided with asterisk-java tutorial, lightly customized to 
match my environment, and included in a jbuilder project; the class 
ManagerConnection belongs to asterisk-java-0.1.jar.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=914154208-14062005>I think my problem 
is in your sentence: 'how is reading the response'; I found no other reference, 
in tutorial or in javadocs, about the way to read it; it may be that the 
ManagerResponse&nbsp;refers to&nbsp;the command itself, which effectively ends 
with success,&nbsp;and does not contain the extension status info: but then, 
where and how have I to search that data?</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=914154208-14062005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=914154208-14062005>Anyway, this is the 
complete code of the program which should inquiry the status of an extension, 
together with its printout. </SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN class=914154208-14062005>Newly 
thanks,</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=914154208-14062005>Franco.</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=914154208-14062005></SPAN></FONT>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=914154208-14062005>===================<BR>=== SOURCE CODE 
===<BR>===================<BR>package astpac;</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=914154208-14062005>import 
java.io.*;<BR>import 
net.sf.asterisk.manager.AuthenticationFailedException;<BR>import 
net.sf.asterisk.manager.ManagerConnection;<BR>import 
net.sf.asterisk.manager.ManagerConnectionFactory;<BR>import 
net.sf.asterisk.manager.TimeoutException;<BR>import 
net.sf.asterisk.manager.action.ExtensionStateAction;<BR>import 
net.sf.asterisk.manager.response.ManagerResponse;</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN class=914154208-14062005>public class 
ProActions<BR>{<BR>&nbsp;&nbsp;&nbsp; private ManagerConnection 
managerconnection;<BR>&nbsp;&nbsp;&nbsp; 
/*************************************************/<BR>&nbsp;&nbsp;&nbsp; public 
ProActions() throws IOException<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ManagerConnectionFactory factory 
= new ManagerConnectionFactory();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
this.managerconnection = 
factory.getManagerConnection("172.16.1.151","admin","amp111");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(IOException ie) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(ie.toString() 
+ "[ProActions]");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch(Exception e) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; System.out.println(e.toString() 
+ " [ProActions]");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp; 
/*************************************************/<BR>&nbsp;&nbsp;&nbsp; public 
void run() throws IOException, 
AuthenticationFailedException,<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
TimeoutException<BR>&nbsp;&nbsp;&nbsp; {<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; try 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ManagerResponse 
managerresponse;<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
managerconnection.login();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
ExtensionStateAction extensionstateaction = new 
ExtensionStateAction();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
extensionstateaction.setExten("203");<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
managerresponse = 
managerconnection.sendAction(extensionstateaction,30000);<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println(managerresponse.getResponse());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
managerconnection.logoff();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; catch (Exception e) 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
System.out.println(e.toString());<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
}<BR>&nbsp;&nbsp;&nbsp; }<BR>&nbsp;&nbsp;&nbsp; 
/*************************************************/<BR>&nbsp;&nbsp;&nbsp; public 
static void main(String[] args) throws Exception<BR>&nbsp;&nbsp;&nbsp; 
{<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; ProActions proactions = new 
ProActions();<BR>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; 
proactions.run();<BR>&nbsp;&nbsp;&nbsp; }<BR>}</SPAN></FONT></DIV>
<DIV>&nbsp;</DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=914154208-14062005>=======================================<BR>=== OUTPUT 
GENERATED BY THE PROGRAM 
===<BR>=======================================<BR>&nbsp;<BR>C:\JBuilder9\jdk1.4\bin\javaw 
-classpath </SPAN></FONT><FONT face=Arial size=2><SPAN 
class=914154208-14062005>"C:\swdev\agsm\astproof\classes;C:\swdev\agsm\asterisk-java-0.1\asterisk-java-0.1.jar;C:\JBuilder9\jdk1.4\demo\jfc\Java</SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=914154208-14062005>2D\Java2Demo.jar;C:\JBuilder9\jdk1.4\demo\plugin\jfc\Java2D\Java2Demo.jar;C:\JBuilder9\jdk1.4\jre\lib\charsets.jar;C:\J</SPAN></FONT><FONT 
face=Arial size=2><SPAN 
class=914154208-14062005>Builder9\jdk1.4\jre\lib\ext\dnsns.jar;C:\JBuilder9\jdk1.4\jre\lib\ext\ldapsec.jar;C:\JBuilder9\jdk1.4\jre\lib\ext\local</SPAN></FONT><FONT 
face=Arial size=2><SPAN 
class=914154208-14062005>edata.jar;C:\JBuilder9\jdk1.4\jre\lib\ext\sunjce_provider.jar;C:\JBuilder9\jdk1.4\jre\lib\im\indicim.jar;C:\JBuilder9\j</SPAN></FONT><FONT 
face=Arial size=2><SPAN 
class=914154208-14062005>dk1.4\jre\lib\jaws.jar;C:\JBuilder9\jdk1.4\jre\lib\jce.jar;C:\JBuilder9\jdk1.4\jre\lib\jsse.jar;C:\JBuilder9\jdk1.4\jre</SPAN></FONT><FONT 
face=Arial size=2><SPAN 
class=914154208-14062005>\lib\rt.jar;C:\JBuilder9\jdk1.4\jre\lib\sunrsasign.jar;C:\JBuilder9\jdk1.4\lib\dt.jar;C:\JBuilder9\jdk1.4\lib\htmlconve</SPAN></FONT><FONT 
face=Arial size=2><SPAN 
class=914154208-14062005>rter.jar;C:\JBuilder9\jdk1.4\lib\tools.jar"&nbsp; 
-Xdebug -Xnoagent -Djava.compiler=NONE </SPAN></FONT><FONT face=Arial 
size=2><SPAN 
class=914154208-14062005>-Xrunjdwp:transport=dt_socket,address=francobaldi-xp:1207,suspend=y 
astpac.ProActions <BR>14-giu-2005 10.24.49 
net.sf.asterisk.util.impl.JavaLoggingLog info<BR>INFO: Connecting to 
172.16.1.151 port 5038<BR>14-giu-2005 10.24.50 
net.sf.asterisk.util.impl.JavaLoggingLog info<BR>INFO: Connected via Asterisk 
Call Manager/1.0<BR>14-giu-2005 10.24.50 
net.sf.asterisk.util.impl.JavaLoggingLog info<BR>INFO: Successfully logged 
in<BR>14-giu-2005 10.24.50 net.sf.asterisk.util.impl.JavaLoggingLog 
info<BR>INFO: Reached end of stream, terminating 
reader.<BR>net.sf.asterisk.manager.response.ManagerResponse: actionId='null'; 
message='Extension Status'; response='Success'; </SPAN></FONT><FONT face=Arial 
size=2><SPAN class=914154208-14062005>uniqueId='null'; 
systemHashcode=751354<BR>14-giu-2005 10.24.50 
net.sf.asterisk.util.impl.JavaLoggingLog info<BR>INFO: Closing 
socket.<BR></SPAN></FONT></DIV>
<DIV><FONT face=Arial size=2><SPAN 
class=914154208-14062005></SPAN></FONT>&nbsp;</DIV></BODY></HTML>