Bharat M. Sarvan
2005-Aug-04 05:55 UTC
[Asterisk-Users] SIPPeersAction class file not found in the Asterisk-java.jar file
Hello Everybody, I am working on Fastagi and I am making use of Asterisk-java. But I don't find the class file for SIPPeersAction. Hence I am getting the error message when compiling my java code. ---------------------------------------------------------------------------- ------------------------------------------------ [root@localhost asterisk-java-0.1]# javac -classpath asterisk-java-0.1.jar HelloScript.java HelloScript.java:9: cannot resolve symbol symbol : class AbstractManagerAction location: package action import net.sf.asterisk.manager.action.AbstractManagerAction; ^ HelloScript.java:22: cannot resolve symbol symbol : class SIPPeersAction location: class HelloScript SIPPeersAction showpeers; ^ HelloScript.java:23: cannot resolve symbol symbol : class SIPPeersAction location: class HelloScript showpeers =new SIPPeersAction(); ^ 3 errors ---------------------------------------------------------------------------- ------------------------------------------------------------------- Well this is the code that I am compiling ----------------------------------CODE-------------------------------------- --------------------------------------------------- import java.io.IOException; import java.lang.String; import java.lang.Object; import net.sf.asterisk.fastagi.AGIChannel; import net.sf.asterisk.fastagi.AGIException; import net.sf.asterisk.fastagi.AGIRequest; import net.sf.asterisk.fastagi.AbstractAGIScript; import net.sf.asterisk.fastagi.command.*; import net.sf.asterisk.manager.action.AbstractManagerAction; import net.sf.asterisk.manager.action.CommandAction; public class HelloScript extends AbstractAGIScript { public void service(AGIRequest request, AGIChannel channel) throws AGIException { SIPPeersAction showpeers; showpeers =new SIPPeersAction( ); } } Does anybody have any idea as to where might the problem be..? Please do reply Regards, Bharat M. Sarvan Software Engineer - VoIP EZZI BPO Pvt Ltd., PUNE. -------------- next part -------------- An HTML attachment was scrubbed... URL: http://lists.digium.com/pipermail/asterisk-users/attachments/20050804/5fb0a1b3/attachment.htm
Stefan Reuter
2005-Aug-04 17:47 UTC
[Asterisk-Users] SIPPeersAction class file not found in the Asterisk-java.jar file
On Thu, 2005-08-04 at 18:25 +0530, Bharat M. Sarvan wrote:> I am working on Fastagi and I am making use of > Asterisk-java. But I don?t find the class file for SIPPeersAction.The SIPPeersAction is not part of Asterisk-Java 0.1, it is available in CVS-HEAD only. Besides that the action classes in net.sf.asterisk.manager.action can only be used with the Manager API and not with FastAGI. So if you want to retrieve a list of sip peers you need to do that via the Manager API. With Asterisk 1.0.x and Asterisk-Java 0.1 you can do this via the CommandAction. Only if you are already using Asterisk CVS-HEAD and Asterisk-Java CVS-HEAD you can use the new SipPeerAction. Example with CommandAction: import java.util.Iterator; import net.sf.asterisk.manager.ManagerConnection; import net.sf.asterisk.manager.ManagerConnectionFactory; import net.sf.asterisk.manager.action.CommandAction; import net.sf.asterisk.manager.response.CommandResponse; public class Manager { private ManagerConnection c; public Manager() throws Exception { c = new ManagerConnectionFactory().getManagerConnection("host", "user", "pass"); } public void run() throws Exception { c.login(); CommandAction action; CommandResponse response; Iterator lineIterator; action = new CommandAction(); action.setCommand("sip show peers"); response = (CommandResponse) c.sendAction(action); lineIterator = response.getResult().iterator(); while (lineIterator.hasNext()) { System.out.println(lineIterator.next()); } c.logoff(); } public static void main(String[] args) throws Exception { new Manager().run(); } } This produces something like: Name/username Host Dyn Nat ACL Mask Port Status 1313/1313 10.13.0.61 D A 255.255.255.255 5061 Unmonitored 1312/1312 10.13.0.61 D A 255.255.255.255 5061 Unmonitored 1311/1311 10.13.0.61 D A 255.255.255.255 5061 Unmonitored 1310/1310 (Unspecified) D A 255.255.255.255 0 Unmonitored 1303/1303 (Unspecified) D N 255.255.255.255 0 Unmonitored 1302/1302 (Unspecified) D A 255.255.255.255 0 Unmonitored 1301/1301 (Unspecified) D A 255.255.255.255 0 Unmonitored =Stefan
Bharat M. Sarvan
2005-Aug-08 04:01 UTC
[Asterisk-Users] SIPPeersAction class file not foundintheAsterisk-java.jar file
Ok Mr. Stefan, The contents of the file fastagi-mapping.properties are as follows Hello.agi = ManagerAPI Where ManagerAPI is my class filename ManagerAPI.class. And the directory structure is as given below: /home/Bharat/AGISERVER/BharatJava/ Where the BharatJava directory holds the files fastagi-mapping.properties asterisk-java-0.1.jar and the .java files And the Asterisk server is running on Fedora Core 1. I start the asterisk server using the command "asterisk -vvvvvvvvvvvvvvvvvvvv" at the command prompt. So I was having doubt about the execution of the part of the code you have sent me where we login into the Asterisk server using the class ManagerConnection. Is there any way out so that I can issue the command other than using the sendAction Method of the ManagerConnection to which I pass the object of the class CommandAction. My asterisk server is already up and running. I just need to issue the command using the CommandAction. But even if I run the sample code "ManagerAPI" given on the link http://asterisk-java.sourceforge.net/tutorial.html. I am getting the error for "No script configured for agi://" Please do reply as to how I get through this problem... Regards, Bharat M. Sarvan Software Engineer - VoIP EZZI BPO Pvt Ltd., PUNE. -----Original Message----- From: asterisk-users-bounces@lists.digium.com [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Stefan Reuter Sent: Saturday, August 06, 2005 7:02 AM To: Asterisk Users Mailing List - Non-Commercial Discussion Subject: RE: [Asterisk-Users] SIPPeersAction class file not foundintheAsterisk-java.jar file Hi,> I have all the necessary files for the code to be executed. The > fastagi-mapping.properties file is also correct. But still I am gettingthe> error for > > The IP address is correct and as well as the agi file name. Does it make a > difference giving a Tab or a space when giving the mapping of agi filename> and class file name in the fastagi-mapping.properties file.no that makes no difference> Is there any other reason for getting this error....no please post the contents of fastagi-mapping.properties, your directory structure and the command you use to run java. and please note: THERE IS NO WAY TO GET SIP PEERS VIA FASTAGI ANYWAY! =Stefan _______________________________________________ Asterisk-Users mailing list Asterisk-Users@lists.digium.com http://lists.digium.com/mailman/listinfo/asterisk-users To UNSUBSCRIBE or update options visit: http://lists.digium.com/mailman/listinfo/asterisk-users
Stefan Reuter
2005-Aug-08 14:05 UTC
[Asterisk-Users] SIPPeersAction class file not foundintheAsterisk-java.jar file
You dont run applications using the Manager API as AGI scripts but as standalone Java applications. So in you case proably via java -cp asterisk-java-0.1.jar:. ManagerAPI =Stefan On Mon, 2005-08-08 at 16:31 +0530, Bharat M. Sarvan wrote:> Ok Mr. Stefan, > The contents of the file fastagi-mapping.properties are as > follows > > Hello.agi = ManagerAPI > > Where ManagerAPI is my class filename ManagerAPI.class. > > And the directory structure is as given below: > > /home/Bharat/AGISERVER/BharatJava/ > > Where the BharatJava directory holds the files > > fastagi-mapping.properties > asterisk-java-0.1.jar > and the .java files > > > > And the Asterisk server is running on Fedora Core 1. I start the asterisk > server using the command "asterisk -vvvvvvvvvvvvvvvvvvvv" at the command > prompt. > > So I was having doubt about the execution of the part of the code you have > sent me where we login into the Asterisk server using the class > ManagerConnection. > > Is there any way out so that I can issue the command other than using the > sendAction Method of the ManagerConnection to which I pass the object of the > class CommandAction. > > My asterisk server is already up and running. I just need to issue the > command using the CommandAction. But even if I run the sample code > "ManagerAPI" given on the link > http://asterisk-java.sourceforge.net/tutorial.html. I am getting the error > for "No script configured for agi://" > > Please do reply as to how I get through this problem... > > > > > > Regards, > Bharat M. Sarvan > Software Engineer - VoIP > EZZI BPO Pvt Ltd., > PUNE. > > -----Original Message----- > From: asterisk-users-bounces@lists.digium.com > [mailto:asterisk-users-bounces@lists.digium.com] On Behalf Of Stefan Reuter > Sent: Saturday, August 06, 2005 7:02 AM > To: Asterisk Users Mailing List - Non-Commercial Discussion > Subject: RE: [Asterisk-Users] SIPPeersAction class file not > foundintheAsterisk-java.jar file > > Hi, > > > I have all the necessary files for the code to be executed. The > > fastagi-mapping.properties file is also correct. But still I am getting > the > > error for > > > > The IP address is correct and as well as the agi file name. Does it make a > > difference giving a Tab or a space when giving the mapping of agi file > name > > and class file name in the fastagi-mapping.properties file. > > no that makes no difference > > > Is there any other reason for getting this error.... > > no > please post the contents of fastagi-mapping.properties, your directory > structure and the command you use to run java. > and please note: THERE IS NO WAY TO GET SIP PEERS VIA FASTAGI ANYWAY! > > =Stefan > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users > > _______________________________________________ > Asterisk-Users mailing list > Asterisk-Users@lists.digium.com > http://lists.digium.com/mailman/listinfo/asterisk-users > To UNSUBSCRIBE or update options visit: > http://lists.digium.com/mailman/listinfo/asterisk-users-------------- next part -------------- A non-text attachment was scrubbed... Name: not available Type: application/pgp-signature Size: 189 bytes Desc: This is a digitally signed message part Url : http://lists.digium.com/pipermail/asterisk-users/attachments/20050808/ad69ad61/attachment.pgp