Thread: [Asterisk-java-cvs] CVS: asterisk-java/src/java/net/sf/asterisk/fastagi AGIServer.java,NONE,1.1 AGIR
Brought to you by:
srt
From: Stefan R. <sr...@us...> - 2005-03-08 02:25:47
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3831/src/java/net/sf/asterisk/fastagi Added Files: AGIServer.java AGIResponse.java AGIScript.java Log Message: Added interfaces for the major AGI concepts --- NEW FILE: AGIServer.java --- /* * Copyright 2004-2005 Stefan Reuter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package net.sf.asterisk.fastagi; import java.io.IOException; /** * Listens for incoming AGI connections, reads the inital data and builds an AGIRequest using an * AGIRequestBuilder.<br> * The AGIRequest is then handed over to the appropriate AGIScript for further processing. * * @author srt * @version $Id: AGIServer.java,v 1.1 2005/03/08 02:25:34 srt Exp $ */ public interface AGIServer { /** * Starts this AGIServer.<br> * After calling startup() this AGIServer is ready to receive requests from Asterisk server and * process them. * * @throws IOException if the server socket cannot be bound. * @throws IllegalStateException if this AGIServer is already running. */ void startup() throws IOException, IllegalStateException; /** * Shutdowns this AGIServer.<br> * The server socket is closed and all resources are freed. * * @throws IOException if the connection cannot be shut down. * @throws IllegalStateException if this AGIServer is already shut down or has not yet been started. */ void shutdown() throws IOException, IllegalStateException; } --- NEW FILE: AGIResponse.java --- /* * Copyright 2004-2005 Stefan Reuter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package net.sf.asterisk.fastagi; import java.io.IOException; import net.sf.asterisk.fastagi.command.AGICommand; import net.sf.asterisk.fastagi.reply.AGIReply; /** * Provides the functionality to send AGICommands to Asterisk while handling an AGIRequest.<br> * This interface is supposed to be used by AGIScripts for interaction with the Asterisk server. * * @author srt * @version $Id: AGIResponse.java,v 1.1 2005/03/08 02:25:34 srt Exp $ */ public interface AGIResponse { /** * Sends a command to asterisk and returns the corresponding reply. * * @param command the command to send. * @return the reply of the asterisk server containing the return value. * * @throws IOException if there is a problem sending the command. */ AGIReply sendCommand(AGICommand command) throws IOException; } --- NEW FILE: AGIScript.java --- /* * Copyright 2004-2005 Stefan Reuter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * */ package net.sf.asterisk.fastagi; /** * AGIScripts are used by the AsteriskServer to handle AGIRequests received from the Asterisk * server.<br> * To implement functionality using this framework you have to implement this interface.<br> * Note: The implementation of AGIScript must be threadsafe as only one instance is used by * AsteriskServer to handle all requests to a resource. * * @author srt * @version $Id: AGIScript.java,v 1.1 2005/03/08 02:25:34 srt Exp $ */ public interface AGIScript { /** * The service method is called by the AsteriskServer whenever this AGIScript should handle an * incoming AGIRequest. * * @param request the initial data received from Asterisk when requesting this script. * @param response a handle to communicate with Asterisk such as sending commands in response to * the request. */ void service(final AGIRequest request, final AGIResponse response); } |