what exactly are you trying to do? The idea behind the Fast-AGI asterisk-java integration is generally to leave a JVM running to handle AGI requests, as opposed to shutting down the server after each request.
I assume you are trying to originate a call and then hand off control to an AGI script? If that is the case then you will need to do some dialplan programming as well as java programming.
You will need an extension in your dialplan which will call the AGI:// script. Once you have that then you should originate your call (probably via a Local channel) to the context/extension/priority which calls your AGI.
One the java side, you should do things in about this order:
[on startup]
Manager Connection/Login
Start AGI Server
[on some event this is probably repeated many times]
Issue Originate
Process AGI Script
Rinse/Repeat
Hi, thanks for the information. I did the DefaultAgiServer and is running on JVM. I also have a class that is extending the BaseAgiScript so that it will be called on my extension. My problem is, how can I return the data from the class that extends BaseAgiScript to other class?
Here is my code,
System.out.println("-------------------------");
System.out.println(data);
System.out.println("-------------------------");
}[/code]This code prints the [b]data[/b] but cannot passed to other class inside the java project because the [b]extension[/b] is the one calling this class.
Now we are really getting into Java programming and not so much Asterisk or even Asterisk-Java
You have a common problem which is that one thread needs to provide data or notifications to another thread. There are some nice Java classes which can help facilitate this, but you will need to be creative in your solutions.
This, like most ‘problems’ in programming there are multiple paths to the same destination. You need to become familiar with the environment you are working with before you can become truly creative in your problem solving.
Just to give you a kick in the right direction… One thing you could do is delcare a static java.util.concurrent.LinkedBlockingQueue at the Main class level. You could poll this blocking queue from one thread and push data into it from the other. It would facilitate an asynchronous data transfer from thread A to thread B.