|
Migrating from JAGIServerOrderlyCalls contains code from the JAGIServer project to handle Asterisk FastAGI. In addition to Manager support, OrderlyCalls offers an extensible Named Service architecture, and extensible XML configuration, so JAGIServer users hould migrate their code to OrderlyCalls. OrderlyCalls also contains a number of bug fixes and performance enhancements compared with the JAGIServer release, which is no longer supported, as OrderlyCalls supercedes it in every way. OrderlyCalls has designed with ease of migration in mind, so please follow these instructions to migrate your code. If you find that you need to make any additional changes as a result of migration, please email us so we can add the details to these instructions. Step 1: Change
|
Classes | |||
JAGIServer | OrderlyCalls | ||
JAGIProcessor | AGIProcessor | ||
JAGIClient | AGIConnection | ||
JAGIServer | AGIServer |
You should change all declared references to use the new classes. You should also make sure your old JAGIProcessors implement the new AGIProcessor interface instead.
Step 3: Update Function Calls
AGIClient (JAGIConnection)
Function names have been preserved, except for the getContextProperty()
functions, which have been renamed getAGIProperty()
for clarity.
AGIServer (JAGIServer)
This class has been modified extensively, and the old getJAGIServer(processorName, port, reuse)
function is no longer supported as OrderlyCalls uses Settings objects to encapsulate initialisation parameters.
- Preferably, you should use OrderlyCalls to specify this information as a Named Service in the configuration XML file. You can then get a running instance of the new AGIServer by calling
OrderlyCalls.getService(name)
orAGIServer.getInstance(name)
.
You can access the OrderlyCalls functions either by running OrderlyCalls as a stand-alone application server, or by callingOrderlyCalls.init(File f)
from within your own code. - Alternatively, you may get a running instance of AGIServer without OrderlyCalls as follows:
String processorName="com.mypackage.MyProcessor"; int port=4573; String name="myAGIServer"; AGIServer agiServer=null; try { AGISettings settings = new AGISettings(); settings.setProcessorClass(Class.forName(processorName)); settings.setName(name); AGISettings.BindSettings bs = settings.new BindSettings(); bs.setAddress(new InetSocketAddress(port)); agiServer=AGIServer.getInstance(settings); } catch (Exception e) { System.out.println("Error while creating server:"); e.printStackTrace(); }
You can get the same instance subsequently by calling AGIServer.getInstance(name)
.
You should also replace calls to jagiServer.cease()
with agiServer.shutdown()
.
Step 4: Upgrade your Processors (Optional)
Once you've got a working system, you should consider upgrading your AGIProcessors to implement the AGIReusableProcessor interface for more efficient object reuse, and greater performance.
Please see the API Javadocs for further details.
Copyright © Orderly Software 2004-2005, All Rights Reserved.