asterisk-java-cvs Mailing List for Asterisk-Java Library (Page 92)
Brought to you by:
srt
You can subscribe to this list here.
2005 |
Jan
(4) |
Feb
(75) |
Mar
(211) |
Apr
(70) |
May
(12) |
Jun
(7) |
Jul
(96) |
Aug
(90) |
Sep
(11) |
Oct
(42) |
Nov
(45) |
Dec
(4) |
---|---|---|---|---|---|---|---|---|---|---|---|---|
2006 |
Jan
(20) |
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
|
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
2007 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
|
Jul
(32) |
Aug
|
Sep
(4) |
Oct
(2) |
Nov
(10) |
Dec
|
2008 |
Jan
|
Feb
|
Mar
|
Apr
|
May
|
Jun
(4) |
Jul
(3) |
Aug
(73) |
Sep
(13) |
Oct
(4) |
Nov
(1) |
Dec
(7) |
2009 |
Jan
(1) |
Feb
(2) |
Mar
(48) |
Apr
(21) |
May
(14) |
Jun
(11) |
Jul
(9) |
Aug
(2) |
Sep
(11) |
Oct
(14) |
Nov
(6) |
Dec
(4) |
2010 |
Jan
(3) |
Feb
(2) |
Mar
|
Apr
|
May
(3) |
Jun
(3) |
Jul
|
Aug
|
Sep
|
Oct
(9) |
Nov
|
Dec
(12) |
2011 |
Jan
(1) |
Feb
(5) |
Mar
(7) |
Apr
(1) |
May
(1) |
Jun
|
Jul
|
Aug
(10) |
Sep
|
Oct
(5) |
Nov
|
Dec
|
2012 |
Jan
(3) |
Feb
|
Mar
(3) |
Apr
|
May
|
Jun
(1) |
Jul
|
Aug
|
Sep
(3) |
Oct
|
Nov
(2) |
Dec
(2) |
2013 |
Jan
|
Feb
(2) |
Mar
(1) |
Apr
(1) |
May
|
Jun
|
Jul
|
Aug
(3) |
Sep
|
Oct
(2) |
Nov
|
Dec
(1) |
2014 |
Jan
|
Feb
|
Mar
(1) |
Apr
|
May
(1) |
Jun
(1) |
Jul
|
Aug
|
Sep
|
Oct
|
Nov
(1) |
Dec
(5) |
2015 |
Jan
(1) |
Feb
|
Mar
|
Apr
(25) |
May
(10) |
Jun
(4) |
Jul
(7) |
Aug
(4) |
Sep
(1) |
Oct
(1) |
Nov
(3) |
Dec
(1) |
2016 |
Jan
|
Feb
(42) |
Mar
(6) |
Apr
(15) |
May
(3) |
Jun
(1) |
Jul
(11) |
Aug
|
Sep
|
Oct
(17) |
Nov
(2) |
Dec
|
2017 |
Jan
|
Feb
(4) |
Mar
(1) |
Apr
(3) |
May
(2) |
Jun
(3) |
Jul
(7) |
Aug
(11) |
Sep
(5) |
Oct
(7) |
Nov
(4) |
Dec
(4) |
2018 |
Jan
(11) |
Feb
(11) |
Mar
(3) |
Apr
|
May
(9) |
Jun
(6) |
Jul
(17) |
Aug
(9) |
Sep
(2) |
Oct
(4) |
Nov
(3) |
Dec
(3) |
2019 |
Jan
(13) |
Feb
(1) |
Mar
(1) |
Apr
|
May
(5) |
Jun
|
Jul
(1) |
Aug
(6) |
Sep
|
Oct
|
Nov
(3) |
Dec
|
2020 |
Jan
(2) |
Feb
(72) |
Mar
(8) |
Apr
(11) |
May
(12) |
Jun
(3) |
Jul
(12) |
Aug
(3) |
Sep
(5) |
Oct
(4) |
Nov
|
Dec
(9) |
2021 |
Jan
|
Feb
(31) |
Mar
(6) |
Apr
(3) |
May
|
Jun
(2) |
Jul
|
Aug
(2) |
Sep
|
Oct
(9) |
Nov
|
Dec
(32) |
2022 |
Jan
(5) |
Feb
(7) |
Mar
(2) |
Apr
(3) |
May
|
Jun
|
Jul
(3) |
Aug
|
Sep
(2) |
Oct
(111) |
Nov
(105) |
Dec
(26) |
2023 |
Jan
(25) |
Feb
(6) |
Mar
(10) |
Apr
(54) |
May
(41) |
Jun
(24) |
Jul
(6) |
Aug
(11) |
Sep
(9) |
Oct
(8) |
Nov
(55) |
Dec
(34) |
2024 |
Jan
(6) |
Feb
(4) |
Mar
|
Apr
|
May
|
Jun
|
Jul
(2) |
Aug
(89) |
Sep
(48) |
Oct
(31) |
Nov
(9) |
Dec
(19) |
2025 |
Jan
(12) |
Feb
(18) |
Mar
(9) |
Apr
(7) |
May
|
Jun
(7) |
Jul
(5) |
Aug
|
Sep
|
Oct
|
Nov
|
Dec
|
From: Stefan R. <sr...@us...> - 2005-03-09 23:33:14
|
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv17393/src/test/net/sf/asterisk/fastagi Added Files: AGIReaderImplTest.java Log Message: Added AGIReader --- NEW FILE: AGIReaderImplTest.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 net.sf.asterisk.fastagi.reply.AGIReply; import net.sf.asterisk.io.SocketConnectionFacade; import org.easymock.MockControl; import junit.framework.TestCase; public class AGIReaderImplTest extends TestCase { private AGIReader agiReader; private MockControl socketMC; private SocketConnectionFacade socket; protected void setUp() throws Exception { super.setUp(); this.socketMC = MockControl.createControl(SocketConnectionFacade.class); this.socket = (SocketConnectionFacade) socketMC.getMock(); this.agiReader = new AGIReaderImpl(socket); } public void testReadReply() throws Exception { AGIReply reply; socket.readLine(); socketMC.setReturnValue("200 result=49 endpos=2240"); socketMC.replay(); reply = agiReader.readReply(); assertEquals("Incorrect status", AGIReply.SC_SUCCESS, reply.getStatus()); assertEquals("Incorrect result", 49, reply.getResult()); socketMC.verify(); } public void testReadReplyInvalidOrUnknownCommand() throws Exception { AGIReply reply; socket.readLine(); socketMC.setReturnValue("510 Invalid or unknown command"); socketMC.replay(); reply = agiReader.readReply(); assertEquals("Incorrect status", AGIReply.SC_INVALID_OR_UNKNOWN_COMMAND, reply.getStatus()); socketMC.verify(); } public void testReadReplyInvalidCommandSyntax() throws Exception { AGIReply reply; socket.readLine(); socketMC .setReturnValue("520-Invalid command syntax. Proper usage follows:"); socket.readLine(); socketMC.setReturnValue(" Usage: DATABASE DEL <family> <key>"); socket.readLine(); socketMC .setReturnValue(" Deletes an entry in the Asterisk database for a"); socket.readLine(); socketMC.setReturnValue(" given family and key."); socket.readLine(); socketMC.setReturnValue(" Returns 1 if succesful, 0 otherwise"); socket.readLine(); socketMC.setReturnValue("520 End of proper usage."); socketMC.replay(); reply = agiReader.readReply(); assertEquals("Incorrect status", AGIReply.SC_INVALID_COMMAND_SYNTAX, reply.getStatus()); assertEquals("Incorrect synopsis", "DATABASE DEL <family> <key>", reply .getSynopsis()); socketMC.verify(); } } |
From: Stefan R. <sr...@us...> - 2005-03-09 23:29:56
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv16393/src/java/net/sf/asterisk/fastagi/reply Modified Files: AGIReply.java Log Message: Fixed comment for SC_INVALID_COMMAND_SYNTAX Index: AGIReply.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply/AGIReply.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -p -r1.5 -r1.6 --- AGIReply.java 9 Mar 2005 20:30:08 -0000 1.5 +++ AGIReply.java 9 Mar 2005 23:29:46 -0000 1.6 @@ -45,7 +45,7 @@ public class AGIReply implements Seriali public static int SC_INVALID_OR_UNKNOWN_COMMAND = 510; /** - * Status code (510) indicating Asterisk was unable to process the + * Status code (520) indicating Asterisk was unable to process the * AGICommand because the syntax used was not correct. This is most likely * due to missing required parameters or additional parameters sent that are * not understood.<br> |
From: Stefan R. <sr...@us...> - 2005-03-09 20:31:47
|
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31610/src/test/net/sf/asterisk/fastagi Added Files: ReplyBuilderImplTest.java Log Message: Added ReplyBuilder --- NEW FILE: ReplyBuilderImplTest.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.util.ArrayList; import java.util.List; import net.sf.asterisk.fastagi.reply.AGIReply; import junit.framework.TestCase; public class ReplyBuilderImplTest extends TestCase { private ReplyBuilderImpl replyBuilder; private List lines; protected void setUp() { this.replyBuilder = new ReplyBuilderImpl(); this.lines = new ArrayList(); } public void testBuildReply() { AGIReply reply; lines.add("200 result=49 endpos=2240"); reply = replyBuilder.buildReply(lines); assertEquals("Incorrect status", AGIReply.SC_SUCCESS, reply.getStatus()); assertEquals("Incorrect result", 49, reply.getResult()); } public void testBuildReplyInvalidOrUnknownCommand() { AGIReply reply; lines.add("510 Invalid or unknown command"); reply = replyBuilder.buildReply(lines); assertEquals("Incorrect status", AGIReply.SC_INVALID_OR_UNKNOWN_COMMAND, reply.getStatus()); } public void testBuildReplyInvalidCommandSyntax() { AGIReply reply; lines.add("520-Invalid command syntax. Proper usage follows:"); lines.add(" Usage: DATABASE DEL <family> <key>"); lines.add(" Deletes an entry in the Asterisk database for a"); lines.add(" given family and key."); lines.add(" Returns 1 if succesful, 0 otherwise"); lines.add("520 End of proper usage."); reply = replyBuilder.buildReply(lines); assertEquals("Incorrect status", AGIReply.SC_INVALID_COMMAND_SYNTAX, reply.getStatus()); assertEquals("Incorrect synopsis", "DATABASE DEL <family> <key>", reply .getSynopsis()); assertEquals( "Incorrect usage", "Deletes an entry in the Asterisk database for a given family and key. Returns 1 if succesful, 0 otherwise", reply.getUsage()); } public void testBuildReplyNoLines() { AGIReply reply; reply = replyBuilder.buildReply(lines); assertNull(reply); } } |
From: Stefan R. <sr...@us...> - 2005-03-09 20:31:47
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31610/src/java/net/sf/asterisk/fastagi Added Files: ReplyBuilderImpl.java ReplyBuilder.java Log Message: Added ReplyBuilder --- NEW FILE: ReplyBuilderImpl.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.util.List; import java.util.regex.Matcher; import java.util.regex.Pattern; import net.sf.asterisk.fastagi.reply.AGIReply; /** * Default implementation of the ReplyBuilder interface. * * @author srt * @version $Id: ReplyBuilderImpl.java,v 1.1 2005/03/09 20:31:35 srt Exp $ */ public class ReplyBuilderImpl implements ReplyBuilder { private static final Pattern STATUS_PATTERN = Pattern .compile("^(\\d{3})[ -]"); private static final Pattern RESULT_PATTERN = Pattern .compile("^200 result=(\\d+) "); private static final Pattern SYNOPSIS_PATTERN = Pattern .compile("^\\s*Usage:\\s*(.*)\\s*$"); private static final String END_OF_PROPER_USAGE = "520 End of proper usage."; public AGIReply buildReply(List lines) { String firstLine; AGIReply reply; Matcher statusMatcher; Matcher resultMatcher; if (lines.size() == 0) { return null; } reply = new AGIReply(); firstLine = (String) lines.get(0); statusMatcher = STATUS_PATTERN.matcher(firstLine); if (statusMatcher.find()) { reply.setStatus(Integer.parseInt(statusMatcher.group(1))); } resultMatcher = RESULT_PATTERN.matcher(firstLine); if (resultMatcher.find()) { reply.setResult(Integer.parseInt(resultMatcher.group(1))); } if (reply.getStatus() == AGIReply.SC_INVALID_COMMAND_SYNTAX) { StringBuffer usageSB; if (lines.size() > 1) { String secondLine; Matcher synopsisMatcher; secondLine = (String) lines.get(1); synopsisMatcher = SYNOPSIS_PATTERN.matcher(secondLine); if (synopsisMatcher.find()) { reply.setSynopsis(synopsisMatcher.group(1)); } } usageSB = new StringBuffer(); for (int i = 2; i < lines.size(); i++) { String line; line = (String) lines.get(i); if (END_OF_PROPER_USAGE.equals(line)) { break; } usageSB.append(line.trim()); usageSB.append(" "); } reply.setUsage(usageSB.toString().trim()); } return reply; } } --- NEW FILE: ReplyBuilder.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.util.List; import net.sf.asterisk.fastagi.reply.AGIReply; /** * Transforms a List of lines to instances of AGIReply. * * @author srt * @version $Id: ReplyBuilder.java,v 1.1 2005/03/09 20:31:35 srt Exp $ */ public interface ReplyBuilder { /** * Transforms a List of lines read from Asterisk to an appropriate AGIReply. * * @param lines the lines read from Asterisk * @return the appropriate AGIReply */ AGIReply buildReply(List lines); } |
From: Stefan R. <sr...@us...> - 2005-03-09 20:30:21
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31178/src/java/net/sf/asterisk/fastagi/reply Modified Files: AGIReply.java Log Message: Added synopsis property Index: AGIReply.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply/AGIReply.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- AGIReply.java 8 Mar 2005 16:48:35 -0000 1.4 +++ AGIReply.java 9 Mar 2005 20:30:08 -0000 1.5 @@ -73,6 +73,12 @@ public class AGIReply implements Seriali * In case of status == 520 (invalid command syntax) this attribute contains * the synopsis of the command. */ + private String synopsis; + + /** + * In case of status == 520 (invalid command syntax) this attribute contains + * the usage of the command. + */ private String usage; /** @@ -126,7 +132,29 @@ public class AGIReply implements Seriali * syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX). * * @return the synopsis of the command sent, <code>null</code> if there - * were no syntax errors. + * were no syntax errors. + */ + public String getSynopsis() + { + return synopsis; + } + + /** + * Sets the synopsis of the command sent. + * + * @param synopsis the synopsis of the command sent. + */ + public void setSynopsis(String synopsis) + { + this.synopsis = synopsis; + } + + /** + * Returns the usage of the command sent if Asterisk expected a different + * syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX). + * + * @return the usage of the command sent, <code>null</code> if there were + * no syntax errors. */ public String getUsage() { @@ -136,7 +164,7 @@ public class AGIReply implements Seriali /** * Sets the synopsis of the command sent. * - * @param usage the synopsis of the command sent. + * @param usage the usage of the command sent. */ public void setUsage(String usage) { |
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv21514/src/test/net/sf/asterisk/manager Modified Files: ManagerReaderImplTest.java ManagerWriterMock.java ManagerWriterImplTest.java ManagerReaderMock.java DefaultManagerConnectionTest.java Log Message: Moved io facades to net.sf.asterisk.io as they can also be used for fastagi Index: ManagerReaderImplTest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/ManagerReaderImplTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- ManagerReaderImplTest.java 5 Mar 2005 01:39:51 -0000 1.3 +++ ManagerReaderImplTest.java 9 Mar 2005 15:50:28 -0000 1.4 @@ -22,10 +22,10 @@ import java.util.Date; import java.util.List; import junit.framework.TestCase; +import net.sf.asterisk.io.SocketConnectionFacade; import net.sf.asterisk.manager.event.ConnectEvent; import net.sf.asterisk.manager.event.DisconnectEvent; import net.sf.asterisk.manager.event.StatusCompleteEvent; -import net.sf.asterisk.manager.io.SocketConnectionFacade; import net.sf.asterisk.manager.response.CommandResponse; import net.sf.asterisk.manager.response.ManagerResponse; import net.sf.asterisk.manager.util.DateUtil; Index: ManagerWriterMock.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/ManagerWriterMock.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- ManagerWriterMock.java 5 Mar 2005 00:33:16 -0000 1.3 +++ ManagerWriterMock.java 9 Mar 2005 15:50:28 -0000 1.4 @@ -18,12 +18,12 @@ package net.sf.asterisk.manager; import java.io.IOException; +import net.sf.asterisk.io.SocketConnectionFacade; import net.sf.asterisk.manager.action.ChallengeAction; import net.sf.asterisk.manager.action.LoginAction; import net.sf.asterisk.manager.action.LogoffAction; import net.sf.asterisk.manager.action.ManagerAction; import net.sf.asterisk.manager.event.ConnectEvent; -import net.sf.asterisk.manager.io.SocketConnectionFacade; import net.sf.asterisk.manager.response.ChallengeResponse; import net.sf.asterisk.manager.response.ManagerError; import net.sf.asterisk.manager.response.ManagerResponse; Index: ManagerWriterImplTest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/ManagerWriterImplTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- ManagerWriterImplTest.java 5 Mar 2005 04:18:53 -0000 1.2 +++ ManagerWriterImplTest.java 9 Mar 2005 15:50:28 -0000 1.3 @@ -18,8 +18,8 @@ package net.sf.asterisk.manager; import org.easymock.MockControl; +import net.sf.asterisk.io.SocketConnectionFacade; import net.sf.asterisk.manager.action.StatusAction; -import net.sf.asterisk.manager.io.SocketConnectionFacade; import junit.framework.TestCase; public class ManagerWriterImplTest extends TestCase Index: ManagerReaderMock.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/ManagerReaderMock.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- ManagerReaderMock.java 5 Mar 2005 01:39:51 -0000 1.2 +++ ManagerReaderMock.java 9 Mar 2005 15:50:28 -0000 1.3 @@ -16,7 +16,7 @@ */ package net.sf.asterisk.manager; -import net.sf.asterisk.manager.io.SocketConnectionFacade; +import net.sf.asterisk.io.SocketConnectionFacade; public class ManagerReaderMock implements ManagerReader { Index: DefaultManagerConnectionTest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/DefaultManagerConnectionTest.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -p -r1.6 -r1.7 --- DefaultManagerConnectionTest.java 5 Mar 2005 02:58:24 -0000 1.6 +++ DefaultManagerConnectionTest.java 9 Mar 2005 15:50:28 -0000 1.7 @@ -19,10 +19,10 @@ package net.sf.asterisk.manager; import java.io.IOException; import junit.framework.TestCase; +import net.sf.asterisk.io.SocketConnectionFacade; import net.sf.asterisk.manager.action.StatusAction; import net.sf.asterisk.manager.event.ConnectEvent; import net.sf.asterisk.manager.event.DisconnectEvent; -import net.sf.asterisk.manager.io.SocketConnectionFacade; import net.sf.asterisk.manager.response.ManagerResponse; import org.easymock.MockControl; |
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23526/src/java/net/sf/asterisk/manager Modified Files: ManagerReader.java ManagerWriterImpl.java ManagerWriter.java DefaultManagerConnection.java ManagerReaderImpl.java Log Message: Aoved io facades to net.sf.asterisk.io as they can also be used for fastagi Index: ManagerReader.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/ManagerReader.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -p -r1.8 -r1.9 --- ManagerReader.java 5 Mar 2005 13:34:23 -0000 1.8 +++ ManagerReader.java 9 Mar 2005 09:59:03 -0000 1.9 @@ -16,8 +16,8 @@ */ package net.sf.asterisk.manager; +import net.sf.asterisk.io.SocketConnectionFacade; import net.sf.asterisk.manager.event.ManagerEvent; -import net.sf.asterisk.manager.io.SocketConnectionFacade; /** * The ManagerReader reads events and responses from the asterisk server, parses them using Index: ManagerWriterImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/ManagerWriterImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- ManagerWriterImpl.java 5 Mar 2005 13:34:23 -0000 1.3 +++ ManagerWriterImpl.java 9 Mar 2005 09:59:03 -0000 1.4 @@ -18,8 +18,8 @@ package net.sf.asterisk.manager; import java.io.IOException; +import net.sf.asterisk.io.SocketConnectionFacade; import net.sf.asterisk.manager.action.ManagerAction; -import net.sf.asterisk.manager.io.SocketConnectionFacade; import org.apache.commons.logging.Log; import org.apache.commons.logging.LogFactory; Index: ManagerWriter.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/ManagerWriter.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- ManagerWriter.java 5 Mar 2005 13:34:23 -0000 1.2 +++ ManagerWriter.java 9 Mar 2005 09:59:03 -0000 1.3 @@ -18,8 +18,8 @@ package net.sf.asterisk.manager; import java.io.IOException; +import net.sf.asterisk.io.SocketConnectionFacade; import net.sf.asterisk.manager.action.ManagerAction; -import net.sf.asterisk.manager.io.SocketConnectionFacade; /** * The ManagerWriter transforms actions using an ActionBuilder and sends them to the asterisk Index: DefaultManagerConnection.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/DefaultManagerConnection.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -p -r1.9 -r1.10 --- DefaultManagerConnection.java 5 Mar 2005 04:15:34 -0000 1.9 +++ DefaultManagerConnection.java 9 Mar 2005 09:59:03 -0000 1.10 @@ -26,6 +26,8 @@ import java.util.HashSet; import java.util.Iterator; import java.util.Map; +import net.sf.asterisk.io.SocketConnectionFacade; +import net.sf.asterisk.io.SocketConnectionFacadeImpl; import net.sf.asterisk.manager.action.ChallengeAction; import net.sf.asterisk.manager.action.LoginAction; import net.sf.asterisk.manager.action.LogoffAction; @@ -33,8 +35,6 @@ import net.sf.asterisk.manager.action.Ma import net.sf.asterisk.manager.event.ConnectEvent; import net.sf.asterisk.manager.event.DisconnectEvent; import net.sf.asterisk.manager.event.ManagerEvent; -import net.sf.asterisk.manager.io.SocketConnectionFacade; -import net.sf.asterisk.manager.io.SocketConnectionFacadeImpl; import net.sf.asterisk.manager.response.ChallengeResponse; import net.sf.asterisk.manager.response.ManagerError; import net.sf.asterisk.manager.response.ManagerResponse; Index: ManagerReaderImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/ManagerReaderImpl.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- ManagerReaderImpl.java 5 Mar 2005 13:34:23 -0000 1.3 +++ ManagerReaderImpl.java 9 Mar 2005 09:59:03 -0000 1.4 @@ -22,10 +22,10 @@ import java.util.HashMap; import java.util.List; import java.util.Map; +import net.sf.asterisk.io.SocketConnectionFacade; import net.sf.asterisk.manager.event.ConnectEvent; import net.sf.asterisk.manager.event.DisconnectEvent; import net.sf.asterisk.manager.event.ManagerEvent; -import net.sf.asterisk.manager.io.SocketConnectionFacade; import net.sf.asterisk.manager.response.CommandResponse; import net.sf.asterisk.manager.response.ManagerResponse; import net.sf.asterisk.manager.util.DateUtil; |
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22302/src/java/net/sf/asterisk/fastagi/command Modified Files: DatabaseDelCommand.java SetPriorityCommand.java AGICommand.java DatabaseDelTreeCommand.java SayTimeCommand.java SayNumberCommand.java SetMusicOnCommand.java GetVariableCommand.java DatabasePutCommand.java SetVariableCommand.java SetAutoHangupCommand.java GetDataCommand.java SayPhoneticCommand.java SendImageCommand.java ExecCommand.java SetExtensionCommand.java SendTextCommand.java HangupCommand.java SayDigitsCommand.java ChannelStatusCommand.java StreamFileCommand.java VerboseCommand.java TDDModeCommand.java WaitForDigitCommand.java ReceiveCharCommand.java DatabaseGetCommand.java RecordFileCommand.java Log Message: Index: DatabaseDelCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/DatabaseDelCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- DatabaseDelCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ DatabaseDelCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,7 +17,8 @@ package net.sf.asterisk.fastagi.command; /** - * Deletes a family or specific keytree within a family in the Asterisk database.<br> + * Deletes a family or specific keytree within a family in the Asterisk + * database.<br> * Returns 1 if successful, 0 otherwise. * * @author srt @@ -105,6 +106,7 @@ public class DatabaseDelCommand extends public String buildCommand() { - return "DATABASE DELTREE " + escapeAndQuote(family) + (keyTree == null ? "" : " " + escapeAndQuote(keyTree)); + return "DATABASE DELTREE " + escapeAndQuote(family) + + (keyTree == null ? "" : " " + escapeAndQuote(keyTree)); } } Index: SetPriorityCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SetPriorityCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SetPriorityCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SetPriorityCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -37,7 +37,8 @@ public class SetPriorityCommand extends /** * Creates a new SetPriorityCommand. * - * @param priority the priority for continuation upon exiting the application. + * @param priority the priority for continuation upon exiting the + * application. */ public SetPriorityCommand(int priority) { @@ -57,7 +58,8 @@ public class SetPriorityCommand extends /** * Sets the priority for continuation upon exiting the application. * - * @param priority the priority for continuation upon exiting the application. + * @param priority the priority for continuation upon exiting the + * application. */ public void setPriority(int priority) { Index: AGICommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/AGICommand.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- AGICommand.java 5 Mar 2005 23:22:05 -0000 1.2 +++ AGICommand.java 8 Mar 2005 16:48:34 -0000 1.3 @@ -60,7 +60,8 @@ public abstract class AGICommand impleme public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + return ToStringBuilder.reflectionToString(this, + ToStringStyle.MULTI_LINE_STYLE); } public boolean equals(Object o) Index: DatabaseDelTreeCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/DatabaseDelTreeCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- DatabaseDelTreeCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ DatabaseDelTreeCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -94,6 +94,7 @@ public class DatabaseDelTreeCommand exte public String buildCommand() { - return "DATABASE DEL " + escapeAndQuote(family) + " " + escapeAndQuote(key); + return "DATABASE DEL " + escapeAndQuote(family) + " " + + escapeAndQuote(key); } } Index: SayTimeCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SayTimeCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SayTimeCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SayTimeCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,11 +17,12 @@ package net.sf.asterisk.fastagi.command; /** - * Say a given time, returning early if any of the given DTMF digits are received on the channel.<br> - * Time is the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal - * Time (UTC).<br> - * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of - * the digit if one was pressed or -1 on error/hangup. + * Say a given time, returning early if any of the given DTMF digits are + * received on the channel.<br> + * Time is the number of seconds elapsed since 00:00:00 on January 1, 1970, + * Coordinated Universal Time (UTC).<br> + * Returns 0 if playback completes without a digit being pressed, or the ASCII + * numerical value of the digit if one was pressed or -1 on error/hangup. * * @author srt * @version $Id$ @@ -58,7 +59,8 @@ public class SayTimeCommand extends AGIC * Creates a new SayTimeCommand. * * @param time the time to say in seconds since 00:00:00 on January 1, 1970. - * @param escapeDigits contains the digits that allow the user to interrupt this command. + * @param escapeDigits contains the digits that allow the user to interrupt + * this command. */ public SayTimeCommand(long time, String interruptDigits) { @@ -99,8 +101,8 @@ public class SayTimeCommand extends AGIC /** * Sets the digits that allow the user to interrupt this command. * - * @param escapeDigits the time that allow the user to interrupt this command or - * <code>null</code> for none. + * @param escapeDigits the time that allow the user to interrupt this + * command or <code>null</code> for none. */ public void setEscapeDigits(String escapeDigits) { Index: SayNumberCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SayNumberCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SayNumberCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SayNumberCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,9 +17,10 @@ package net.sf.asterisk.fastagi.command; /** - * Say a given number, returning early if any of the given DTMF number are received on the channel.<br> - * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of - * the digit if one was pressed or -1 on error/hangup. + * Say a given number, returning early if any of the given DTMF number are + * received on the channel.<br> + * Returns 0 if playback completes without a digit being pressed, or the ASCII + * numerical value of the digit if one was pressed or -1 on error/hangup. * * @author srt * @version $Id$ @@ -56,7 +57,8 @@ public class SayNumberCommand extends AG * Creates a new SayNumberCommand. * * @param number the number to say. - * @param interruptDigits contains the number that allow the user to interrupt this command. + * @param interruptDigits contains the number that allow the user to + * interrupt this command. */ public SayNumberCommand(String number, String interruptDigits) { @@ -97,8 +99,8 @@ public class SayNumberCommand extends AG /** * Sets the number that allow the user to interrupt this command. * - * @param interruptDigits the number that allow the user to interrupt this command or - * <code>null</code> for none. + * @param interruptDigits the number that allow the user to interrupt this + * command or <code>null</code> for none. */ public void setInterruptDigits(String interruptDigits) { @@ -107,6 +109,7 @@ public class SayNumberCommand extends AG public String buildCommand() { - return "SAY NUMBER " + escapeAndQuote(number) + " " + escapeAndQuote(interruptDigits); + return "SAY NUMBER " + escapeAndQuote(number) + " " + + escapeAndQuote(interruptDigits); } } Index: SetMusicOnCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SetMusicOnCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SetMusicOnCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SetMusicOnCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -36,7 +36,8 @@ public class SetMusicOnCommand extends A private String musicOnHoldClass; /** - * Creates a new SetMusicOnCommand playing music from the default music on hold class. + * Creates a new SetMusicOnCommand playing music from the default music on + * hold class. */ public SetMusicOnCommand() { @@ -46,8 +47,8 @@ public class SetMusicOnCommand extends A /** * Returns the music on hold class to play music from. * - * @return the music on hold class to play music from or <code>null</code> for the default - * class. + * @return the music on hold class to play music from or <code>null</code> + * for the default class. */ public String getMusicOnHoldClass() { @@ -57,8 +58,8 @@ public class SetMusicOnCommand extends A /** * Sets the music on hold class to play music from. * - * @param musicOnHoldClass the music on hold class to play music from or <code>null</code> for - * the default class. + * @param musicOnHoldClass the music on hold class to play music from or + * <code>null</code> for the default class. */ public void setMusicOnHoldClass(String musicOnHoldClass) { @@ -67,6 +68,8 @@ public class SetMusicOnCommand extends A public String buildCommand() { - return "SET MUSIC ON" + (musicOnHoldClass == null ? "" : " " + escapeAndQuote(musicOnHoldClass)); + return "SET MUSIC ON" + + (musicOnHoldClass == null ? "" : " " + + escapeAndQuote(musicOnHoldClass)); } } Index: GetVariableCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/GetVariableCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- GetVariableCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ GetVariableCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -18,8 +18,8 @@ package net.sf.asterisk.fastagi.command; /** * Returns the value of the given channel varible.<br> - * Returns 0 if is not set. Returns 1 if the variable is set and returns the variable in - * parenthesis.<br> + * Returns 0 if is not set. Returns 1 if the variable is set and returns the + * variable in parenthesis.<br> * Example return code: 200 result=1 (testvariable) * * @author srt Index: DatabasePutCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/DatabasePutCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- DatabasePutCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ DatabasePutCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,7 +17,8 @@ package net.sf.asterisk.fastagi.command; /** - * Adds or updates an entry in the Asterisk database for a given family, key, and value.<br> + * Adds or updates an entry in the Asterisk database for a given family, key, + * and value.<br> * Returns 1 if successful, 0 otherwise. * * @author srt @@ -121,6 +122,7 @@ public class DatabasePutCommand extends public String buildCommand() { - return "DATABASE PUT " + escapeAndQuote(family) + " " + escapeAndQuote(key) + " " + escapeAndQuote(value); + return "DATABASE PUT " + escapeAndQuote(family) + " " + + escapeAndQuote(key) + " " + escapeAndQuote(value); } } Index: SetVariableCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SetVariableCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SetVariableCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SetVariableCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -93,6 +93,7 @@ public class SetVariableCommand extends public String buildCommand() { - return "SET VARIABLE " + escapeAndQuote(variable) + " " + escapeAndQuote(value); + return "SET VARIABLE " + escapeAndQuote(variable) + " " + + escapeAndQuote(value); } } Index: SetAutoHangupCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SetAutoHangupCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SetAutoHangupCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SetAutoHangupCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,9 +17,10 @@ package net.sf.asterisk.fastagi.command; /** - * Cause the channel to automatically hangup at the given number of seconds in the future.<br> - * Of course it can be hungup before then as well. Setting to 0 will cause the autohangup feature to - * be disabled on this channel. + * Cause the channel to automatically hangup at the given number of seconds in + * the future.<br> + * Of course it can be hungup before then as well. Setting to 0 will cause the + * autohangup feature to be disabled on this channel. * * @author srt * @version $Id$ @@ -39,8 +40,9 @@ public class SetAutoHangupCommand extend /** * Creates a new SetAutoHangupCommand. * - * @param time the number of seconds before this channel is automatically hung up.<br> - * 0 disables the autohangup feature. + * @param time the number of seconds before this channel is automatically + * hung up.<br> + * 0 disables the autohangup feature. */ public SetAutoHangupCommand(int time) { @@ -48,9 +50,11 @@ public class SetAutoHangupCommand extend } /** - * Returns the number of seconds before this channel is automatically hung up. + * Returns the number of seconds before this channel is automatically hung + * up. * - * @return the number of seconds before this channel is automatically hung up. + * @return the number of seconds before this channel is automatically hung + * up. */ public int getTime() { @@ -60,8 +64,9 @@ public class SetAutoHangupCommand extend /** * Sets the number of seconds before this channel is automatically hung up. * - * @param time the number of seconds before this channel is automatically hung up.<br> - * 0 disables the autohangup feature. + * @param time the number of seconds before this channel is automatically + * hung up.<br> + * 0 disables the autohangup feature. */ public void setTime(int timeout) { Index: GetDataCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/GetDataCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- GetDataCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ GetDataCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -19,7 +19,8 @@ package net.sf.asterisk.fastagi.command; /** * Stream the given file, and recieve DTMF data.<br> * Returns the digits recieved from the channel at the other end.<br> - * Input ends when the timeout is reached, the maximum number of digits is read or the user presses #. + * Input ends when the timeout is reached, the maximum number of digits is read + * or the user presses #. * * @author srt * @version $Id$ @@ -38,7 +39,8 @@ public class GetDataCommand extends AGIC /** * The timeout to wait for data.<br> - * 0 means standard timeout value, -1 means "ludicrous time" (essentially never times out). + * 0 means standard timeout value, -1 means "ludicrous time" (essentially + * never times out). */ private int timeout; @@ -49,7 +51,8 @@ public class GetDataCommand extends AGIC private int maxDigits; /** - * Creates a new GetDataCommand with default timeout and maxDigits set to 1024. + * Creates a new GetDataCommand with default timeout and maxDigits set to + * 1024. * * @param file the name of the file to stream, must not include extension. */ @@ -65,13 +68,15 @@ public class GetDataCommand extends AGIC * * @param file the name of the file to stream, must not include extension. * @param timeout the timeout to wait for data.<br> - * 0 means standard timeout value, -1 means "ludicrous time" (essentially never times out). + * 0 means standard timeout value, -1 means "ludicrous time" + * (essentially never times out). * @param maxDigits the maximum number of digits to read.<br> - * Must be in [1..1024]. + * Must be in [1..1024]. * * @throws IllegalArgumentException if maxDigits is not in [1..1024] */ - public GetDataCommand(String file, int timeout, int maxDigits) throws IllegalArgumentException + public GetDataCommand(String file, int timeout, int maxDigits) + throws IllegalArgumentException { if (maxDigits < 1 || maxDigits > 1024) { @@ -117,7 +122,8 @@ public class GetDataCommand extends AGIC * Sets the timeout to wait for data. * * @param timeout the timeout to wait for data.<br> - * 0 means standard timeout value, -1 means "ludicrous time" (essentially never times out). + * 0 means standard timeout value, -1 means "ludicrous time" + * (essentially never times out). */ public void setTimeout(int timeout) { @@ -138,7 +144,7 @@ public class GetDataCommand extends AGIC * Sets the maximum number of digits to read. * * @param maxDigits the maximum number of digits to read.<br> - * Must be in [1..1024]. + * Must be in [1..1024]. * * @throws IllegalArgumentException if maxDigits is not in [1..1024] */ @@ -154,6 +160,7 @@ public class GetDataCommand extends AGIC public String buildCommand() { - return "GET DATA " + escapeAndQuote(file) + " " + timeout + " " + maxDigits; + return "GET DATA " + escapeAndQuote(file) + " " + timeout + " " + + maxDigits; } } Index: SayPhoneticCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SayPhoneticCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SayPhoneticCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SayPhoneticCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,10 +17,10 @@ package net.sf.asterisk.fastagi.command; /** - * Say a given character string with phonetics, returning early if any of the given DTMF digits are - * received on the channel.<br> - * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of - * the digit if one was pressed or -1 on error/hangup. + * Say a given character string with phonetics, returning early if any of the + * given DTMF digits are received on the channel.<br> + * Returns 0 if playback completes without a digit being pressed, or the ASCII + * numerical value of the digit if one was pressed or -1 on error/hangup. * * @author srt * @version $Id$ @@ -57,7 +57,8 @@ public class SayPhoneticCommand extends * Creates a new SayPhoneticCommand. * * @param text the text to say. - * @param escapeDigits contains the digits that allow the user to interrupt this command. + * @param escapeDigits contains the digits that allow the user to interrupt + * this command. */ public SayPhoneticCommand(String text, String interruptDigits) { @@ -98,8 +99,8 @@ public class SayPhoneticCommand extends /** * Sets the digits that allow the user to interrupt this command. * - * @param escapeDigits the text that allow the user to interrupt this command or - * <code>null</code> for none. + * @param escapeDigits the text that allow the user to interrupt this + * command or <code>null</code> for none. */ public void setEscapeDigits(String escapeDigits) { @@ -108,6 +109,7 @@ public class SayPhoneticCommand extends public String buildCommand() { - return "SAY PHONETIC " + escapeAndQuote(text) + " " + escapeAndQuote(escapeDigits); + return "SAY PHONETIC " + escapeAndQuote(text) + " " + + escapeAndQuote(escapeDigits); } } Index: SendImageCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SendImageCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SendImageCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SendImageCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -19,8 +19,8 @@ package net.sf.asterisk.fastagi.command; /** * Sends the given image on a channel.<br> * Most channels do not support the transmission of images.<br> - * Returns 0 if image is sent, or if the channel does not support image transmission. Returns -1 - * only on error/hangup.<br> + * Returns 0 if image is sent, or if the channel does not support image + * transmission. Returns -1 only on error/hangup.<br> * Image names should not include extensions. * * @author srt Index: ExecCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/ExecCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- ExecCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ ExecCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -18,7 +18,8 @@ package net.sf.asterisk.fastagi.command; /** * Executes an application with the given options.<br> - * Returns whatever the application returns, or -2 on failure to find application. + * Returns whatever the application returns, or -2 on failure to find + * application. * * @author srt * @version $Id$ @@ -105,6 +106,7 @@ public class ExecCommand extends AGIComm public String buildCommand() { - return "EXEC " + escapeAndQuote(application) + " " + escapeAndQuote(options); + return "EXEC " + escapeAndQuote(application) + " " + + escapeAndQuote(options); } } Index: SetExtensionCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SetExtensionCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SetExtensionCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SetExtensionCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -37,7 +37,8 @@ public class SetExtensionCommand extends /** * Creates a new SetPriorityCommand. * - * @param extension the extension for continuation upon exiting the application. + * @param extension the extension for continuation upon exiting the + * application. */ public SetExtensionCommand(String extension) { @@ -57,7 +58,8 @@ public class SetExtensionCommand extends /** * Sets the extension for continuation upon exiting the application. * - * @param extension the extension for continuation upon exiting the application. + * @param extension the extension for continuation upon exiting the + * application. */ public void setExtension(String extension) { Index: SendTextCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SendTextCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SendTextCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SendTextCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -19,8 +19,8 @@ package net.sf.asterisk.fastagi.command; /** * Sends the given text on a channel.<br> * Most channels do not support the transmission of text.<br> - * Returns 0 if text is sent, or if the channel does not support text transmission. Returns -1 only - * on error/hangup. + * Returns 0 if text is sent, or if the channel does not support text + * transmission. Returns -1 only on error/hangup. * * @author srt * @version $Id$ Index: HangupCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/HangupCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- HangupCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ HangupCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,7 +17,8 @@ package net.sf.asterisk.fastagi.command; /** - * Hangs up the specified channel. If no channel name is given, hangs up the current channel. + * Hangs up the specified channel. If no channel name is given, hangs up the + * current channel. * * @author srt * @version $Id$ @@ -30,7 +31,8 @@ public class HangupCommand extends AGICo private static final long serialVersionUID = 3904959746380281145L; /** - * The name of the channel to hangup or <code>null</code> for the current channel. + * The name of the channel to hangup or <code>null</code> for the current + * channel. */ private String channel; @@ -55,7 +57,8 @@ public class HangupCommand extends AGICo /** * Returns the name of the channel to hangup. * - * @return the name of the channel to hangup or <code>null</code> for the current channel. + * @return the name of the channel to hangup or <code>null</code> for the + * current channel. */ public String getChannel() { @@ -65,8 +68,8 @@ public class HangupCommand extends AGICo /** * Sets the name of the channel to hangup. * - * @param channel the name of the channel to hangup or <code>null</code> for the current - * channel. + * @param channel the name of the channel to hangup or <code>null</code> + * for the current channel. */ public void setChannel(String channel) { @@ -75,6 +78,7 @@ public class HangupCommand extends AGICo public String buildCommand() { - return "HANGUP" + (channel == null ? "" : " " + escapeAndQuote(channel)); + return "HANGUP" + + (channel == null ? "" : " " + escapeAndQuote(channel)); } } Index: SayDigitsCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/SayDigitsCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- SayDigitsCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ SayDigitsCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,10 +17,10 @@ package net.sf.asterisk.fastagi.command; /** - * Say a given digit string, returning early if any of the given DTMF number are received on the - * channel.<br> - * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of - * the digit if one was pressed or -1 on error/hangup. + * Say a given digit string, returning early if any of the given DTMF number are + * received on the channel.<br> + * Returns 0 if playback completes without a digit being pressed, or the ASCII + * numerical value of the digit if one was pressed or -1 on error/hangup. * * @author srt * @version $Id$ @@ -38,7 +38,8 @@ public class SayDigitsCommand extends AG private String number; /** - * When one of these digits is pressed while saying the number the command returns. + * When one of these digits is pressed while saying the number the command + * returns. */ private String escapeDigits; @@ -57,7 +58,8 @@ public class SayDigitsCommand extends AG * Creates a new SayDigitsCommand. * * @param number the number to say. - * @param escapeDigits the digits that allow the user to interrupt this command. + * @param escapeDigits the digits that allow the user to interrupt this + * command. */ public SayDigitsCommand(String number, String escapeDigits) { @@ -98,8 +100,8 @@ public class SayDigitsCommand extends AG /** * Sets the digits that allow the user to interrupt this command. * - * @param escapeDigits the digits that allow the user to interrupt this command or - * <code>null</code> for none. + * @param escapeDigits the digits that allow the user to interrupt this + * command or <code>null</code> for none. */ public void setEscapeDigits(String escapeDigits) { @@ -108,6 +110,7 @@ public class SayDigitsCommand extends AG public String buildCommand() { - return "STREAM DIGITS " + escapeAndQuote(number) + " " + escapeAndQuote(escapeDigits); + return "STREAM DIGITS " + escapeAndQuote(number) + " " + + escapeAndQuote(escapeDigits); } } Index: ChannelStatusCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/ChannelStatusCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- ChannelStatusCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ ChannelStatusCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,8 +17,8 @@ package net.sf.asterisk.fastagi.command; /** - * Returns the status of the specified channel. If no channel name is given the returns the status - * of the current channel.<br> + * Returns the status of the specified channel. If no channel name is given the + * returns the status of the current channel.<br> * Return values: * <ul> * <li>0 Channel is down and available @@ -42,7 +42,8 @@ public class ChannelStatusCommand extend private static final long serialVersionUID = 3904959746380281145L; /** - * The name of the channel to query or <code>null</code> for the current channel. + * The name of the channel to query or <code>null</code> for the current + * channel. */ private String channel; @@ -67,7 +68,8 @@ public class ChannelStatusCommand extend /** * Returns the name of the channel to query. * - * @return the name of the channel to query or <code>null</code> for the current channel. + * @return the name of the channel to query or <code>null</code> for the + * current channel. */ public String getChannel() { @@ -77,8 +79,8 @@ public class ChannelStatusCommand extend /** * Sets the name of the channel to query. * - * @param channel the name of the channel to query or <code>null</code> for the current - * channel. + * @param channel the name of the channel to query or <code>null</code> + * for the current channel. */ public void setChannel(String channel) { @@ -87,6 +89,7 @@ public class ChannelStatusCommand extend public String buildCommand() { - return "CHANNEL STATUS" + (channel == null ? "" : " " + escapeAndQuote(channel)); + return "CHANNEL STATUS" + + (channel == null ? "" : " " + escapeAndQuote(channel)); } } Index: StreamFileCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/StreamFileCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- StreamFileCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ StreamFileCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,10 +17,13 @@ package net.sf.asterisk.fastagi.command; /** - * Plays the given file, allowing playback to be interrupted by the given digits, if any.<br> - * If offset is provided then the audio will seek to sample offset before play starts.<br> - * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of - * the digit if one was pressed, or -1 on error or if the channel was disconnected. <br> + * Plays the given file, allowing playback to be interrupted by the given + * digits, if any.<br> + * If offset is provided then the audio will seek to sample offset before play + * starts.<br> + * Returns 0 if playback completes without a digit being pressed, or the ASCII + * numerical value of the digit if one was pressed, or -1 on error or if the + * channel was disconnected. <br> * Remember, the file extension must not be included in the filename. * * @author srt @@ -64,7 +67,8 @@ public class StreamFileCommand extends A * Creates a new StreamFileCommand, streaming from the beginning. * * @param file the name of the file to stream, must not include extension. - * @param escapeDigits contains the digits that allow the user to interrupt this command. + * @param escapeDigits contains the digits that allow the user to interrupt + * this command. */ public StreamFileCommand(String file, String escapeDigits) { @@ -77,8 +81,9 @@ public class StreamFileCommand extends A * Creates a new StreamFileCommand, streaming from the given offset. * * @param file the name of the file to stream, must not include extension. - * @param escapeDigits contains the digits that allow the user to interrupt this command. Maybe - * <code>null</code> if you don't want the user to interrupt. + * @param escapeDigits contains the digits that allow the user to interrupt + * this command. Maybe <code>null</code> if you don't want the + * user to interrupt. * @param offset the offset samples to skip before streaming. */ public StreamFileCommand(String file, String escapeDigits, int offset) @@ -121,8 +126,8 @@ public class StreamFileCommand extends A /** * Sets the digits that allow the user to interrupt this command. * - * @param escapeDigits the digits that allow the user to interrupt this command or - * <code>null</code> for none. + * @param escapeDigits the digits that allow the user to interrupt this + * command or <code>null</code> for none. */ public void setEscapeDigits(String escapeDigits) { @@ -151,7 +156,8 @@ public class StreamFileCommand extends A public String buildCommand() { - return "STREAM FILE " + escapeAndQuote(file) + " " + escapeAndQuote(escapeDigits) + return "STREAM FILE " + escapeAndQuote(file) + " " + + escapeAndQuote(escapeDigits) + (offset < 0 ? "" : " " + offset); } } Index: VerboseCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/VerboseCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- VerboseCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ VerboseCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -46,11 +46,12 @@ public class VerboseCommand extends AGIC * * @param message the message to send. * @param level the verbosity level to use.<br> - * Must be in [1..4] + * Must be in [1..4] * * @throws IllegalArgumentException if level is not in [1..4] */ - public VerboseCommand(String message, int level) throws IllegalArgumentException + public VerboseCommand(String message, int level) + throws IllegalArgumentException { if (level < 1 || level > 4) { Index: TDDModeCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/TDDModeCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- TDDModeCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ TDDModeCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -38,7 +38,8 @@ public class TDDModeCommand extends AGIC /** * Creates a new TDDModeCommand. * - * @param mode the mode to set, this can be one of "on", "off", "mate" or "tdd". + * @param mode the mode to set, this can be one of "on", "off", "mate" or + * "tdd". */ public TDDModeCommand(String mode) { @@ -58,7 +59,8 @@ public class TDDModeCommand extends AGIC /** * Sets the mode to set. * - * @param mode the mode to set, this can be one of "on", "off", "mate" or "tdd". + * @param mode the mode to set, this can be one of "on", "off", "mate" or + * "tdd". */ public void setTimeout(String mode) { Index: WaitForDigitCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/WaitForDigitCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- WaitForDigitCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ WaitForDigitCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -18,9 +18,9 @@ package net.sf.asterisk.fastagi.command; /** * Waits up to 'timeout' milliseconds for channel to receive a DTMF digit.<br> - * Returns -1 on channel failure, 0 if no digit is received in the timeout, or the numerical value - * of the ascii of the digit if one is received. Use -1 for the timeout value if you desire the call - * to block indefinitely. + * Returns -1 on channel failure, 0 if no digit is received in the timeout, or + * the numerical value of the ascii of the digit if one is received. Use -1 for + * the timeout value if you desire the call to block indefinitely. * * @author srt * @version $Id$ @@ -38,8 +38,8 @@ public class WaitForDigitCommand extends private int timeout; /** - * Creates a new WaitForDigitCommand with a default timeout of -1 which blocks the channel - * indefinitely. + * Creates a new WaitForDigitCommand with a default timeout of -1 which + * blocks the channel indefinitely. */ public WaitForDigitCommand() { @@ -49,7 +49,8 @@ public class WaitForDigitCommand extends /** * Creates a new WaitForDigitCommand. * - * @param timeout the milliseconds to wait for the channel to receive a DTMF digit. + * @param timeout the milliseconds to wait for the channel to receive a DTMF + * digit. */ public WaitForDigitCommand(int timeout) { @@ -69,7 +70,8 @@ public class WaitForDigitCommand extends /** * Sets the milliseconds to wait for the channel to receive a DTMF digit. * - * @param timeout the milliseconds to wait for the channel to receive a DTMF digit. + * @param timeout the milliseconds to wait for the channel to receive a DTMF + * digit. */ public void setTimeout(int timeout) { Index: ReceiveCharCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/ReceiveCharCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- ReceiveCharCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ ReceiveCharCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -18,10 +18,11 @@ package net.sf.asterisk.fastagi.command; /** * Receives a character of text on a channel.<br> - * Specify timeout to be the maximum time to wait for input in milliseconds, or 0 for infinite.<br> + * Specify timeout to be the maximum time to wait for input in milliseconds, or + * 0 for infinite.<br> * Most channels do not support the reception of text.<br> - * Returns the decimal value of the character if one is received, or 0 if the channel does not - * support text reception. Returns -1 only on error/hangup. + * Returns the decimal value of the character if one is received, or 0 if the + * channel does not support text reception. Returns -1 only on error/hangup. * * @author srt * @version $Id$ @@ -39,7 +40,8 @@ public class ReceiveCharCommand extends private int timeout; /** - * Creates a new ReceiveCharCommand with a default timeout of 0 meaning to wait for ever. + * Creates a new ReceiveCharCommand with a default timeout of 0 meaning to + * wait for ever. */ public ReceiveCharCommand() { @@ -49,7 +51,8 @@ public class ReceiveCharCommand extends /** * Creates a new ReceiveCharCommand. * - * @param timeout the milliseconds to wait for the channel to receive a character. + * @param timeout the milliseconds to wait for the channel to receive a + * character. */ public ReceiveCharCommand(int timeout) { @@ -69,7 +72,8 @@ public class ReceiveCharCommand extends /** * Sets the milliseconds to wait for the channel to receive a character. * - * @param timeout the milliseconds to wait for the channel to receive a character. + * @param timeout the milliseconds to wait for the channel to receive a + * character. */ public void setTimeout(int timeout) { Index: DatabaseGetCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/DatabaseGetCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- DatabaseGetCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ DatabaseGetCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -18,7 +18,8 @@ package net.sf.asterisk.fastagi.command; /** * Retrieves an entry in the Asterisk database for a given family and key.<br> - * Returns 0 if is not set. Returns 1 if the variable is set and returns the value in parenthesis.<br> + * Returns 0 if is not set. Returns 1 if the variable is set and returns the + * value in parenthesis.<br> * Example return code: 200 result=1 (testvariable) * * @author srt @@ -95,6 +96,7 @@ public class DatabaseGetCommand extends public String buildCommand() { - return "DATABASE GET " + escapeAndQuote(family) + " " + escapeAndQuote(key); + return "DATABASE GET " + escapeAndQuote(family) + " " + + escapeAndQuote(key); } } Index: RecordFileCommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/RecordFileCommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- RecordFileCommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ RecordFileCommand.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -19,10 +19,11 @@ package net.sf.asterisk.fastagi.command; /** * Record to a file until a given dtmf digit in the sequence is received.<br> * Returns -1 on hangup or error.<br> - * The format will specify what kind of file will be recorded. The timeout is the maximum record - * time in milliseconds, or -1 for no timeout. Offset samples is optional, and if provided will seek - * to the offset without exceeding the end of the file. "maxSilence" is the number of seconds of - * maxSilence allowed before the function returns despite the lack of dtmf digits or reaching + * The format will specify what kind of file will be recorded. The timeout is + * the maximum record time in milliseconds, or -1 for no timeout. Offset samples + * is optional, and if provided will seek to the offset without exceeding the + * end of the file. "maxSilence" is the number of seconds of maxSilence allowed + * before the function returns despite the lack of dtmf digits or reaching * timeout. * * @author srt @@ -66,8 +67,8 @@ public class RecordFileCommand extends A private boolean beep; /** - * The amount of silence (in seconds) to allow before returning despite the lack of dtmf digits - * or reaching timeout. + * The amount of silence (in seconds) to allow before returning despite the + * lack of dtmf digits or reaching timeout. */ private int maxSilence; @@ -76,10 +77,13 @@ public class RecordFileCommand extends A * * @param file the name of the file to stream, must not include extension. * @param format the format of the file to be recorded, for example "wav". - * @param escapeDigits contains the digits that allow the user to end recording. - * @param timeout the maximum record time in milliseconds, or -1 for no timeout. + * @param escapeDigits contains the digits that allow the user to end + * recording. + * @param timeout the maximum record time in milliseconds, or -1 for no + * timeout. */ - public RecordFileCommand(String file, String format, String escapeDigits, int timeout) + public RecordFileCommand(String file, String format, String escapeDigits, + int timeout) { this.file = file; this.format = format; @@ -95,15 +99,18 @@ public class RecordFileCommand extends A * * @param file the name of the file to stream, must not include extension. * @param format the format of the file to be recorded, for example "wav". - * @param escapeDigits contains the digits that allow the user to end recording. - * @param timeout the maximum record time in milliseconds, or -1 for no timeout. + * @param escapeDigits contains the digits that allow the user to end + * recording. + * @param timeout the maximum record time in milliseconds, or -1 for no + * timeout. * @param offset the offset samples to skip. - * @param beep <code>true</code> if a beep should be played before recording. - * @param maxSilence The amount of silence (in seconds) to allow before returning despite the - * lack of dtmf digits or reaching timeout. + * @param beep <code>true</code> if a beep should be played before + * recording. + * @param maxSilence The amount of silence (in seconds) to allow before + * returning despite the lack of dtmf digits or reaching timeout. */ - public RecordFileCommand(String file, String format, String escapeDigits, int timeout, int offset, boolean beep, - int maxSilence) + public RecordFileCommand(String file, String format, String escapeDigits, + int timeout, int offset, boolean beep, int maxSilence) { this.file = file; this.format = format; @@ -167,8 +174,8 @@ public class RecordFileCommand extends A /** * Sets the digits that allow the user to end recording. * - * @param escapeDigits the digits that allow the user to end recording or <code>null</code> - * for none. + * @param escapeDigits the digits that allow the user to end recording or + * <code>null</code> for none. */ public void setEscapeDigits(String escapeDigits) { @@ -188,7 +195,8 @@ public class RecordFileCommand extends A /** * Sets the maximum record time in milliseconds. * - * @param timeout the maximum record time in milliseconds, or -1 for no timeout. + * @param timeout the maximum record time in milliseconds, or -1 for no + * timeout. */ public void setTimeout(int timeout) { @@ -218,8 +226,8 @@ public class RecordFileCommand extends A /** * Returns <code>true</code> if a beep should be played before recording. * - * @return <code>true</code> if a beep should be played before recording, <code>false</code> - * if not. + * @return <code>true</code> if a beep should be played before recording, + * <code>false</code> if not. */ public boolean getBeep() { @@ -229,8 +237,8 @@ public class RecordFileCommand extends A /** * Set to <code>true</code> to play a beep before recording. * - * @param beep <code>true</code> if a beep should be played before recording, - * <code>false</code> if not. + * @param beep <code>true</code> if a beep should be played before + * recording, <code>false</code> if not. */ public void setBeep(boolean beep) { @@ -239,8 +247,9 @@ public class RecordFileCommand extends A public String buildCommand() { - return "RECORD FILE " + escapeAndQuote(file) + " " + escapeAndQuote(format) + " " - + escapeAndQuote(escapeDigits) + " " + timeout + " " + offset + (beep == true ? " BEEP" : "") + " s=" - + maxSilence; + return "RECORD FILE " + escapeAndQuote(file) + " " + + escapeAndQuote(format) + " " + escapeAndQuote(escapeDigits) + + " " + timeout + " " + offset + (beep == true ? " BEEP" : "") + + " s=" + maxSilence; } } |
From: Stefan R. <sr...@us...> - 2005-03-08 16:48:48
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22302/src/java/net/sf/asterisk/fastagi/reply Modified Files: AGIReply.java Log Message: Index: AGIReply.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply/AGIReply.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- AGIReply.java 8 Mar 2005 02:58:01 -0000 1.3 +++ AGIReply.java 8 Mar 2005 16:48:35 -0000 1.4 @@ -20,9 +20,10 @@ import java.io.Serializable; /** * Reply received in response to an AGICommand.<br> - * The AGIReply contains information about success or failure of the execution of an AGICommand and - - * depending on the command sent - additional information returned, for example the value of a - * variable requested by a GetVariableCommand. + * The AGIReply contains information about success or failure of the execution + * of an AGICommand and - depending on the command sent - additional information + * returned, for example the value of a variable requested by a + * GetVariableCommand. * * @see net.sf.asterisk.fastagi.command.AGICommand * @@ -32,21 +33,24 @@ import java.io.Serializable; public class AGIReply implements Serializable { /** - * Status code (200) indicating Asterisk successfully processed the AGICommand. + * Status code (200) indicating Asterisk successfully processed the + * AGICommand. */ public static int SC_SUCCESS = 200; /** - * Status code (510) indicating Asterisk was unable to process the AGICommand because there is - * no command with the given name available. + * Status code (510) indicating Asterisk was unable to process the + * AGICommand because there is no command with the given name available. */ public static int SC_INVALID_OR_UNKNOWN_COMMAND = 510; /** - * Status code (510) indicating Asterisk was unable to process the AGICommand because the syntax - * used was not correct. This is most likely due to missing required parameters or additional - * parameters sent that are not understood.<br> - * Ensure proper quoting of the parameters when you receive this status code. + * Status code (510) indicating Asterisk was unable to process the + * AGICommand because the syntax used was not correct. This is most likely + * due to missing required parameters or additional parameters sent that are + * not understood.<br> + * Ensure proper quoting of the parameters when you receive this status + * code. */ public static int SC_INVALID_COMMAND_SYNTAX = 520; @@ -66,8 +70,8 @@ public class AGIReply implements Seriali private int status; /** - * In case of status == 520 (invalid command syntax) this attribute contains the synopsis of the - * command. + * In case of status == 520 (invalid command syntax) this attribute contains + * the synopsis of the command. */ private String usage; @@ -118,10 +122,11 @@ public class AGIReply implements Seriali } /** - * Returns the synopsis of the command sent if Asterisk expected a different syntax (getStatus() == - * SC_INVALID_COMMAND_SYNTAX). + * Returns the synopsis of the command sent if Asterisk expected a different + * syntax (getStatus() == SC_INVALID_COMMAND_SYNTAX). * - * @return the synopsis of the command sent, <code>null</code> if there were no syntax errors. + * @return the synopsis of the command sent, <code>null</code> if there + * were no syntax errors. */ public String getUsage() { |
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22302/src/java/net/sf/asterisk/fastagi Modified Files: AGIRequestBuilderImpl.java AGIRequestBuilder.java AGIScript.java AGIServer.java AGIResponse.java AGIRequestImpl.java Log Message: Index: AGIRequestBuilderImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIRequestBuilderImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIRequestBuilderImpl.java 5 Mar 2005 22:46:59 -0000 1.1 +++ AGIRequestBuilderImpl.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -60,7 +60,7 @@ public class AGIRequestBuilderImpl imple if (map.get("callerid") != null) { String rawCallerId = (String) map.get("callerid"); - + request.setCallerId(getCallerId(rawCallerId)); request.setCallerIdName(getCallerIdName(rawCallerId)); } @@ -89,12 +89,13 @@ public class AGIRequestBuilderImpl imple } /** - * Builds a map containing variable names as key (with the "agi_" prefix stripped) and the - * corresponding values.<br> + * Builds a map containing variable names as key (with the "agi_" prefix + * stripped) and the corresponding values.<br> * Syntactically invalid and empty variables are skipped. * * @param lines the environment to transform. - * @return a map with the variables set corresponding to the given environment. + * @return a map with the variables set corresponding to the given + * environment. */ private Map buildMap(final Collection lines) { Index: AGIRequestBuilder.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIRequestBuilder.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIRequestBuilder.java 5 Mar 2005 22:46:59 -0000 1.1 +++ AGIRequestBuilder.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -19,7 +19,8 @@ package net.sf.asterisk.fastagi; import java.util.Collection; /** - * Parses the environment printed by asterisk's <code>setup_env</code> function to an AGIRequest. + * Parses the environment printed by asterisk's <code>setup_env</code> + * function to an AGIRequest. * * @author srt * @version $Id$ @@ -27,10 +28,11 @@ import java.util.Collection; public interface AGIRequestBuilder { /** - * Parses the environment printed by asterisk's <code>setup_env</code> function to an - * AGIRequest. + * Parses the environment printed by Asterisk's <code>setup_env</code> + * function to an AGIRequest. * - * @param lines the environment printed by asterisk's <code>setup_env</code> function. + * @param lines the environment printed by Asterisk's <code>setup_env</code> + * function. * @return an AGIRequest setup according to the environment passed in. */ AGIRequest buildAGIRequest(Collection lines); Index: AGIScript.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIScript.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIScript.java 8 Mar 2005 02:25:34 -0000 1.1 +++ AGIScript.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -17,11 +17,12 @@ 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. + * 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$ @@ -29,12 +30,13 @@ package net.sf.asterisk.fastagi; public interface AGIScript { /** - * The service method is called by the AsteriskServer whenever this AGIScript should handle an - * incoming AGIRequest. + * 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. + * @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); } Index: AGIServer.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIServer.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- AGIServer.java 8 Mar 2005 02:32:58 -0000 1.2 +++ AGIServer.java 8 Mar 2005 16:48:34 -0000 1.3 @@ -19,9 +19,10 @@ 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 processing. + * 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 + * processing. * * @author srt * @version $Id$ @@ -30,8 +31,8 @@ public interface AGIServer { /** * Starts this AGIServer.<br> - * After calling startup() this AGIServer is ready to receive requests from Asterisk servers and - * process them. + * After calling startup() this AGIServer is ready to receive requests from + * Asterisk servers and process them. * * @throws IOException if the server socket cannot be bound. * @throws IllegalStateException if this AGIServer is already running. @@ -43,7 +44,8 @@ public interface AGIServer * 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. + * @throws IllegalStateException if this AGIServer is already shut down or + * has not yet been started. */ void shutdown() throws IOException, IllegalStateException; } Index: AGIResponse.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIResponse.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIResponse.java 8 Mar 2005 02:25:34 -0000 1.1 +++ AGIResponse.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -22,8 +22,10 @@ import net.sf.asterisk.fastagi.command.A 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. + * 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$ Index: AGIRequestImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIRequestImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIRequestImpl.java 5 Mar 2005 22:46:59 -0000 1.1 +++ AGIRequestImpl.java 8 Mar 2005 16:48:34 -0000 1.2 @@ -135,9 +135,11 @@ public class AGIRequestImpl implements S } /** - * Returns the full URL of the request in the form agi://host[:port][/script]. + * Returns the full URL of the request in the form + * agi://host[:port][/script]. * - * @return the full URL of the request in the form agi://host[:port][/script]. + * @return the full URL of the request in the form + * agi://host[:port][/script]. */ public String getRequestURL() { @@ -147,7 +149,8 @@ public class AGIRequestImpl implements S /** * Sets the full URL of the request in the form agi://host[:port][/script]. * - * @param requestURL the full URL of the request in the form agi://host[:port][/script]. + * @param requestURL the full URL of the request in the form + * agi://host[:port][/script]. */ public void setRequestURL(String requestURL) { @@ -295,9 +298,11 @@ public class AGIRequestImpl implements S } /** - * Returns the context in the dial plan from which the AGI script was called. + * Returns the context in the dial plan from which the AGI script was + * called. * - * @return the context in the dial plan from which the AGI script was called. + * @return the context in the dial plan from which the AGI script was + * called. */ public String getContext() { @@ -307,7 +312,8 @@ public class AGIRequestImpl implements S /** * Sets the context in the dial plan from which the AGI script was called. * - * @param context the context in the dial plan from which the AGI script was called. + * @param context the context in the dial plan from which the AGI script was + * called. */ public void setContext(String context) { @@ -315,9 +321,11 @@ public class AGIRequestImpl implements S } /** - * Returns the extension in the dial plan from which the AGI script was called. + * Returns the extension in the dial plan from which the AGI script was + * called. * - * @return the extension in the dial plan from which the AGI script was called. + * @return the extension in the dial plan from which the AGI script was + * called. */ public String getExtension() { @@ -327,7 +335,8 @@ public class AGIRequestImpl implements S /** * Sets the extension in the dial plan from which the AGI script was called. * - * @param extension the extension in the dial plan from which the AGI script was called. + * @param extension the extension in the dial plan from which the AGI script + * was called. */ public void setExtension(String extension) { @@ -335,9 +344,11 @@ public class AGIRequestImpl implements S } /** - * Returns the priority in the dial plan from which the AGI script was called. + * Returns the priority in the dial plan from which the AGI script was + * called. * - * @return the priority in the dial plan from which the AGI script was called. + * @return the priority in the dial plan from which the AGI script was + * called. */ public Integer getPriority() { @@ -347,7 +358,8 @@ public class AGIRequestImpl implements S /** * Sets the priority in the dial plan from which the AGI script was called. * - * @param priority the priority in the dial plan from which the AGI script was called. + * @param priority the priority in the dial plan from which the AGI script + * was called. */ public void setPriority(Integer priority) { @@ -358,7 +370,8 @@ public class AGIRequestImpl implements S * Returns wheather this agi is passed audio (EAGI - Enhanced AGI).<br> * Enhanced AGI is currently not supported on FastAGI. * - * @return Boolean.TRUE if this agi is passed audio, Boolean.FALSE otherwise. + * @return Boolean.TRUE if this agi is passed audio, Boolean.FALSE + * otherwise. */ public Boolean getEnhanced() { @@ -368,7 +381,8 @@ public class AGIRequestImpl implements S /** * Sets wheather this agi is passed audio. * - * @param enhanced Boolean.TRUE if this agi is passed audio, Boolean.FALSE otherwise. + * @param enhanced Boolean.TRUE if this agi is passed audio, Boolean.FALSE + * otherwise. */ public void setEnhanced(Boolean enhanced) { @@ -397,7 +411,8 @@ public class AGIRequestImpl implements S public String toString() { - return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); + return ToStringBuilder.reflectionToString(this, + ToStringStyle.MULTI_LINE_STYLE); } public boolean equals(Object o) |
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22302/src/java/net/sf/asterisk/io Added Files: ServerSocketFacadeImpl.java SocketConnectionFacade.java ServerSocketFacade.java SocketConnectionFacadeImpl.java Log Message: --- NEW FILE: ServerSocketFacadeImpl.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.io; import java.io.IOException; import java.net.ServerSocket; import java.net.Socket; public class ServerSocketFacadeImpl implements ServerSocketFacade { private ServerSocket serverSocket; public ServerSocketFacadeImpl(int port) throws IOException { this.serverSocket = new ServerSocket(port); } public SocketConnectionFacade accept() throws IOException { Socket socket; socket = serverSocket.accept(); return new SocketConnectionFacadeImpl(socket); } public void close() throws IOException { serverSocket.close(); } } --- NEW FILE: SocketConnectionFacade.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.io; import java.io.IOException; /** * The SocketConnectionFacade provides read and write operation for * communication over TCP/IP sockets.<br> * It hides the details of the underlying I/O system used for socket * communication. * * @author srt * @version $Id: SocketConnectionFacade.java,v 1.1 2005/03/08 16:48:35 srt Exp $ */ public interface SocketConnectionFacade { /** * Reads a line of text from the socket connection. The current thread is * blocked until either the next line is received or an IOException * encounters. * * @return the line of text received excluding any newline character * @throws IOException if the connection has been closed. */ String readLine() throws IOException; /** * Sends a given String to the socket connection. * * @param s the String to send. * @throws IOException if the String cannot be sent, maybe because the * connection has already been closed. */ void write(String s) throws IOException; /** * Flushes the socket connection, that is sends any buffered but yet unsent * data. * * @throws IOException if the connection cannot be flushed. */ void flush() throws IOException; /** * Closes the socket connection including its input and output stream and * frees all associated ressources.<br> * When calling close() any Thread currently blocked by a call to readLine() * will be unblocked and receive an IOException. * * @throws IOException if the socket connection cannot be closed. */ void close() throws IOException; } --- NEW FILE: ServerSocketFacade.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.io; import java.io.IOException; /** * * @author srt * @version $Id: ServerSocketFacade.java,v 1.1 2005/03/08 16:48:35 srt Exp $ */ public interface ServerSocketFacade { /** * Waits for a new incoming connection. * * @return * @throws IOException */ SocketConnectionFacade accept() throws IOException; /** * Unbinds and closes the server socket. * * @throws IOException if the server socket cannot be closed. */ void close() throws IOException; } --- NEW FILE: SocketConnectionFacadeImpl.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.io; import java.io.BufferedReader; import java.io.BufferedWriter; import java.io.IOException; import java.io.InputStreamReader; import java.io.OutputStreamWriter; import java.net.Socket; public class SocketConnectionFacadeImpl implements SocketConnectionFacade { private final Socket socket; private final BufferedReader reader; private final BufferedWriter writer; public SocketConnectionFacadeImpl(String host, int port) throws IOException { this.socket = new Socket(host, port); this.reader = new BufferedReader(new InputStreamReader(this.socket.getInputStream())); this.writer = new BufferedWriter(new OutputStreamWriter(this.socket.getOutputStream())); } SocketConnectionFacadeImpl(Socket socket) throws IOException { this.socket = socket; this.reader = new BufferedReader(new InputStreamReader(this.socket.getInputStream())); this.writer = new BufferedWriter(new OutputStreamWriter(this.socket.getOutputStream())); } public String readLine() throws IOException { return reader.readLine(); } public void write(String s) throws IOException { writer.write(s); } public void flush() throws IOException { writer.flush(); } public void close() throws IOException { this.socket.close(); } } |
From: Stefan R. <sr...@us...> - 2005-03-08 16:48:48
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22302/src/java/net/sf/asterisk/manager/io Removed Files: SocketConnectionFacade.java SocketConnectionFacadeImpl.java Log Message: --- SocketConnectionFacade.java DELETED --- --- SocketConnectionFacadeImpl.java DELETED --- |
From: Stefan R. <sr...@us...> - 2005-03-08 16:48:03
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22150/src/java/net/sf/asterisk/io Log Message: Directory /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/io added to the repository |
From: Stefan R. <sr...@us...> - 2005-03-08 02:58:13
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12136/src/java/net/sf/asterisk/fastagi/reply Modified Files: AGIReply.java Log Message: Fixed typo in javadoc of getUsage (was 502 must be 520) Index: AGIReply.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply/AGIReply.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- AGIReply.java 8 Mar 2005 02:55:35 -0000 1.2 +++ AGIReply.java 8 Mar 2005 02:58:01 -0000 1.3 @@ -118,8 +118,8 @@ public class AGIReply implements Seriali } /** - * Returns the synopsis of the command sent if Asterisk expected a different syntax (status == - * 502). + * Returns the synopsis of the command sent if Asterisk expected a different syntax (getStatus() == + * SC_INVALID_COMMAND_SYNTAX). * * @return the synopsis of the command sent, <code>null</code> if there were no syntax errors. */ |
From: Stefan R. <sr...@us...> - 2005-03-08 02:55:47
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv11648/src/java/net/sf/asterisk/fastagi/reply Modified Files: AGIReply.java Log Message: Added status and usage properties Renamed returnCode to result in accordance to asterisk parlance Index: AGIReply.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply/AGIReply.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIReply.java 8 Mar 2005 02:25:35 -0000 1.1 +++ AGIReply.java 8 Mar 2005 02:55:35 -0000 1.2 @@ -19,7 +19,10 @@ package net.sf.asterisk.fastagi.reply; import java.io.Serializable; /** - * Response to an AGICommand. + * Reply received in response to an AGICommand.<br> + * The AGIReply contains information about success or failure of the execution of an AGICommand and - + * depending on the command sent - additional information returned, for example the value of a + * variable requested by a GetVariableCommand. * * @see net.sf.asterisk.fastagi.command.AGICommand * @@ -29,29 +32,109 @@ import java.io.Serializable; public class AGIReply implements Serializable { /** + * Status code (200) indicating Asterisk successfully processed the AGICommand. + */ + public static int SC_SUCCESS = 200; + + /** + * Status code (510) indicating Asterisk was unable to process the AGICommand because there is + * no command with the given name available. + */ + public static int SC_INVALID_OR_UNKNOWN_COMMAND = 510; + + /** + * Status code (510) indicating Asterisk was unable to process the AGICommand because the syntax + * used was not correct. This is most likely due to missing required parameters or additional + * parameters sent that are not understood.<br> + * Ensure proper quoting of the parameters when you receive this status code. + */ + public static int SC_INVALID_COMMAND_SYNTAX = 520; + + /** * Serial version identifier. */ private static final long serialVersionUID = 3256727294671337012L; - int returnCode; + /** + * The return code. + */ + private int result; + + /** + * The status code. + */ + private int status; + + /** + * In case of status == 520 (invalid command syntax) this attribute contains the synopsis of the + * command. + */ + private String usage; /** * Returns the return code. * * @return the return code. */ - public int getReturnCode() + public int getResult() { - return returnCode; + return result; } /** * Sets the return code. * - * @param returnCode the return code to set. + * @param result the return code to set. */ - public void setReturnCode(int returnCode) + public void setResult(int result) { - this.returnCode = returnCode; + this.result = result; + } + + /** + * Returns the status code.<br> + * Supported status codes are: + * <ul> + * <li>200 Success + * <li>510 Invalid or unknown command + * <li>520 Invalid command syntax + * </ul> + * + * @return the status code. + */ + public int getStatus() + { + return status; + } + + /** + * Sets the status code. + * + * @param status the status code to set. + */ + public void setStatus(int status) + { + this.status = status; + } + + /** + * Returns the synopsis of the command sent if Asterisk expected a different syntax (status == + * 502). + * + * @return the synopsis of the command sent, <code>null</code> if there were no syntax errors. + */ + public String getUsage() + { + return usage; + } + + /** + * Sets the synopsis of the command sent. + * + * @param usage the synopsis of the command sent. + */ + public void setUsage(String usage) + { + this.usage = usage; } } |
From: Stefan R. <sr...@us...> - 2005-03-08 02:33:09
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5970/src/java/net/sf/asterisk/fastagi Modified Files: AGIServer.java Log Message: Fixed spelling Index: AGIServer.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIServer.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIServer.java 8 Mar 2005 02:25:34 -0000 1.1 +++ AGIServer.java 8 Mar 2005 02:32:58 -0000 1.2 @@ -21,7 +21,7 @@ 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. + * The AGIRequest is then handed over to the appropriate AGIScript for processing. * * @author srt * @version $Id$ @@ -30,7 +30,7 @@ public interface AGIServer { /** * Starts this AGIServer.<br> - * After calling startup() this AGIServer is ready to receive requests from Asterisk server and + * After calling startup() this AGIServer is ready to receive requests from Asterisk servers and * process them. * * @throws IOException if the server socket cannot be bound. @@ -39,7 +39,7 @@ public interface AGIServer void startup() throws IOException, IllegalStateException; /** - * Shutdowns this AGIServer.<br> + * Shuts this AGIServer down.<br> * The server socket is closed and all resources are freed. * * @throws IOException if the connection cannot be shut down. |
From: Stefan R. <sr...@us...> - 2005-03-08 02:26:55
|
Update of /cvsroot/asterisk-java/asterisk-java/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4217/xdocs Modified Files: index.xml Log Message: Added information about ongoing FastAGI implementation Updated information about adding custom events and actions Index: index.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/xdocs/index.xml,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- index.xml 24 Feb 2005 22:25:36 -0000 1.4 +++ index.xml 8 Mar 2005 02:26:45 -0000 1.5 @@ -50,15 +50,17 @@ </subsection> <subsection name="Status"> <p>Currently asterisk-java supports the actions and events - provided by the standard installation of Asterisk. Future - releases will add the ability to easily extend them by user - provided events and actions.</p> + provided by the standard installation of Asterisk but you can + easily extend them by your own events and actions.</p> <p>Ideas for the future include a stateful higher level API that supports operations like "get list of currently active calls" or "place call" with objects like "Call" or "Channel" that are transparently updated as the state of the corresponding object within the asterisk server changes.</p> + <p>There is also some work on an implementation of the FastAGI protocol + as the currently available java implementations (see below) are both + subject to the strict terms of the GPL.</p> </subsection> <subsection name="Download"> <p>Asterisk-java is currently available via cvs only.</p> |
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); } |
From: Stefan R. <sr...@us...> - 2005-03-08 02:25:46
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3831/src/java/net/sf/asterisk/fastagi/reply Added Files: AGIReply.java Log Message: Added interfaces for the major AGI concepts --- NEW FILE: AGIReply.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.reply; import java.io.Serializable; /** * Response to an AGICommand. * * @see net.sf.asterisk.fastagi.command.AGICommand * * @author srt * @version $Id: AGIReply.java,v 1.1 2005/03/08 02:25:35 srt Exp $ */ public class AGIReply implements Serializable { /** * Serial version identifier. */ private static final long serialVersionUID = 3256727294671337012L; int returnCode; /** * Returns the return code. * * @return the return code. */ public int getReturnCode() { return returnCode; } /** * Sets the return code. * * @param returnCode the return code to set. */ public void setReturnCode(int returnCode) { this.returnCode = returnCode; } } |
From: Stefan R. <sr...@us...> - 2005-03-08 02:25:14
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv3683/src/java/net/sf/asterisk/fastagi/reply Log Message: Directory /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply added to the repository |
From: Stefan R. <sr...@us...> - 2005-03-05 23:22:16
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32172/src/java/net/sf/asterisk/fastagi/command Modified Files: AGICommand.java Log Message: Added javadoc Index: AGICommand.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command/AGICommand.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGICommand.java 5 Mar 2005 22:46:58 -0000 1.1 +++ AGICommand.java 5 Mar 2005 23:22:05 -0000 1.2 @@ -24,6 +24,7 @@ import org.apache.commons.lang.builder.T import org.apache.commons.lang.builder.ToStringStyle; /** + * Abstract base class for all commands supported by asterisk's FastAGI. * * @author srt * @version $Id$ |
From: Stefan R. <sr...@us...> - 2005-03-05 23:03:09
|
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27697/src/test/net/sf/asterisk/fastagi Modified Files: AGIRequestBuilderImplTest.java Log Message: Added verification for uniqueId Fixed test for line without colon Index: AGIRequestBuilderImplTest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi/AGIRequestBuilderImplTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIRequestBuilderImplTest.java 5 Mar 2005 22:46:59 -0000 1.1 +++ AGIRequestBuilderImplTest.java 5 Mar 2005 23:02:30 -0000 1.2 @@ -60,6 +60,7 @@ public class AGIRequestBuilderImplTest e assertEquals("incorrect channel", "SIP/1234-d715", request.getChannel()); assertEquals("incorrect uniqueId", "SIP/1234-d715", request.getChannel()); assertEquals("incorrect type", "SIP", request.getType()); + assertEquals("incorrect uniqueId", "1110023416.6", request.getUniqueId()); assertEquals("incorrect language", "en", request.getLanguage()); assertEquals("incorrect callerId", "1234", request.getCallerId()); assertEquals("incorrect callerIdName", "John Doe", request.getCallerIdName()); @@ -182,7 +183,7 @@ public class AGIRequestBuilderImplTest e lines = new ArrayList(); lines.add("var without agi prefix: a value"); - lines.add("agi_without_colon: another value"); + lines.add("agi_without_colon another value"); lines.add("agi_without_space_after_colon:"); lines.add("agi_channel: SIP/1234-a892"); |
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24114/src/java/net/sf/asterisk/fastagi/command Added Files: DatabaseDelCommand.java SetPriorityCommand.java AGICommand.java DatabaseDelTreeCommand.java SayTimeCommand.java SayNumberCommand.java SetMusicOnCommand.java GetVariableCommand.java SetContextCommand.java DatabasePutCommand.java SetMusicOffCommand.java SetVariableCommand.java SetAutoHangupCommand.java GetDataCommand.java SayPhoneticCommand.java SendImageCommand.java ExecCommand.java SetExtensionCommand.java SendTextCommand.java HangupCommand.java SayDigitsCommand.java ChannelStatusCommand.java StreamFileCommand.java VerboseCommand.java SetCallerIdCommand.java TDDModeCommand.java WaitForDigitCommand.java AnswerCommand.java ReceiveCharCommand.java NoopCommand.java DatabaseGetCommand.java RecordFileCommand.java Log Message: Added initial stuff for fastagi support --- NEW FILE: DatabaseDelCommand.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.command; /** * Deletes a family or specific keytree within a family in the Asterisk database.<br> * Returns 1 if successful, 0 otherwise. * * @author srt * @version $Id: DatabaseDelCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class DatabaseDelCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256719598056387384L; /** * The family (or family of the keytree) to delete. */ private String family; /** * The keyTree to delete. */ private String keyTree; /** * Creates a new DatabaseDelCommand to delete a family. * * @param family the family to delete. */ public DatabaseDelCommand(String family) { this.family = family; this.keyTree = null; } /** * Creates a new DatabaseDelCommand to delete a keytree. * * @param family the family of the keytree to delete. * @param keyTree the keytree to delete. */ public DatabaseDelCommand(String family, String keyTree) { this.family = family; this.keyTree = keyTree; } /** * Returns the family (or family of the keytree) to delete. * * @return the family (or family of the keytree) to delete. */ public String getFamily() { return family; } /** * Sets the family (or family of the keytree) to delete. * * @param family the family (or family of the keytree) to delete. */ public void setFamily(String family) { this.family = family; } /** * Returns the the keytree to delete. * * @return the keytree to delete. */ public String getKeyTree() { return keyTree; } /** * Sets the keytree to delete. * * @param keyTree the keytree to delete. */ public void setKeyTree(String keyTree) { this.keyTree = keyTree; } public String buildCommand() { return "DATABASE DELTREE " + escapeAndQuote(family) + (keyTree == null ? "" : " " + escapeAndQuote(keyTree)); } } --- NEW FILE: SetPriorityCommand.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.command; /** * Sets the priority for continuation upon exiting the application. * * @author srt * @version $Id: SetPriorityCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SetPriorityCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256719598056387384L; /** * The priority for continuation upon exiting the application. */ private int priority; /** * Creates a new SetPriorityCommand. * * @param priority the priority for continuation upon exiting the application. */ public SetPriorityCommand(int priority) { this.priority = priority; } /** * Returns the priority for continuation upon exiting the application. * * @return the priority for continuation upon exiting the application. */ public int getPriority() { return priority; } /** * Sets the priority for continuation upon exiting the application. * * @param priority the priority for continuation upon exiting the application. */ public void setPriority(int priority) { this.priority = priority; } public String buildCommand() { return "SET PRIORITY " + priority; } } --- NEW FILE: AGICommand.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.command; import java.io.Serializable; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; /** * * @author srt * @version $Id: AGICommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public abstract class AGICommand implements Serializable { /** * Serial version identifier. */ private static final long serialVersionUID = 3257849874518456633L; /** * Returns a string suitable to be sent to asterisk.<br> * * @return a string suitable to be sent to asterisk. */ public abstract String buildCommand(); protected String escapeAndQuote(String s) { String tmp; if (s == null) { return "\"\""; } tmp = s; tmp = tmp.replaceAll("\\\"", "\\\\\""); // escape quotes tmp = tmp.replaceAll("\\\n", ""); // filter newline return "\"" + tmp + "\""; // add quotes } public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); } public boolean equals(Object o) { return EqualsBuilder.reflectionEquals(this, o); } public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } } --- NEW FILE: DatabaseDelTreeCommand.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.command; /** * Deletes an entry in the Asterisk database for a given family and key.<br> * Returns 1 if successful, 0 otherwise. * * @author srt * @version $Id: DatabaseDelTreeCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class DatabaseDelTreeCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256719598056387384L; /** * The family of the key to delete. */ private String family; /** * The key to delete. */ private String key; /** * Creates a new DatabaseDelCommand. * * @param family the family of the key to delete. * @param key the key to delete. */ public DatabaseDelTreeCommand(String family, String key) { this.family = family; this.key = key; } /** * Returns the family of the key to delete. * * @return the family of the key to delete. */ public String getFamily() { return family; } /** * Sets the family of the key to delete. * * @param family the family of the key to delete. */ public void setFamily(String family) { this.family = family; } /** * Returns the the key to delete. * * @return the key to delete. */ public String getKey() { return key; } /** * Sets the key to delete. * * @param key the key to delete. */ public void setKey(String key) { this.key = key; } public String buildCommand() { return "DATABASE DEL " + escapeAndQuote(family) + " " + escapeAndQuote(key); } } --- NEW FILE: SayTimeCommand.java --- /* * Copyright 2004-2005 Stefan Reuter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this time 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.command; /** * Say a given time, returning early if any of the given DTMF digits are received on the channel.<br> * Time is the number of seconds elapsed since 00:00:00 on January 1, 1970, Coordinated Universal * Time (UTC).<br> * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of * the digit if one was pressed or -1 on error/hangup. * * @author srt * @version $Id: SayTimeCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SayTimeCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256721797012404276L; /** * The time to say in seconds since 00:00:00 on January 1, 1970. */ private long time; /** * When one of these digits is pressed the command returns. */ private String escapeDigits; /** * Creates a new SayTimeCommand. * * @param time the time to say in seconds since 00:00:00 on January 1, 1970. */ public SayTimeCommand(long time) { this.time = time; this.escapeDigits = null; } /** * Creates a new SayTimeCommand. * * @param time the time to say in seconds since 00:00:00 on January 1, 1970. * @param escapeDigits contains the digits that allow the user to interrupt this command. */ public SayTimeCommand(long time, String interruptDigits) { this.time = time; this.escapeDigits = interruptDigits; } /** * Returns the time to say in seconds since 00:00:00 on January 1, 1970. * * @return the time to say in seconds since 00:00:00 on January 1, 1970. */ public long getTime() { return time; } /** * Sets the time to say in seconds since 00:00:00 on January 1, 1970. * * @param time the time to say in seconds since 00:00:00 on January 1, 1970. */ public void setTime(long time) { this.time = time; } /** * Returns the digits that allow the user to interrupt this command. * * @return the digits that allow the user to interrupt this command. */ public String getEscapeDigits() { return escapeDigits; } /** * Sets the digits that allow the user to interrupt this command. * * @param escapeDigits the time that allow the user to interrupt this command or * <code>null</code> for none. */ public void setEscapeDigits(String escapeDigits) { this.escapeDigits = escapeDigits; } public String buildCommand() { return "SAY TIME " + time + " " + escapeAndQuote(escapeDigits); } } --- NEW FILE: SayNumberCommand.java --- /* * Copyright 2004-2005 Stefan Reuter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this number 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.command; /** * Say a given number, returning early if any of the given DTMF number are received on the channel.<br> * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of * the digit if one was pressed or -1 on error/hangup. * * @author srt * @version $Id: SayNumberCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SayNumberCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3833744404153644087L; /** * The number to say. */ private String number; /** * When one of these number is pressed while streaming the command returns. */ private String interruptDigits; /** * Creates a new SayNumberCommand. * * @param number the number to say. */ public SayNumberCommand(String number) { this.number = number; this.interruptDigits = null; } /** * Creates a new SayNumberCommand. * * @param number the number to say. * @param interruptDigits contains the number that allow the user to interrupt this command. */ public SayNumberCommand(String number, String interruptDigits) { this.number = number; this.interruptDigits = interruptDigits; } /** * Returns the number to say. * * @return the number to say. */ public String getNumber() { return number; } /** * Sets the number to say. * * @param number the number to say. */ public void setNumber(String number) { this.number = number; } /** * Returns the number that allow the user to interrupt this command. * * @return the number that allow the user to interrupt this command. */ public String getInterruptDigits() { return interruptDigits; } /** * Sets the number that allow the user to interrupt this command. * * @param interruptDigits the number that allow the user to interrupt this command or * <code>null</code> for none. */ public void setInterruptDigits(String interruptDigits) { this.interruptDigits = interruptDigits; } public String buildCommand() { return "SAY NUMBER " + escapeAndQuote(number) + " " + escapeAndQuote(interruptDigits); } } --- NEW FILE: SetMusicOnCommand.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.command; /** * Turns on music on hold on the current channel.<br> * Always returns 0. * * @author srt * @version $Id: SetMusicOnCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SetMusicOnCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3762248656229053753L; /** * The music on hold class to play music from. */ private String musicOnHoldClass; /** * Creates a new SetMusicOnCommand playing music from the default music on hold class. */ public SetMusicOnCommand() { this.musicOnHoldClass = null; } /** * Returns the music on hold class to play music from. * * @return the music on hold class to play music from or <code>null</code> for the default * class. */ public String getMusicOnHoldClass() { return musicOnHoldClass; } /** * Sets the music on hold class to play music from. * * @param musicOnHoldClass the music on hold class to play music from or <code>null</code> for * the default class. */ public void setMusicOnHoldClass(String musicOnHoldClass) { this.musicOnHoldClass = musicOnHoldClass; } public String buildCommand() { return "SET MUSIC ON" + (musicOnHoldClass == null ? "" : " " + escapeAndQuote(musicOnHoldClass)); } } --- NEW FILE: GetVariableCommand.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.command; /** * Returns the value of the given channel varible.<br> * Returns 0 if is not set. Returns 1 if the variable is set and returns the variable in * parenthesis.<br> * Example return code: 200 result=1 (testvariable) * * @author srt * @version $Id: GetVariableCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class GetVariableCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256719598056387384L; /** * The name of the variable to retrieve. */ private String variable; /** * Creates a new GetVariableCommand. * * @param variable the name of the variable to retrieve. */ public GetVariableCommand(String variable) { this.variable = variable; } /** * Returns the name of the variable to retrieve. * * @return the the name of the variable to retrieve. */ public String getVariable() { return variable; } /** * Sets the name of the variable to retrieve. * * @param variable the name of the variable to retrieve. */ public void setVariable(String context) { this.variable = context; } public String buildCommand() { return "GET VARIABLE " + escapeAndQuote(variable); } } --- NEW FILE: SetContextCommand.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.command; /** * Sets the context for continuation upon exiting the application. * * @author srt * @version $Id: SetContextCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SetContextCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256719598056387384L; /** * The context for continuation upon exiting the application. */ private String context; /** * Creates a new SetPriorityCommand. * * @param context the context for continuation upon exiting the application. */ public SetContextCommand(String context) { this.context = context; } /** * Returns the context for continuation upon exiting the application. * * @return the context for continuation upon exiting the application. */ public String getContext() { return context; } /** * Sets the context for continuation upon exiting the application. * * @param context the context for continuation upon exiting the application. */ public void setContext(String context) { this.context = context; } public String buildCommand() { return "SET CONTEXT " + escapeAndQuote(context); } } --- NEW FILE: DatabasePutCommand.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.command; /** * Adds or updates an entry in the Asterisk database for a given family, key, and value.<br> * Returns 1 if successful, 0 otherwise. * * @author srt * @version $Id: DatabasePutCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class DatabasePutCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256719598056387384L; /** * The family of the key to set. */ private String family; /** * The key to set. */ private String key; /** * The value to set. */ private String value; /** * Creates a new DatabasePutCommand. * * @param family the family of the key to set. * @param key the key to set. * @param value the value to set. */ public DatabasePutCommand(String family, String key, String value) { this.family = family; this.key = key; this.value = value; } /** * Returns the family of the key to set. * * @return the family of the key to set. */ public String getFamily() { return family; } /** * Sets the family of the key to set. * * @param family the family of the key to set. */ public void setFamily(String family) { this.family = family; } /** * Returns the the key to set. * * @return the key to set. */ public String getKey() { return key; } /** * Sets the key to set. * * @param key the key to set. */ public void setKey(String key) { this.key = key; } /** * Returns the value to set. * * @return the value to set. */ public String getValue() { return value; } /** * Sets the value to set. * * @param value the value to set. */ public void setValue(String value) { this.value = value; } public String buildCommand() { return "DATABASE PUT " + escapeAndQuote(family) + " " + escapeAndQuote(key) + " " + escapeAndQuote(value); } } --- NEW FILE: SetMusicOffCommand.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.command; /** * Turns off music on hold on the current channel.<br> * Always returns 0. * * @author srt * @version $Id: SetMusicOffCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SetMusicOffCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3762248656229053753L; /** * Creates a new SetMusicOffCommand. */ public SetMusicOffCommand() { } public String buildCommand() { return "SET MUSIC OFF"; } } --- NEW FILE: SetVariableCommand.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.command; /** * Sets the given channel varible to the given value. * * @author srt * @version $Id: SetVariableCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SetVariableCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256719598056387384L; /** * The name of the variable to set. */ private String variable; /** * The value to set. */ private String value; /** * Creates a new GetVariableCommand. * * @param variable the name of the variable to set. * @param value the value to set. */ public SetVariableCommand(String variable, String value) { this.variable = variable; this.value = value; } /** * Returns the name of the variable to set. * * @return the the name of the variable to set. */ public String getVariable() { return variable; } /** * Sets the name of the variable to set. * * @param variable the name of the variable to set. */ public void setVariable(String context) { this.variable = context; } /** * Returns the value to set. * * @return the value to set. */ public String getValue() { return value; } /** * Sets the value to set. * * @param value the value to set. */ public void setValue(String value) { this.value = value; } public String buildCommand() { return "SET VARIABLE " + escapeAndQuote(variable) + " " + escapeAndQuote(value); } } --- NEW FILE: SetAutoHangupCommand.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.command; /** * Cause the channel to automatically hangup at the given number of seconds in the future.<br> * Of course it can be hungup before then as well. Setting to 0 will cause the autohangup feature to * be disabled on this channel. * * @author srt * @version $Id: SetAutoHangupCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SetAutoHangupCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3257562923458443314L; /** * The number of seconds before this channel is automatically hung up. */ private int time; /** * Creates a new SetAutoHangupCommand. * * @param time the number of seconds before this channel is automatically hung up.<br> * 0 disables the autohangup feature. */ public SetAutoHangupCommand(int time) { this.time = time; } /** * Returns the number of seconds before this channel is automatically hung up. * * @return the number of seconds before this channel is automatically hung up. */ public int getTime() { return time; } /** * Sets the number of seconds before this channel is automatically hung up. * * @param time the number of seconds before this channel is automatically hung up.<br> * 0 disables the autohangup feature. */ public void setTime(int timeout) { this.time = timeout; } public String buildCommand() { return "SET AUTOHANGUP " + time; } } --- NEW FILE: GetDataCommand.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.command; /** * Stream the given file, and recieve DTMF data.<br> * Returns the digits recieved from the channel at the other end.<br> * Input ends when the timeout is reached, the maximum number of digits is read or the user presses #. * * @author srt * @version $Id: GetDataCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class GetDataCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3978141041352128820L; /** * The name of the file to stream. */ private String file; /** * The timeout to wait for data.<br> * 0 means standard timeout value, -1 means "ludicrous time" (essentially never times out). */ private int timeout; /** * The maximum number of digits to read.<br> * Must be in [1..1024]. */ private int maxDigits; /** * Creates a new GetDataCommand with default timeout and maxDigits set to 1024. * * @param file the name of the file to stream, must not include extension. */ public GetDataCommand(String file) { this.file = file; this.timeout = 0; this.maxDigits = 1024; } /** * Creates a new GetDataCommand. * * @param file the name of the file to stream, must not include extension. * @param timeout the timeout to wait for data.<br> * 0 means standard timeout value, -1 means "ludicrous time" (essentially never times out). * @param maxDigits the maximum number of digits to read.<br> * Must be in [1..1024]. * * @throws IllegalArgumentException if maxDigits is not in [1..1024] */ public GetDataCommand(String file, int timeout, int maxDigits) throws IllegalArgumentException { if (maxDigits < 1 || maxDigits > 1024) { throw new IllegalArgumentException("maxDigits must be in [1..1024]"); } this.file = file; this.timeout = timeout; this.maxDigits = maxDigits; } /** * Returns the name of the file to stream. * * @return the name of the file to stream. */ public String getFile() { return file; } /** * Sets the name of the file to stream. * * @param file the name of the file to stream, must not include extension. */ public void setFile(String file) { this.file = file; } /** * Returns the timeout to wait for data. * * @return the timeout to wait for data. */ public int getTimeout() { return timeout; } /** * Sets the timeout to wait for data. * * @param timeout the timeout to wait for data.<br> * 0 means standard timeout value, -1 means "ludicrous time" (essentially never times out). */ public void setTimeout(int timeout) { this.timeout = timeout; } /** * Returns the maximum number of digits to read. * * @return the maximum number of digits to read. */ public int getMaxDigits() { return maxDigits; } /** * Sets the maximum number of digits to read. * * @param maxDigits the maximum number of digits to read.<br> * Must be in [1..1024]. * * @throws IllegalArgumentException if maxDigits is not in [1..1024] */ public void setMaxDigits(int maxDigits) throws IllegalArgumentException { if (maxDigits < 1 || maxDigits > 1024) { throw new IllegalArgumentException("maxDigits must be in [1..1024]"); } this.maxDigits = maxDigits; } public String buildCommand() { return "GET DATA " + escapeAndQuote(file) + " " + timeout + " " + maxDigits; } } --- NEW FILE: SayPhoneticCommand.java --- /* * Copyright 2004-2005 Stefan Reuter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this text 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.command; /** * Say a given character string with phonetics, returning early if any of the given DTMF digits are * received on the channel.<br> * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of * the digit if one was pressed or -1 on error/hangup. * * @author srt * @version $Id: SayPhoneticCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SayPhoneticCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256721797012404276L; /** * The text to say. */ private String text; /** * When one of these digits is pressed the command returns. */ private String escapeDigits; /** * Creates a new SayPhonticCommand. * * @param text the text to say. */ public SayPhoneticCommand(String text) { this.text = text; this.escapeDigits = null; } /** * Creates a new SayPhoneticCommand. * * @param text the text to say. * @param escapeDigits contains the digits that allow the user to interrupt this command. */ public SayPhoneticCommand(String text, String interruptDigits) { this.text = text; this.escapeDigits = interruptDigits; } /** * Returns the text to say. * * @return the text to say. */ public String getText() { return text; } /** * Sets the text to say. * * @param text the text to say. */ public void setText(String text) { this.text = text; } /** * Returns the digits that allow the user to interrupt this command. * * @return the digits that allow the user to interrupt this command. */ public String getEscapeDigits() { return escapeDigits; } /** * Sets the digits that allow the user to interrupt this command. * * @param escapeDigits the text that allow the user to interrupt this command or * <code>null</code> for none. */ public void setEscapeDigits(String escapeDigits) { this.escapeDigits = escapeDigits; } public String buildCommand() { return "SAY PHONETIC " + escapeAndQuote(text) + " " + escapeAndQuote(escapeDigits); } } --- NEW FILE: SendImageCommand.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.command; /** * Sends the given image on a channel.<br> * Most channels do not support the transmission of images.<br> * Returns 0 if image is sent, or if the channel does not support image transmission. Returns -1 * only on error/hangup.<br> * Image names should not include extensions. * * @author srt * @version $Id: SendImageCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SendImageCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3904959746380281145L; /** * The name of the image to send. */ private String image; /** * Creates a new SendImageCommand. * * @param image the image to send, should not include extension. */ public SendImageCommand(String image) { this.image = image; } /** * Returns the image to send. * * @return the image to send. */ public String getImage() { return image; } /** * Sets the image to send. * * @param image the image to send, should not include extension. */ public void setImage(String image) { this.image = image; } public String buildCommand() { return "SEND IMAGE " + escapeAndQuote(image); } } --- NEW FILE: ExecCommand.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.command; /** * Executes an application with the given options.<br> * Returns whatever the application returns, or -2 on failure to find application. * * @author srt * @version $Id: ExecCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class ExecCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3904959746380281145L; /** * The name of the application to execute. */ private String application; /** * The options to pass to the application. */ private String options; /** * Creates a new ExecCommand. * * @param application the name of the application to execute. */ public ExecCommand(String application) { this.application = application; } /** * Creates a new ExecCommand. * * @param application the name of the application to execute. * @param options the options to pass to the application. */ public ExecCommand(String application, String options) { this.application = application; this.options = options; } /** * Returns the name of the application to execute. * * @return the name of the application to execute. */ public String getApplication() { return application; } /** * Sets the name of the application to execute. * * @param application the name of the application to execute. */ public void setApplication(String channel) { this.application = channel; this.options = null; } /** * Returns the options to pass to the application. * * @return the options to pass to the application. */ public String getOptions() { return options; } /** * Sets the options to pass to the application. * * @param options the options to pass to the application. */ public void setOptions(String options) { this.options = options; } public String buildCommand() { return "EXEC " + escapeAndQuote(application) + " " + escapeAndQuote(options); } } --- NEW FILE: SetExtensionCommand.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.command; /** * Sets the extension for continuation upon exiting the application. * * @author srt * @version $Id: SetExtensionCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SetExtensionCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3256719598056387384L; /** * The extension for continuation upon exiting the application. */ private String extension; /** * Creates a new SetPriorityCommand. * * @param extension the extension for continuation upon exiting the application. */ public SetExtensionCommand(String extension) { this.extension = extension; } /** * Returns the extension for continuation upon exiting the application. * * @return the extension for continuation upon exiting the application. */ public String getExtension() { return extension; } /** * Sets the extension for continuation upon exiting the application. * * @param extension the extension for continuation upon exiting the application. */ public void setExtension(String extension) { this.extension = extension; } public String buildCommand() { return "SET EXTENSION " + escapeAndQuote(extension); } } --- NEW FILE: SendTextCommand.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.command; /** * Sends the given text on a channel.<br> * Most channels do not support the transmission of text.<br> * Returns 0 if text is sent, or if the channel does not support text transmission. Returns -1 only * on error/hangup. * * @author srt * @version $Id: SendTextCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SendTextCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3904959746380281145L; /** * The text to send. */ private String text; /** * Creates a new SendTextCommand. * * @param text the text to send. */ public SendTextCommand(String text) { this.text = text; } /** * Returns the text to send. * * @return the text to send. */ public String getText() { return text; } /** * Sets the text to send. * * @param text the text to send. */ public void setText(String text) { this.text = text; } public String buildCommand() { return "SEND TEXT " + escapeAndQuote(text); } } --- NEW FILE: HangupCommand.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.command; /** * Hangs up the specified channel. If no channel name is given, hangs up the current channel. * * @author srt * @version $Id: HangupCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class HangupCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3904959746380281145L; /** * The name of the channel to hangup or <code>null</code> for the current channel. */ private String channel; /** * Creates a new HangupCommand that hangs up the current channel. */ public HangupCommand() { this.channel = null; } /** * Creates a new HangupCommand that hangs up the given channel. * * @param channel the name of the channel to hangup. */ public HangupCommand(String channel) { this.channel = channel; } /** * Returns the name of the channel to hangup. * * @return the name of the channel to hangup or <code>null</code> for the current channel. */ public String getChannel() { return channel; } /** * Sets the name of the channel to hangup. * * @param channel the name of the channel to hangup or <code>null</code> for the current * channel. */ public void setChannel(String channel) { this.channel = channel; } public String buildCommand() { return "HANGUP" + (channel == null ? "" : " " + escapeAndQuote(channel)); } } --- NEW FILE: SayDigitsCommand.java --- /* * Copyright 2004-2005 Stefan Reuter * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this number 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.command; /** * Say a given digit string, returning early if any of the given DTMF number are received on the * channel.<br> * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of * the digit if one was pressed or -1 on error/hangup. * * @author srt * @version $Id: SayDigitsCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class SayDigitsCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3907207173934101552L; /** * The number to say. */ private String number; /** * When one of these digits is pressed while saying the number the command returns. */ private String escapeDigits; /** * Creates a new SayDigitsCommand. * * @param number the number to say. */ public SayDigitsCommand(String digits) { this.number = digits; this.escapeDigits = null; } /** * Creates a new SayDigitsCommand. * * @param number the number to say. * @param escapeDigits the digits that allow the user to interrupt this command. */ public SayDigitsCommand(String number, String escapeDigits) { this.number = number; this.escapeDigits = escapeDigits; } /** * Returns the number to say. * * @return the number to say. */ public String getNumber() { return number; } /** * Sets the number to say. * * @param number the number to say. */ public void setNumber(String number) { this.number = number; } /** * Returns the digits that allow the user to interrupt this command. * * @return the digits that allow the user to interrupt this command. */ public String getEscapeDigits() { return escapeDigits; } /** * Sets the digits that allow the user to interrupt this command. * * @param escapeDigits the digits that allow the user to interrupt this command or * <code>null</code> for none. */ public void setEscapeDigits(String escapeDigits) { this.escapeDigits = escapeDigits; } public String buildCommand() { return "STREAM DIGITS " + escapeAndQuote(number) + " " + escapeAndQuote(escapeDigits); } } --- NEW FILE: ChannelStatusCommand.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.command; /** * Returns the status of the specified channel. If no channel name is given the returns the status * of the current channel.<br> * Return values: * <ul> * <li>0 Channel is down and available * <li>1 Channel is down, but reserved * <li>2 Channel is off hook * <li>3 Digits (or equivalent) have been dialed * <li>4 Line is ringing * <li>5 Remote end is ringing * <li>6 Line is up * <li>7 Line is busy * </ul> * * @author srt * @version $Id: ChannelStatusCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class ChannelStatusCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3904959746380281145L; /** * The name of the channel to query or <code>null</code> for the current channel. */ private String channel; /** * Creates a new ChannelStatusCommand that queries the current channel. */ public ChannelStatusCommand() { this.channel = null; } /** * Creates a new ChannelStatusCommand that queries the given channel. * * @param channel the name of the channel to query. */ public ChannelStatusCommand(String channel) { this.channel = channel; } /** * Returns the name of the channel to query. * * @return the name of the channel to query or <code>null</code> for the current channel. */ public String getChannel() { return channel; } /** * Sets the name of the channel to query. * * @param channel the name of the channel to query or <code>null</code> for the current * channel. */ public void setChannel(String channel) { this.channel = channel; } public String buildCommand() { return "CHANNEL STATUS" + (channel == null ? "" : " " + escapeAndQuote(channel)); } } --- NEW FILE: StreamFileCommand.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.command; /** * Plays the given file, allowing playback to be interrupted by the given digits, if any.<br> * If offset is provided then the audio will seek to sample offset before play starts.<br> * Returns 0 if playback completes without a digit being pressed, or the ASCII numerical value of * the digit if one was pressed, or -1 on error or if the channel was disconnected. <br> * Remember, the file extension must not be included in the filename. * * @author srt * @version $Id: StreamFileCommand.java,v 1.1 2005/03/05 22:46:58 srt Exp $ */ public class StreamFileCommand extends AGICommand { /** * Serial version identifier. */ private static final long serialVersionUID = 3978141041352128820L; /** * The name of the file to stream. */ private String file; /** * When one of these digits is pressed while streaming the command returns. */ private String escapeDigits; /** * The offset samples to skip before streaming. */ private int offset; /** * Creates a new StreamFileCommand, streaming from the beginning. * * @param file the name of the file to stream, must not include extension. */ public StreamFileCommand(String file) { this.file = file; this.escapeDigits = null; this.offset = -1; } /** * Creates a new StreamFileCommand, streaming from the beginning. * * @param file the name of the file to stream, must not include extension. * @param escapeDigits contains the digits that allow the user to interrupt this command. */ public StreamFileCommand(String file, String escapeDigits) { this.file = file; this.escapeDigits = escapeDigits; this.offset = -1; } /** * Creates a new StreamFileCommand, streaming from the given offset. * * @param file the name of the file to stream, must not include extension. * @param escapeDigits contains the digits that allow the user to interrupt this command. Maybe * <code>null</code> if you don't want the user to interrupt. * @param offset the offset samples to skip before streaming. */ public StreamFileCommand(String file, String escapeDigits, int offset) { this.offset = offset; this.escapeDigits = escapeDigits; this.offset = offset; } /** * Returns the name of the file to stream. * * @return the name of the file to stream. */ public String getFile() { return file; } /** * Sets the name of the file to stream. * * @param file the name of the file to stream, must not include extension. */ public void setFile(String file) { this.file = file; } /** * Returns the digits that allow the user to interrupt this command. * * @return the digits that allow the user to interrupt this command. */ public String getEscapeDigits() { return escapeDigits; } /** * Sets the digits that allow the user to interrupt this command. * * @param escapeDigits the digits that allow the user to interrupt this command or * <code>null</code> for none. */ public void setEscapeDigits(String escapeDigits) { this.escapeDigits = escapeDigits; } /** * Returns the offset samples to skip before streaming. * * @return the offset samples to skip before streaming. */ public int getOffset() { return offset; } /** * Sets the offset samples to skip before streaming. * * @param offset the offset samples to skip before streaming. */ public void setOffset(int offset) { this.offset = offset; } public String buildCommand() { return "STREAM FILE " + escapeAndQuote(file) + " " + escapeAndQuote(escapeDigits) + (offset < 0 ? "" : " " + offset); } } --- NEW FILE: VerboseCommand.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.apach... [truncated message content] |
From: Stefan R. <sr...@us...> - 2005-03-05 22:47:12
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24114/src/java/net/sf/asterisk/fastagi Added Files: AGIRequestBuilderImpl.java AGIRequestBuilder.java AGIRequestImpl.java AGIRequest.java Log Message: Added initial stuff for fastagi support --- NEW FILE: AGIRequestBuilderImpl.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.util.Collection; import java.util.HashMap; import java.util.Iterator; import java.util.Map; /** * Default implementation of the AGIRequestBuilder interface. * * @author srt * @version $Id: AGIRequestBuilderImpl.java,v 1.1 2005/03/05 22:46:59 srt Exp $ */ public class AGIRequestBuilderImpl implements AGIRequestBuilder { /** * Creates a new AGIRequestBuilderImpl. */ public AGIRequestBuilderImpl() { } public AGIRequest buildAGIRequest(final Collection lines) { AGIRequestImpl request; Map map; if (lines == null) { throw new IllegalArgumentException("Environment must not be null."); } request = new AGIRequestImpl(); map = buildMap(lines); request.setScript((String) map.get("network_script")); request.setRequestURL((String) map.get("request")); request.setChannel((String) map.get("channel")); request.setUniqueId((String) map.get("uniqueid")); request.setType((String) map.get("type")); request.setLanguage((String) map.get("language")); if (map.get("callerid") != null) { String rawCallerId = (String) map.get("callerid"); request.setCallerId(getCallerId(rawCallerId)); request.setCallerIdName(getCallerIdName(rawCallerId)); } request.setDnid((String) map.get("dnid")); request.setRdnis((String) map.get("rdnis")); request.setContext((String) map.get("context")); request.setExtension((String) map.get("extension")); if (map.get("priority") != null) { request.setPriority(new Integer((String) map.get("priority"))); } if (map.get("enhanced") != null) { if ("1.0".equals((String) map.get("enhanced"))) { request.setEnhanced(Boolean.TRUE); } else { request.setEnhanced(Boolean.FALSE); } } request.setAccountCode((String) map.get("accountcode")); return request; } /** * Builds a map containing variable names as key (with the "agi_" prefix stripped) and the * corresponding values.<br> * Syntactically invalid and empty variables are skipped. * * @param lines the environment to transform. * @return a map with the variables set corresponding to the given environment. */ private Map buildMap(final Collection lines) { Map map; Iterator lineIterator; map = new HashMap(); lineIterator = lines.iterator(); while (lineIterator.hasNext()) { String line; int colonPosition; String key; String value; line = (String) lineIterator.next(); colonPosition = line.indexOf(':'); // no colon on the line? if (colonPosition < 0) { continue; } // key doesn't start with agi_? if (!line.startsWith("agi_")) { continue; } // first colon in line is last character -> no value present? if (line.length() < colonPosition + 2) { continue; } key = line.substring(4, colonPosition).toLowerCase(); value = line.substring(colonPosition + 2); if (value.length() != 0) { map.put(key, value); } } return map; } private String getCallerId(final String rawCallerId) { int lbPosition; int rbPosition; lbPosition = rawCallerId.indexOf('<'); rbPosition = rawCallerId.indexOf('>'); if (lbPosition < 0 || rbPosition < 0) { return rawCallerId; } return rawCallerId.substring(lbPosition + 1, rbPosition); } private String getCallerIdName(final String rawCallerId) { int lbPosition; String callerIdName; lbPosition = rawCallerId.indexOf('<'); if (lbPosition < 0) { return null; } callerIdName = rawCallerId.substring(0, lbPosition).trim(); if (callerIdName.startsWith("\"") && callerIdName.endsWith("\"")) { callerIdName = callerIdName.substring(1, callerIdName.length() - 1); } if (callerIdName.length() == 0) { return null; } else { return callerIdName; } } } --- NEW FILE: AGIRequestBuilder.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.util.Collection; /** * Parses the environment printed by asterisk's <code>setup_env</code> function to an AGIRequest. * * @author srt * @version $Id: AGIRequestBuilder.java,v 1.1 2005/03/05 22:46:59 srt Exp $ */ public interface AGIRequestBuilder { /** * Parses the environment printed by asterisk's <code>setup_env</code> function to an * AGIRequest. * * @param lines the environment printed by asterisk's <code>setup_env</code> function. * @return an AGIRequest setup according to the environment passed in. */ AGIRequest buildAGIRequest(Collection lines); } --- NEW FILE: AGIRequestImpl.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.Serializable; import org.apache.commons.lang.builder.EqualsBuilder; import org.apache.commons.lang.builder.HashCodeBuilder; import org.apache.commons.lang.builder.ToStringBuilder; import org.apache.commons.lang.builder.ToStringStyle; /** * Default implementation of the AGIRequest interface. * * @author srt * @version $Id: AGIRequestImpl.java,v 1.1 2005/03/05 22:46:59 srt Exp $ */ public class AGIRequestImpl implements Serializable, AGIRequest { /** * Serial version identifier. */ private static final long serialVersionUID = 3257001047145789496L; /** * The name of the script to execute. */ private String script; /** * The full URL of the request in the form agi://host[:port][/script] */ private String requestURL; /** * The name of the channel. */ private String channel; /** * The unique id of the channel. */ private String uniqueId; /** * The type of the channel, for example "SIP". */ private String type; /** * The language, for example "en". */ private String language; /** * The Caller*ID, for example "1234". */ private String callerId; /** * The Caller*ID Name, for example "John Doe". */ private String callerIdName; private String dnid; private String rdnis; /** * The context in the dial plan from which the AGI script was called. */ private String context; /** * The extension in the dial plan from which the AGI script was called. */ private String extension; /** * The priority in the dial plan from which the AGI script was called. */ private Integer priority; /** * Boolean.TRUE if this agi is passed audio (EAGI - Enhanced AGI).<br> * Enhanced AGI is currently not supported on FastAGI. */ private Boolean enhanced; /** * The account code set for the call. */ private String accountCode; /** * Creates a new AGIRequestImpl. */ public AGIRequestImpl() { } /** * Returns the name of the script to execute. * * @return the name of the script to execute. */ public String getScript() { return script; } /** * Sets the name of the script to execute. * * @param script the name of the script to execute. */ public void setScript(String script) { this.script = script; } /** * Returns the full URL of the request in the form agi://host[:port][/script]. * * @return the full URL of the request in the form agi://host[:port][/script]. */ public String getRequestURL() { return requestURL; } /** * Sets the full URL of the request in the form agi://host[:port][/script]. * * @param requestURL the full URL of the request in the form agi://host[:port][/script]. */ public void setRequestURL(String requestURL) { this.requestURL = requestURL; } /** * Returns the name of the channel. * * @return the name of the channel. */ public String getChannel() { return channel; } /** * Sets the name of the channel. * * @param channel the name of the channel. */ public void setChannel(String channel) { this.channel = channel; } /** * Returns the unqiue id of the channel. * * @return the unqiue id of the channel. */ public String getUniqueId() { return uniqueId; } /** * Sets the unqiue id of the channel. * * @param uniqueId the unqiue id of the channel. */ public void setUniqueId(String uniqueId) { this.uniqueId = uniqueId; } /** * Returns the type of the channel, for example "SIP". * * @return the type of the channel, for example "SIP". */ public String getType() { return type; } /** * Sets the type of the channel, for example "SIP". * * @param type the type of the channel, for example "SIP". */ public void setType(String type) { this.type = type; } /** * Returns the language, for example "en". * * @return the language, for example "en". */ public String getLanguage() { return language; } /** * Sets the language, for example "en". * * @param language the language, for example "en". */ public void setLanguage(String language) { this.language = language; } /** * Returns the Caller*ID, for example "1234". * * @return the Caller*ID, for example "1234". */ public String getCallerId() { return callerId; } /** * Sets the Caller*ID, for example "1234". * * @param callerId the Caller*ID, for example "1234". */ public void setCallerId(String callerId) { this.callerId = callerId; } /** * Returns the the Caller*ID Name, for example "John Doe". * * @return the the Caller*ID Name, for example "John Doe". */ public String getCallerIdName() { return callerIdName; } /** * Sets the the Caller*ID Name, for example "John Doe". * * @param callerIdName the the Caller*ID Name, for example "John Doe". */ public void setCallerIdName(String callerIdName) { this.callerIdName = callerIdName; } public String getDnid() { return dnid; } public void setDnid(String dnid) { this.dnid = dnid; } public String getRdnis() { return rdnis; } public void setRdnis(String rdnis) { this.rdnis = rdnis; } /** * Returns the context in the dial plan from which the AGI script was called. * * @return the context in the dial plan from which the AGI script was called. */ public String getContext() { return context; } /** * Sets the context in the dial plan from which the AGI script was called. * * @param context the context in the dial plan from which the AGI script was called. */ public void setContext(String context) { this.context = context; } /** * Returns the extension in the dial plan from which the AGI script was called. * * @return the extension in the dial plan from which the AGI script was called. */ public String getExtension() { return extension; } /** * Sets the extension in the dial plan from which the AGI script was called. * * @param extension the extension in the dial plan from which the AGI script was called. */ public void setExtension(String extension) { this.extension = extension; } /** * Returns the priority in the dial plan from which the AGI script was called. * * @return the priority in the dial plan from which the AGI script was called. */ public Integer getPriority() { return priority; } /** * Sets the priority in the dial plan from which the AGI script was called. * * @param priority the priority in the dial plan from which the AGI script was called. */ public void setPriority(Integer priority) { this.priority = priority; } /** * Returns wheather this agi is passed audio (EAGI - Enhanced AGI).<br> * Enhanced AGI is currently not supported on FastAGI. * * @return Boolean.TRUE if this agi is passed audio, Boolean.FALSE otherwise. */ public Boolean getEnhanced() { return enhanced; } /** * Sets wheather this agi is passed audio. * * @param enhanced Boolean.TRUE if this agi is passed audio, Boolean.FALSE otherwise. */ public void setEnhanced(Boolean enhanced) { this.enhanced = enhanced; } /** * Returns the account code set for the call. * * @return the account code set for the call. */ public String getAccountCode() { return accountCode; } /** * Sets the account code set for the call. * * @param accountCode the account code set for the call. */ public void setAccountCode(String accountCode) { this.accountCode = accountCode; } public String toString() { return ToStringBuilder.reflectionToString(this, ToStringStyle.MULTI_LINE_STYLE); } public boolean equals(Object o) { return EqualsBuilder.reflectionEquals(this, o); } public int hashCode() { return HashCodeBuilder.reflectionHashCode(this); } } --- NEW FILE: AGIRequest.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; /** * * @author srt * @version $Id: AGIRequest.java,v 1.1 2005/03/05 22:46:59 srt Exp $ */ public interface AGIRequest { /** * Returns the name of the script to execute. * * @return the name of the script to execute. */ String getScript(); /** * Returns the full URL of the requestURL in the form agi://host[:port][/script]. * * @return the full URL of the requestURL in the form agi://host[:port][/script]. */ String getRequestURL(); /** * Returns the name of the channel. * * @return the name of the channel. */ String getChannel(); /** * Returns the unqiue id of the channel. * * @return the unqiue id of the channel. */ String getUniqueId(); /** * Returns the type of the channel, for example "SIP". * * @return the type of the channel, for example "SIP". */ String getType(); /** * Returns the language, for example "en". * * @return the language, for example "en". */ String getLanguage(); /** * Returns the Caller*ID, for example "1234". * * @return the Caller*ID, for example "1234". */ String getCallerId(); /** * Returns the the Caller*ID Name, for example "John Doe". * * @return the the Caller*ID Name, for example "John Doe". */ String getCallerIdName(); String getDnid(); String getRdnis(); /** * Returns the context in the dial plan from which the AGI script was called. * * @return the context in the dial plan from which the AGI script was called. */ String getContext(); /** * Returns the extension in the dial plan from which the AGI script was called. * * @return the extension in the dial plan from which the AGI script was called. */ String getExtension(); /** * Returns the priority in the dial plan from which the AGI script was called. * * @return the priority in the dial plan from which the AGI script was called. */ Integer getPriority(); /** * Returns wheather this agi is passed audio (EAGI - Enhanced AGI).<br> * Enhanced AGI is currently not supported on FastAGI. * * @return Boolean.TRUE if this agi is passed audio, Boolean.FALSE otherwise. */ Boolean getEnhanced(); /** * Returns the account code set for the call. * * @return the account code set for the call. */ String getAccountCode(); } |
From: Stefan R. <sr...@us...> - 2005-03-05 22:47:11
|
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24114/src/test/net/sf/asterisk/fastagi/command Added Files: AGICommandTest.java Log Message: Added initial stuff for fastagi support --- NEW FILE: AGICommandTest.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.command; import junit.framework.TestCase; public class AGICommandTest extends TestCase { private MyCommand myCommand; public void testEscapeAndQuote() { myCommand = new MyCommand("just a string"); assertEquals("MY \"just a string\"", myCommand.buildCommand()); } public void testEscapeAndQuoteWithNullString() { myCommand = new MyCommand(null); assertEquals("MY \"\"", myCommand.buildCommand()); } public void testEscapeAndQuoteWithEmptyString() { myCommand = new MyCommand(""); assertEquals("MY \"\"", myCommand.buildCommand()); } public void testEscapeAndQuoteWithStringContainingQuotes() { myCommand = new MyCommand("\"John Doe\" is calling"); assertEquals("MY \"\\\"John Doe\\\" is calling\"", myCommand.buildCommand()); } public void testEscapeAndQuoteWithStringContainingNewline() { myCommand = new MyCommand("Caller is:\nJohn Doe"); assertEquals("MY \"Caller is:John Doe\"", myCommand.buildCommand()); } public class MyCommand extends AGICommand { private static final long serialVersionUID = 3976731484641833012L; private String s; public MyCommand(String s) { this.s = s; } public String buildCommand() { return "MY " + escapeAndQuote(s); } } } |