asterisk-java-cvs Mailing List for Asterisk-Java Library (Page 86)
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-04-06 23:06:10
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29616/src/java/net/sf/asterisk/manager/impl Added Files: package.html Log Message: Added package level documentation. --- NEW FILE: package.html --- <html> <head> <!-- /* * 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. * */ --> </head> <body> <p>Provides private implementations for interfaces defined in the net.sf.asterisk.manager package.</p> </body> </html> |
From: Stefan R. <sr...@us...> - 2005-04-06 23:06:10
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/event In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29616/src/java/net/sf/asterisk/manager/event Added Files: package.html Log Message: Added package level documentation. --- NEW FILE: package.html --- <html> <head> <!-- /* * 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. * */ --> </head> <body> <p>Provides classes that represent the standard events that can be received from an Asterisk server via the Manager API.</p> </body> </html> |
From: Stefan R. <sr...@us...> - 2005-04-06 23:06:09
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/io In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29616/src/java/net/sf/asterisk/io Added Files: package.html Log Message: Added package level documentation. --- NEW FILE: package.html --- <html> <head> <!-- /* * 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. * */ --> </head> <body> <p>Provides a facade to java.io.</p> </body> </html> |
From: Stefan R. <sr...@us...> - 2005-04-06 23:06:09
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29616/src/java/net/sf/asterisk/fastagi/reply Added Files: package.html Log Message: Added package level documentation. --- NEW FILE: package.html --- <html> <head> <!-- /* * 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. * */ --> </head> <body> <p>Provides a class that represents the reply that is received from an Asterisk server in response to a command sent via the FastAGI.</p> </body> </html> |
From: Stefan R. <sr...@us...> - 2005-04-06 23:06:09
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29616/src/java/net/sf/asterisk/fastagi Modified Files: AGIRequest.java Added Files: package.html Log Message: Added package level documentation. --- NEW FILE: package.html --- <html> <head> <!-- /* * 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. * */ --> </head> <body> <p>Provides an implementaion of Asterisk's FastAGI.</p> </body> </html> Index: AGIRequest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIRequest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- AGIRequest.java 6 Apr 2005 22:29:09 -0000 1.3 +++ AGIRequest.java 6 Apr 2005 23:06:00 -0000 1.4 @@ -152,7 +152,7 @@ public interface AGIRequest * <code>null</code> if the parameter does not exist. You should only use * this method when you are sure the parameter has only one value.<br> * If the parameter might have more than one value, use - * {@see #getParameterValues(String)}.<br> + * {@link #getParameterValues(String)}.<br> * If you use this method with a multivalued parameter, the value returned * is equal to the first value in the array returned by * <code>getParameterValues</code>. |
From: Stefan R. <sr...@us...> - 2005-04-06 23:06:08
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/response In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29616/src/java/net/sf/asterisk/manager/response Added Files: package.html Log Message: Added package level documentation. --- NEW FILE: package.html --- <html> <head> <!-- /* * 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. * */ --> </head> <body> <p>Provides classes that represent the responses that are received from an Asterisk server in response to an action send via the Manager API.</p> </body> </html> |
From: Stefan R. <sr...@us...> - 2005-04-06 23:06:08
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29616/src/java/net/sf/asterisk/fastagi/command Added Files: package.html Log Message: Added package level documentation. --- NEW FILE: package.html --- <html> <head> <!-- /* * 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. * */ --> </head> <body> <p>Provides classes that represent the standard command that can be sent to an Asterisk server via the FastAGI.</p> </body> </html> |
From: Stefan R. <sr...@us...> - 2005-04-06 22:29:17
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6973/src/java/net/sf/asterisk/fastagi Modified Files: AGIRequest.java Log Message: Added javadoc Index: AGIRequest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIRequest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- AGIRequest.java 6 Apr 2005 18:59:00 -0000 1.2 +++ AGIRequest.java 6 Apr 2005 22:29:09 -0000 1.3 @@ -19,13 +19,19 @@ package net.sf.asterisk.fastagi; import java.util.Map; /** + * Defines an object to provide client request information to an AGIScript.<br> + * This includes information about the channel the script is invoked on and + * parameters passed from the dialplan. + * * @author srt * @version $Id$ */ public interface AGIRequest { /** - * Returns the name of the script to execute. + * Returns the name of the script to execute including its full path.<br> + * This corresponds to the request url with protocol, host, port and + * parameters stripped off. * * @return the name of the script to execute. */ @@ -33,10 +39,10 @@ public interface AGIRequest /** * Returns the full URL of the requestURL in the form - * agi://host[:port][/script]. + * agi://host[:port][/script][?param1=value1¶m2=value2]. * * @return the full URL of the requestURL in the form - * agi://host[:port][/script]. + * agi://host[:port][/script][?param1=value1¶m2=value2]. */ String getRequestURL(); @@ -82,8 +88,20 @@ public interface AGIRequest */ String getCallerIdName(); + /** + * Returns the number, that has been dialed by the user. + * + * @return the dialed number. + */ String getDnid(); + /** + * If this call has been forwared, the number of the person doing the + * redirect is returned (Redirected dialed number identification service).<br> + * This is usally only only available on PRI. + * + * @return the number of the person doing the redirect. + */ String getRdnis(); /** |
From: Stefan R. <sr...@us...> - 2005-04-06 18:59:10
|
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31695/src/test/net/sf/asterisk/fastagi/impl Modified Files: RequestBuilderImplTest.java Log Message: Added parameters to AGIRequest Index: RequestBuilderImplTest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/fastagi/impl/RequestBuilderImplTest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- RequestBuilderImplTest.java 11 Mar 2005 15:20:39 -0000 1.1 +++ RequestBuilderImplTest.java 6 Apr 2005 18:59:00 -0000 1.2 @@ -193,4 +193,101 @@ public class RequestBuilderImplTest exte assertEquals("incorrect channel", "SIP/1234-a892", request.getChannel()); } + + public void testBuildRequestWithoutParameters() + { + Collection lines; + AGIRequest request; + + lines = new ArrayList(); + + lines.add("agi_network_script: myscript.agi"); + lines.add("agi_request: agi://host/myscript.agi"); + + request = requestBuilder.buildRequest(lines); + + assertEquals("incorrect script", "myscript.agi", request.getScript()); + assertEquals("incorrect requestURL", "agi://host/myscript.agi", request.getRequestURL()); + assertEquals("incorrect value for unset parameter 'param1'", null, request.getParameter("param1")); + assertEquals("incorrect values for unset parameter 'param1'", null, request.getParameterValues("param1")); + assertNotNull("getParameterMap() must not return null", request.getParameterMap()); + assertEquals("incorrect size of getParameterMap()", 0, request.getParameterMap().size()); + } + + public void testBuildRequestWithSingleValueParameters() + { + Collection lines; + AGIRequest request; + + lines = new ArrayList(); + + lines.add("agi_network_script: myscript.agi?param1=value1¶m2=value2"); + lines.add("agi_request: agi://host/myscript.agi?param1=value1¶m2=value2"); + + request = requestBuilder.buildRequest(lines); + + assertEquals("incorrect script", "myscript.agi", request.getScript()); + assertEquals("incorrect requestURL", "agi://host/myscript.agi?param1=value1¶m2=value2", request.getRequestURL()); + assertEquals("incorrect value for parameter 'param1'", "value1", request.getParameter("param1")); + assertEquals("incorrect value for parameter 'param2'", "value2", request.getParameter("param2")); + assertEquals("incorrect value for unset parameter 'param3'", null, request.getParameter("param3")); + assertEquals("incorrect size of getParameterMap()", 2, request.getParameterMap().size()); + assertEquals("incorrect value for parameter 'param1' when obtained from map", "value1", ((String[]) request.getParameterMap().get("param1"))[0]); + } + + public void testBuildRequestWithMultiValueParameter() + { + Collection lines; + AGIRequest request; + + lines = new ArrayList(); + + lines.add("agi_network_script: myscript.agi?param1=value1¶m1=value2"); + lines.add("agi_request: agi://host/myscript.agi?param1=value1¶m1=value2"); + + request = requestBuilder.buildRequest(lines); + + assertEquals("incorrect script", "myscript.agi", request.getScript()); + assertEquals("incorrect requestURL", + "agi://host/myscript.agi?param1=value1¶m1=value2", request.getRequestURL()); + assertEquals("incorrect number of values for parameter 'param1'", 2, request.getParameterValues("param1").length); + assertEquals("incorrect value[0] for parameter 'param1'", "value1", request.getParameterValues("param1")[0]); + assertEquals("incorrect value[1] for parameter 'param1'", "value2", request.getParameterValues("param1")[1]); + } + + public void testBuildRequestWithEmptyValueParameter() + { + Collection lines; + AGIRequest request; + + lines = new ArrayList(); + + lines.add("agi_network_script: myscript.agi?param1"); + lines.add("agi_request: agi://host/myscript.agi?param1"); + + request = requestBuilder.buildRequest(lines); + + assertEquals("incorrect script", "myscript.agi", request.getScript()); + assertEquals("incorrect requestURL", "agi://host/myscript.agi?param1", request.getRequestURL()); + assertEquals("incorrect value for parameter 'param1'", "", request.getParameter("param1")); + assertEquals("incorrect number of values for parameter 'param1'", 1, request.getParameterValues("param1").length); + assertEquals("incorrect value[0] for parameter 'param1'", "", request.getParameterValues("param1")[0]); + } + + public void testBuildRequestWithUrlEncodedParameter() + { + Collection lines; + AGIRequest request; + + lines = new ArrayList(); + + lines.add("agi_network_script: myscript.agi?param1=my%20value"); + lines.add("agi_request: agi://host/myscript.agi?param1=my%20value"); + + request = requestBuilder.buildRequest(lines); + + assertEquals("incorrect script", "myscript.agi", request.getScript()); + assertEquals("incorrect requestURL", "agi://host/myscript.agi?param1=my%20value", request.getRequestURL()); + assertEquals("incorrect value for parameter 'param1'", "my value", request.getParameter("param1")); + } } |
From: Stefan R. <sr...@us...> - 2005-04-06 18:59:09
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31695/src/java/net/sf/asterisk/fastagi Modified Files: AGIRequest.java Log Message: Added parameters to AGIRequest Index: AGIRequest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIRequest.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- AGIRequest.java 5 Mar 2005 22:46:59 -0000 1.1 +++ AGIRequest.java 6 Apr 2005 18:59:00 -0000 1.2 @@ -16,8 +16,9 @@ */ package net.sf.asterisk.fastagi; +import java.util.Map; + /** - * * @author srt * @version $Id$ */ @@ -31,9 +32,11 @@ public interface AGIRequest String getScript(); /** - * Returns the full URL of the requestURL in the form agi://host[:port][/script]. + * 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]. + * @return the full URL of the requestURL in the form + * agi://host[:port][/script]. */ String getRequestURL(); @@ -84,23 +87,29 @@ public interface AGIRequest String getRdnis(); /** - * 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. */ String getContext(); /** - * 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. */ String getExtension(); /** - * 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. */ Integer getPriority(); @@ -108,7 +117,8 @@ public interface AGIRequest * 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. */ Boolean getEnhanced(); @@ -118,4 +128,41 @@ public interface AGIRequest * @return the account code set for the call. */ String getAccountCode(); + + /** + * Returns the value of a request parameter as a String, or + * <code>null</code> if the parameter does not exist. You should only use + * this method when you are sure the parameter has only one value.<br> + * If the parameter might have more than one value, use + * {@see #getParameterValues(String)}.<br> + * If you use this method with a multivalued parameter, the value returned + * is equal to the first value in the array returned by + * <code>getParameterValues</code>. + * + * @param name a String containing the name of the parameter whose value is + * requested. + * @return a String representing the single value of the parameter. + * @see #getParameterValues(String) + */ + String getParameter(String name); + + /** + * Returns an array of String objects containing all of the values the given + * request parameter has, or + * <code>null</coder> if the parameter does not exist.<br> + * If the parameter has a single value, the array has a length of 1. + * + * @param name a String containing the name of the parameter whose value is requested. + * @return an array of String objects containing the parameter's values. + */ + String[] getParameterValues(String name); + + /** + * Returns a java.util.Map of the parameters of this request. + * + * @return a java.util.Map containing parameter names as keys and parameter + * values as map values. The keys in the parameter map are of type + * String. The values in the parameter map are of type String array. + */ + Map getParameterMap(); } |
From: Stefan R. <sr...@us...> - 2005-04-06 18:59:08
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31695/src/java/net/sf/asterisk/fastagi/impl Modified Files: RequestBuilderImpl.java AGIRequestImpl.java Log Message: Added parameters to AGIRequest Index: RequestBuilderImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/impl/RequestBuilderImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- RequestBuilderImpl.java 11 Mar 2005 15:20:50 -0000 1.1 +++ RequestBuilderImpl.java 6 Apr 2005 18:58:59 -0000 1.2 @@ -16,10 +16,16 @@ */ package net.sf.asterisk.fastagi.impl; +import java.net.URLDecoder; +import java.util.ArrayList; import java.util.Collection; import java.util.HashMap; import java.util.Iterator; +import java.util.List; import java.util.Map; +import java.util.StringTokenizer; +import java.util.regex.Matcher; +import java.util.regex.Pattern; import net.sf.asterisk.fastagi.AGIRequest; import net.sf.asterisk.fastagi.RequestBuilder; @@ -32,6 +38,11 @@ import net.sf.asterisk.fastagi.RequestBu */ public class RequestBuilderImpl implements RequestBuilder { + private static final Pattern SCRIPT_PATTERN = Pattern + .compile("^([^\\?]*)\\?(.*)$"); + private static final Pattern PARAMETER_PATTERN = Pattern + .compile("^(.*)=(.*)$"); + /** * Creates a new AGIRequestBuilderImpl. */ @@ -44,6 +55,8 @@ public class RequestBuilderImpl implemen { AGIRequestImpl request; Map map; + Matcher scriptMatcher; + String script; if (lines == null) { @@ -54,7 +67,24 @@ public class RequestBuilderImpl implemen map = buildMap(lines); - request.setScript((String) map.get("network_script")); + script = (String) map.get("network_script"); + if (script != null) + { + scriptMatcher = SCRIPT_PATTERN.matcher(script); + if (scriptMatcher.matches()) + { + String parameters; + Map parameterMap; + + script = scriptMatcher.group(1); + parameters = scriptMatcher.group(2); + parameterMap = parseParameters(parameters); + request.setParameterMap(parameterMap); + } + } + + request.setScript(script); + request.setRequestURL((String) map.get("request")); request.setChannel((String) map.get("channel")); request.setUniqueId((String) map.get("uniqueid")); @@ -191,4 +221,65 @@ public class RequestBuilderImpl implemen return callerIdName; } } + + private Map parseParameters(String s) + { + Map parameterMap; + Map result; + Iterator parameterIterator; + StringTokenizer st; + + parameterMap = new HashMap(); + st = new StringTokenizer(s, "&"); + while (st.hasMoreTokens()) + { + String parameter; + Matcher parameterMatcher; + String name; + String value; + List values; + + parameter = st.nextToken(); + parameterMatcher = PARAMETER_PATTERN.matcher(parameter); + if (parameterMatcher.matches()) + { + name = URLDecoder.decode(parameterMatcher.group(1)); + value = URLDecoder.decode(parameterMatcher.group(2)); + } + else + { + name = URLDecoder.decode(parameter); + value = ""; + } + + if (parameterMap.get(name) == null) + { + values = new ArrayList(); + values.add(value); + parameterMap.put(name, values); + } + else + { + values = (List) parameterMap.get(name); + values.add(value); + } + } + + result = new HashMap(); + parameterIterator = parameterMap.keySet().iterator(); + while (parameterIterator.hasNext()) + { + String name; + List values; + String[] valueArray; + + name = (String) parameterIterator.next(); + values = (List) parameterMap.get(name); + + valueArray = new String[values.size()]; + result.put(name, values.toArray(valueArray)); + } + + return result; + } } Index: AGIRequestImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/impl/AGIRequestImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- AGIRequestImpl.java 13 Mar 2005 11:26:50 -0000 1.2 +++ AGIRequestImpl.java 6 Apr 2005 18:58:59 -0000 1.3 @@ -17,6 +17,8 @@ package net.sf.asterisk.fastagi.impl; import java.io.Serializable; +import java.util.HashMap; +import java.util.Map; import net.sf.asterisk.fastagi.AGIRequest; @@ -104,6 +106,12 @@ public class AGIRequestImpl implements S private String accountCode; /** + * A map assigning the values of a parameter (an array of Strings) to the + * name of the parameter. + */ + private Map parameterMap; + + /** * Creates a new AGIRequestImpl. */ public AGIRequestImpl() @@ -406,10 +414,49 @@ public class AGIRequestImpl implements S this.accountCode = accountCode; } + public String getParameter(String name) + { + String[] values; + + values = getParameterValues(name); + + if (values == null || values.length == 0) + { + return null; + } + + return values[0]; + } + + public String[] getParameterValues(String name) + { + if (parameterMap == null) + { + return null; + } + + return (String[]) parameterMap.get(name); + } + + public Map getParameterMap() + { + if (parameterMap == null) + { + parameterMap = new HashMap(); + } + + return parameterMap; + } + + public void setParameterMap(Map parameterMap) + { + this.parameterMap = parameterMap; + } + public String toString() { StringBuffer sb; - + sb = new StringBuffer(getClass().getName() + ": "); sb.append("script='" + getScript() + "'; "); sb.append("requestURL='" + getRequestURL() + "'; "); |
From: Stefan R. <sr...@us...> - 2005-04-06 16:51:56
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv32465/src/java/net/sf/asterisk/fastagi Modified Files: AbstractAGIScript.java Log Message: Fixed bug with sayXXX methods not passing escapeDigits to the command. Index: AbstractAGIScript.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AbstractAGIScript.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -p -r1.9 -r1.10 --- AbstractAGIScript.java 6 Apr 2005 16:47:27 -0000 1.9 +++ AbstractAGIScript.java 6 Apr 2005 16:51:47 -0000 1.10 @@ -265,7 +265,7 @@ public abstract class AbstractAGIScript { AGIReply reply; - reply = channel.sendCommand(new SayDigitsCommand(digits)); + reply = channel.sendCommand(new SayDigitsCommand(digits, escapeDigits)); return reply.getResultCodeAsChar(); } @@ -294,7 +294,7 @@ public abstract class AbstractAGIScript { AGIReply reply; - reply = channel.sendCommand(new SayNumberCommand(number)); + reply = channel.sendCommand(new SayNumberCommand(number, escapeDigits)); return reply.getResultCodeAsChar(); } @@ -323,7 +323,7 @@ public abstract class AbstractAGIScript { AGIReply reply; - reply = channel.sendCommand(new SayPhoneticCommand(text)); + reply = channel.sendCommand(new SayPhoneticCommand(text, escapeDigits)); return reply.getResultCodeAsChar(); } @@ -352,12 +352,12 @@ public abstract class AbstractAGIScript { AGIReply reply; - reply = channel.sendCommand(new SayAlphaCommand(text)); + reply = channel.sendCommand(new SayAlphaCommand(text, escapeDigits)); return reply.getResultCodeAsChar(); } /** - * Says the given character string with phonetics. + * Says the given time. * * @param time the time to say in seconds since 00:00:00 on January 1, 1970. */ @@ -368,7 +368,7 @@ public abstract class AbstractAGIScript } /** - * Says the given character string with phonetics, returning early if any of + * Says the given time, returning early if any of * the given DTMF number are received on the channel. * * @param time the time to say in seconds since 00:00:00 on January 1, 1970. @@ -381,7 +381,7 @@ public abstract class AbstractAGIScript { AGIReply reply; - reply = channel.sendCommand(new SayTimeCommand(time)); + reply = channel.sendCommand(new SayTimeCommand(time, escapeDigits)); return reply.getResultCodeAsChar(); } |
From: Stefan R. <sr...@us...> - 2005-04-06 16:48:05
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31170/src/java/net/sf/asterisk/fastagi Modified Files: AbstractAGIScript.java Log Message: Added SayAlphaCommand which is available in latest CVS HEAD Index: AbstractAGIScript.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AbstractAGIScript.java,v retrieving revision 1.8 retrieving revision 1.9 diff -u -d -p -r1.8 -r1.9 --- AbstractAGIScript.java 12 Mar 2005 09:56:50 -0000 1.8 +++ AbstractAGIScript.java 6 Apr 2005 16:47:27 -0000 1.9 @@ -21,6 +21,7 @@ import net.sf.asterisk.fastagi.command.C import net.sf.asterisk.fastagi.command.ExecCommand; import net.sf.asterisk.fastagi.command.GetVariableCommand; import net.sf.asterisk.fastagi.command.HangupCommand; +import net.sf.asterisk.fastagi.command.SayAlphaCommand; import net.sf.asterisk.fastagi.command.SayDigitsCommand; import net.sf.asterisk.fastagi.command.SayNumberCommand; import net.sf.asterisk.fastagi.command.SayPhoneticCommand; @@ -327,6 +328,35 @@ public abstract class AbstractAGIScript } /** + * Says the given character string. + * + * @param text the text to say. + */ + protected void sayAlpha(AGIChannel channel, String text) + throws AGIException + { + channel.sendCommand(new SayAlphaCommand(text)); + } + + /** + * Says the given character string, returning early if any of + * the given DTMF number are received on the channel. + * + * @param text the text to say. + * @param escapeDigits a String containing the DTMF digits that allow the + * user to escape. + * @return the DTMF digit pressed or 0x0 if none was pressed. + */ + protected char sayAlpha(AGIChannel channel, String text, + String escapeDigits) throws AGIException + { + AGIReply reply; + + reply = channel.sendCommand(new SayAlphaCommand(text)); + return reply.getResultCodeAsChar(); + } + + /** * Says the given character string with phonetics. * * @param time the time to say in seconds since 00:00:00 on January 1, 1970. |
From: Stefan R. <sr...@us...> - 2005-04-06 16:48:04
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/command In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31170/src/java/net/sf/asterisk/fastagi/command Added Files: SayAlphaCommand.java Log Message: Added SayAlphaCommand which is available in latest CVS HEAD --- NEW FILE: SayAlphaCommand.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, 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: SayAlphaCommand.java,v 1.1 2005/04/06 16:47:27 srt Exp $ */ public class SayAlphaCommand 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 SayAlphaCommand. * * @param text the text to say. */ public SayAlphaCommand(String text) { this.text = text; this.escapeDigits = null; } /** * Creates a new SayAlphaCommand. * * @param text the text to say. * @param escapeDigits contains the digits that allow the user to interrupt * this command. */ public SayAlphaCommand(String text, String escapeDigits) { this.text = text; this.escapeDigits = escapeDigits; } /** * 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 ALPHA " + escapeAndQuote(text) + " " + escapeAndQuote(escapeDigits); } } |
From: Stefan R. <sr...@us...> - 2005-04-06 16:38:54
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28233/src/java/net/sf/asterisk/fastagi Modified Files: DefaultAGIServer.java Log Message: Added information about default values to javadoc comments for setters. Index: DefaultAGIServer.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/DefaultAGIServer.java,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -p -r1.6 -r1.7 --- DefaultAGIServer.java 31 Mar 2005 22:29:52 -0000 1.6 +++ DefaultAGIServer.java 6 Apr 2005 16:38:45 -0000 1.7 @@ -96,7 +96,8 @@ public class DefaultAGIServer implements /** * Sets the number of worker threads in the thread pool.<br> * This equals the maximum number of concurrent requests this AGIServer can - * serve. + * serve.<br> + * The default pool size is 10. * * @param poolSize the size of the worker thread pool. */ @@ -106,7 +107,8 @@ public class DefaultAGIServer implements } /** - * Sets the TCP port to listen on for new connections. + * Sets the TCP port to listen on for new connections.<br> + * The default bind port is 4573. * * @param bindPort the port to bind to. */ @@ -117,9 +119,11 @@ public class DefaultAGIServer implements /** * Sets the strategy to use for mapping AGIRequests to AGIScripts that serve - * them. + * them.<br> + * The default mapping strategy is a ResourceBundleMappingStrategy. * * @param mappingStrategy the mapping strategy to use. + * @see ResourceBundleMappingStrategy */ public void setMappingStrategy(MappingStrategy mappingStrategy) { |
From: Stefan R. <sr...@us...> - 2005-03-31 22:30:19
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29716/src/java/net/sf/asterisk/manager Modified Files: DefaultAsteriskManager.java MultiAsterisksManager.java DefaultManagerConnection.java Log Message: Removed the hard runtime dependency on commons-logging. If commons-logging is available on the classpath it will be used, otherwise logging is disabled. Index: DefaultAsteriskManager.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/DefaultAsteriskManager.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- DefaultAsteriskManager.java 5 Mar 2005 04:12:39 -0000 1.3 +++ DefaultAsteriskManager.java 31 Mar 2005 22:29:50 -0000 1.4 @@ -45,8 +45,8 @@ import net.sf.asterisk.manager.event.Sta import net.sf.asterisk.manager.event.UnlinkEvent; import net.sf.asterisk.manager.response.ManagerResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; /** * @author srt Index: MultiAsterisksManager.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/MultiAsterisksManager.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- MultiAsterisksManager.java 23 Feb 2005 22:50:57 -0000 1.2 +++ MultiAsterisksManager.java 31 Mar 2005 22:29:50 -0000 1.3 @@ -9,8 +9,8 @@ import java.util.*; import net.sf.asterisk.manager.action.*; import net.sf.asterisk.manager.event.*; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; /** * @author PY Index: DefaultManagerConnection.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/DefaultManagerConnection.java,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -p -r1.12 -r1.13 --- DefaultManagerConnection.java 11 Mar 2005 22:29:54 -0000 1.12 +++ DefaultManagerConnection.java 31 Mar 2005 22:29:50 -0000 1.13 @@ -41,8 +41,8 @@ import net.sf.asterisk.manager.response. import net.sf.asterisk.manager.response.ManagerError; import net.sf.asterisk.manager.response.ManagerResponse; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; /** * Default implemention of the ManagerConnection interface. |
From: Stefan R. <sr...@us...> - 2005-03-31 22:30:18
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29716/src/java/net/sf/asterisk/manager/impl Modified Files: EventBuilderImpl.java ManagerReaderImpl.java ManagerWriterImpl.java ActionBuilderImpl.java Log Message: Removed the hard runtime dependency on commons-logging. If commons-logging is available on the classpath it will be used, otherwise logging is disabled. Index: EventBuilderImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/impl/EventBuilderImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- EventBuilderImpl.java 15 Mar 2005 18:00:58 -0000 1.2 +++ EventBuilderImpl.java 31 Mar 2005 22:29:52 -0000 1.3 @@ -69,8 +69,8 @@ import net.sf.asterisk.manager.event.Use import net.sf.asterisk.manager.event.ZapShowChannelsCompleteEvent; import net.sf.asterisk.manager.event.ZapShowChannelsEvent; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; /** * Default implementation of the EventBuilder interface. Index: ManagerReaderImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/impl/ManagerReaderImpl.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- ManagerReaderImpl.java 11 Mar 2005 15:31:48 -0000 1.2 +++ ManagerReaderImpl.java 31 Mar 2005 22:29:52 -0000 1.3 @@ -36,8 +36,8 @@ import net.sf.asterisk.manager.response. import net.sf.asterisk.manager.response.ManagerResponse; import net.sf.asterisk.util.DateUtil; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; /** * Default implementation of the ManagerReader interface. Index: ManagerWriterImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/impl/ManagerWriterImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- ManagerWriterImpl.java 11 Mar 2005 15:27:23 -0000 1.1 +++ ManagerWriterImpl.java 31 Mar 2005 22:29:52 -0000 1.2 @@ -23,8 +23,8 @@ import net.sf.asterisk.manager.ActionBui import net.sf.asterisk.manager.ManagerWriter; import net.sf.asterisk.manager.action.ManagerAction; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; /** * Default implementation of ManagerWriter interface. Index: ActionBuilderImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/impl/ActionBuilderImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- ActionBuilderImpl.java 11 Mar 2005 15:27:23 -0000 1.1 +++ ActionBuilderImpl.java 31 Mar 2005 22:29:52 -0000 1.2 @@ -25,8 +25,8 @@ import java.util.Map; import net.sf.asterisk.manager.ActionBuilder; import net.sf.asterisk.manager.action.ManagerAction; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; /** * Default implementation of the ActionBuilder interface. |
From: Stefan R. <sr...@us...> - 2005-03-31 22:30:18
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29716/src/java/net/sf/asterisk/fastagi Modified Files: DefaultAGIServer.java ResourceBundleMappingStrategy.java AGIConnectionHandler.java Log Message: Removed the hard runtime dependency on commons-logging. If commons-logging is available on the classpath it will be used, otherwise logging is disabled. Index: DefaultAGIServer.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/DefaultAGIServer.java,v retrieving revision 1.5 retrieving revision 1.6 diff -u -d -p -r1.5 -r1.6 --- DefaultAGIServer.java 12 Mar 2005 09:55:10 -0000 1.5 +++ DefaultAGIServer.java 31 Mar 2005 22:29:52 -0000 1.6 @@ -20,8 +20,8 @@ import java.io.IOException; import java.util.MissingResourceException; import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; import net.sf.asterisk.io.ServerSocketFacade; import net.sf.asterisk.io.ServerSocketFacadeImpl; Index: ResourceBundleMappingStrategy.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/ResourceBundleMappingStrategy.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- ResourceBundleMappingStrategy.java 10 Mar 2005 21:31:30 -0000 1.1 +++ ResourceBundleMappingStrategy.java 31 Mar 2005 22:29:52 -0000 1.2 @@ -23,8 +23,8 @@ import java.util.Map; import java.util.MissingResourceException; import java.util.ResourceBundle; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; /** * A MappingStrategy that is configured via a resource bundle.<br> Index: AGIConnectionHandler.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/AGIConnectionHandler.java,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -p -r1.9 -r1.10 --- AGIConnectionHandler.java 12 Mar 2005 09:56:17 -0000 1.9 +++ AGIConnectionHandler.java 31 Mar 2005 22:29:52 -0000 1.10 @@ -24,8 +24,8 @@ import net.sf.asterisk.fastagi.impl.AGIR import net.sf.asterisk.fastagi.impl.AGIWriterImpl; import net.sf.asterisk.io.SocketConnectionFacade; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; /** * An AGIConnectionHandler is created and run by the AGIServer whenever a new |
From: Stefan R. <sr...@us...> - 2005-03-31 22:30:16
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29716/src/java/net/sf/asterisk/util Modified Files: ThreadPool.java Added Files: CommonsLoggingLog.java LogFactory.java NullLog.java Log.java Log Message: Removed the hard runtime dependency on commons-logging. If commons-logging is available on the classpath it will be used, otherwise logging is disabled. --- NEW FILE: CommonsLoggingLog.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.util; import org.apache.commons.logging.LogFactory; /** * A Log implementation that acts as a proxy to commons-logging. * * @author srt * @version $Id: CommonsLoggingLog.java,v 1.1 2005/03/31 22:29:52 srt Exp $ */ public class CommonsLoggingLog implements Log { /** * The underlying commons-logging Log object to use. */ private org.apache.commons.logging.Log log; /** * Creates a new CommonsLoggingLog obtained from commons-logging's * LogFactory for the given class. * * @param clazz the class to log for. */ public CommonsLoggingLog(Class clazz) { log = LogFactory.getLog(clazz); } public void debug(Object obj) { log.debug(obj); } public void info(Object obj) { log.info(obj); } public void warn(Object obj) { log.warn(obj); } public void warn(Object obj, Throwable ex) { log.warn(obj, ex); } public void error(Object obj) { log.error(obj); } public void error(Object obj, Throwable ex) { log.error(obj, ex); } } --- NEW FILE: LogFactory.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.util; /** * Facade to hide details of the underlying logging system. * * @author srt * @version $Id: LogFactory.java,v 1.1 2005/03/31 22:29:52 srt Exp $ */ public final class LogFactory { /** * Indicates if commons-logging is available on the classpath or not. If the * check has not yet performed this is <code>null</code>. */ private static Boolean commonsLoggingAvailable = null; /** * Returns an instance of Log suitable for logging from the given class. * * @param clazz the class to create the logger for. * @return the created logger. */ public static Log getLog(Class clazz) { if (commonsLoggingAvailable == null) { try { Class.forName("org.apache.commons.logging.LogFactory"); commonsLoggingAvailable = Boolean.TRUE; } catch (Exception e) { commonsLoggingAvailable = Boolean.FALSE; } } if (commonsLoggingAvailable.booleanValue()) { return new CommonsLoggingLog(clazz); } else { return new NullLog(); } } } --- NEW FILE: NullLog.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.util; /** * A Log implementation that does nothing. * * @author srt * @version $Id: NullLog.java,v 1.1 2005/03/31 22:29:52 srt Exp $ */ public class NullLog implements Log { /** * Creates a new NullLog. */ public NullLog() { } public void debug(Object obj) { } public void info(Object obj) { } public void warn(Object obj) { } public void warn(Object obj, Throwable ex) { } public void error(Object obj) { } public void error(Object obj, Throwable ex) { } } --- NEW FILE: Log.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.util; public interface Log { void debug(Object obj); void info(Object obj); void warn(Object obj); void warn(Object obj, Throwable ex); void error(Object obj); void error(Object obj, Throwable ex); } Index: ThreadPool.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/util/ThreadPool.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- ThreadPool.java 10 Mar 2005 16:01:12 -0000 1.2 +++ ThreadPool.java 31 Mar 2005 22:29:52 -0000 1.3 @@ -19,8 +19,8 @@ package net.sf.asterisk.util; import java.util.LinkedList; import java.util.List; -import org.apache.commons.logging.Log; -import org.apache.commons.logging.LogFactory; +import net.sf.asterisk.util.Log; +import net.sf.asterisk.util.LogFactory; public class ThreadPool { |
From: Stefan R. <sr...@us...> - 2005-03-31 20:39:15
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv1493/src/java/net/sf/asterisk/fastagi/impl Modified Files: ReplyBuilderImpl.java Log Message: Fixed ADDITIONAL_ATTRIBUTES_PATTERN Index: ReplyBuilderImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/impl/ReplyBuilderImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- ReplyBuilderImpl.java 11 Mar 2005 15:20:50 -0000 1.1 +++ ReplyBuilderImpl.java 31 Mar 2005 20:38:53 -0000 1.2 @@ -38,7 +38,7 @@ public class ReplyBuilderImpl implements private static final Pattern PARENTHESIS_PATTERN = Pattern .compile("^200 result=\\S+ \\((.*)\\)"); private static final Pattern ADDITIONAL_ATTRIBUTES_PATTERN = Pattern - .compile("^200 result=\\S+( \\(.*\\) )?(.+)$"); + .compile("^200 result=\\S+ (\\(.*\\) )?(.+)$"); private static final Pattern ADDITIONAL_ATTRIBUTE_PATTERN = Pattern .compile("(\\S+)=(\\S+)"); private static final Pattern SYNOPSIS_PATTERN = Pattern |
From: Stefan R. <sr...@us...> - 2005-03-30 01:39:16
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6967/src/java/net/sf/asterisk/fastagi/reply Modified Files: AGIReply.java Log Message: Fixed javadoc comment for getResult() Index: AGIReply.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi/reply/AGIReply.java,v retrieving revision 1.11 retrieving revision 1.12 diff -u -d -p -r1.11 -r1.12 --- AGIReply.java 13 Mar 2005 11:26:51 -0000 1.11 +++ AGIReply.java 30 Mar 2005 01:39:05 -0000 1.12 @@ -61,7 +61,8 @@ public class AGIReply implements Seriali private static final long serialVersionUID = 3256727294671337012L; /** - * The result. + * The result, that is the part directly following the "result=" + * string. */ private String result; @@ -133,7 +134,8 @@ public class AGIReply implements Seriali } /** - * Returns the result. + * Returns the result, that is the part directly following the "result=" + * string. * * @return the result. */ |
From: Stefan R. <sr...@us...> - 2005-03-16 12:11:27
|
Update of /cvsroot/asterisk-java/asterisk-java/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27002/xdocs Modified Files: index.xml Log Message: Added information about nio to the link to Jast Agi Index: index.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/xdocs/index.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -p -r1.9 -r1.10 --- index.xml 14 Mar 2005 16:29:36 -0000 1.9 +++ index.xml 16 Mar 2005 12:11:14 -0000 1.10 @@ -81,9 +81,10 @@ cvs -z3 -d:pserver:ano...@cv...urcef <p><a href="http://tanesha.net/Wiki/JastAgi.html">Jast Agi</a> is another toolkit for writing Java applications that connect to Asterisk using the FastAGI protocol. The lastest version introduces - a statemachine approach to handle AGI requests. + a statemachine approach to handle AGI requests and uses java.nio to + process all requests in one Thread. Available under Apache License.</p> - <p><a href="http://www.voip-info.org/wiki-JAGIServer">JAGIServer</a> is + <p><a href="http://www.voip-info.org/wiki-JAGIServer">JAGIServer</a> also supports writing Java based AGI Scripts using FastAGI. Available under GNU General Public License.</p> <p><a href="http://sourceforge.net/projects/jasterisk/">JAsterisk</a> |
From: Stefan R. <sr...@us...> - 2005-03-16 10:52:24
|
Update of /cvsroot/asterisk-java/asterisk-java/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv9128/xdocs Modified Files: tutorial.xml Log Message: Fixed title Fixed variable naming in HelloEvents.main() Index: tutorial.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/xdocs/tutorial.xml,v retrieving revision 1.7 retrieving revision 1.8 diff -u -d -p -r1.7 -r1.8 --- tutorial.xml 16 Mar 2005 09:54:05 -0000 1.7 +++ tutorial.xml 16 Mar 2005 10:52:11 -0000 1.8 @@ -20,7 +20,7 @@ <document> <properties> <author email="srt at users.sourceforge.net">Stefan Reuter</author> - <title>Samples</title> + <title>Tutorial</title> </properties> <meta name="keywords" content="Asterisk,asterisk,Java,java,Manager API,FastAGI,AGI,tutorial,example"/> <body> @@ -333,10 +333,10 @@ public class HelloEvents implements Mana public static void main(String[] args) throws Exception { - HelloEvents helloManager; + HelloEvents helloEvents; - helloManager = new HelloEvents(); - helloManager.run(); + helloEvents = new HelloEvents(); + helloEvents.run(); } } ]]></source> |
From: Stefan R. <sr...@us...> - 2005-03-16 09:54:16
|
Update of /cvsroot/asterisk-java/asterisk-java/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv28214/xdocs Modified Files: tutorial.xml Log Message: Added short subscection on how to receive Events via the Manager API Index: tutorial.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/xdocs/tutorial.xml,v retrieving revision 1.6 retrieving revision 1.7 diff -u -d -p -r1.6 -r1.7 --- tutorial.xml 14 Mar 2005 19:42:46 -0000 1.6 +++ tutorial.xml 16 Mar 2005 09:54:05 -0000 1.7 @@ -277,6 +277,73 @@ public class HelloManager povided by the Manager API is available in the <a href="apidocs/index.html">javadocs</a>.</p> </subsection> + <subsection name="Hello Events!"> + <p>To receive events from Asterisk you have to implement the + <a href="apidocs/net/sf/asterisk/manager/ManagerEventHandler.html">ManagerEventHandler</a> + interface and add it to the + <a href="apidocs/net/sf/asterisk/manager/ManagerConnection.html">ManagerConnection</a></p> + <p>The following code shows a simple example of how to do this:</p> +<source><![CDATA[ +import java.io.IOException; + +import net.sf.asterisk.manager.AuthenticationFailedException; +import net.sf.asterisk.manager.ManagerConnection; +import net.sf.asterisk.manager.ManagerConnectionFactory; +import net.sf.asterisk.manager.ManagerEventHandler; +import net.sf.asterisk.manager.TimeoutException; +import net.sf.asterisk.manager.action.StatusAction; +import net.sf.asterisk.manager.event.ManagerEvent; + +public class HelloEvents implements ManagerEventHandler +{ + private ManagerConnection managerConnection; + + public HelloEvents() throws IOException + { + ManagerConnectionFactory factory = new ManagerConnectionFactory(); + + this.managerConnection = factory.getManagerConnection("localhost", + "manager", "pa55w0rd"); + } + + public void run() throws IOException, AuthenticationFailedException, + TimeoutException, InterruptedException + { + // register for events + managerConnection.addEventHandler(this); + + // connect to Asterisk and log in + managerConnection.login(); + + // request channel state + managerConnection.sendAction(new StatusAction()); + + // wait 10 seconds for events to come in + Thread.sleep(10000); + + // and finally log off and disconnect + managerConnection.logoff(); + } + + public void handleEvent(ManagerEvent event) + { + // just print received events + System.out.println(event); + } + + public static void main(String[] args) throws Exception + { + HelloEvents helloManager; + + helloManager = new HelloEvents(); + helloManager.run(); + } +} +]]></source> + <p>A list of the other <a href="apidocs/net/sf/asterisk/manager/event/package-summary.html">Events</a> + povided by the Manager API is available in the + <a href="apidocs/index.html">javadocs</a>.</p> + </subsection> </section> </body> </document> \ No newline at end of file |
From: Stefan R. <sr...@us...> - 2005-03-16 09:50:01
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/event In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv27194/src/java/net/sf/asterisk/manager/event Modified Files: StatusEvent.java Log Message: Added callerIdName property that is contained in Asterisk from CVS HEAD Index: StatusEvent.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/event/StatusEvent.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- StatusEvent.java 23 Feb 2005 22:50:58 -0000 1.2 +++ StatusEvent.java 16 Mar 2005 09:49:49 -0000 1.3 @@ -32,6 +32,7 @@ public class StatusEvent extends Respons private static final long serialVersionUID = -3619197512835308812L; private String channel; private String callerId; + private String callerIdName; private String account; private String state; private String context; @@ -66,7 +67,7 @@ public class StatusEvent extends Respons } /** - * Returns the caller id of this channel. + * Returns the Caller*ID of this channel. */ public String getCallerId() { @@ -74,7 +75,7 @@ public class StatusEvent extends Respons } /** - * Sets the caller id of this channel. + * Sets the Caller*ID of this channel. */ public void setCallerId(String callerId) { @@ -82,6 +83,22 @@ public class StatusEvent extends Respons } /** + * Returns the Caller*ID Name of this channel. + */ + public String getCallerIdName() + { + return callerIdName; + } + + /** + * Sets the Caller*ID Name of this channel. + */ + public void setCallerIdName(String callerIdName) + { + this.callerIdName = callerIdName; + } + + /** * Returns the account code of this channel. */ public String getAccount() |