asterisk-java-cvs Mailing List for Asterisk-Java Library (Page 84)
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-24 15:46:18
|
Update of /cvsroot/asterisk-java/asterisk-java/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4354/xdocs Modified Files: patch.xml Log Message: Fixed line to add to .cvsrc Index: patch.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/xdocs/patch.xml,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- patch.xml 24 Apr 2005 14:34:02 -0000 1.1 +++ patch.xml 24 Apr 2005 15:46:10 -0000 1.2 @@ -44,7 +44,8 @@ made sure it compiles and works as expected, you can create the patch file using the command <code>cvs diff -u > /path/to/patchfile.patch</code>.</p> - <p>It is recommended to include the diff -up line in <code>~/.cvsrc</code>.</p> + <p>It is recommended to include the <code>diff -u</code> line + in <code>~/.cvsrc</code>.</p> <p>If you do not have access to CVS you can generate the patch against the latest release.</p> <p>To generate the patch you will need two copies of the source code: |
From: Stefan R. <sr...@us...> - 2005-04-24 15:45:31
|
Update of /cvsroot/asterisk-java/asterisk-java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv4209 Added Files: ChangeLog README Log Message: Added --- NEW FILE: ChangeLog --- asterisk-java 0.1 * Fixed bug in action id creation * Changed logging to use either log4j or java.util.logging * Fixed ExecCommand --- NEW FILE: README --- README for asterisk-java ======================== The Asterisk-java package consists of a set of Java classes that allow you to easily build Java applications that interact with an Asterisk PBX Server. Asterisk-java supports both interfaces that Asterisk provides for this scenario: The FastAGI protocol and the Manager API. The FastAGI implementation supports all commands currently available from Asterisk. The Manager API implementation supports receiving events from the Asterisk server (e.g. call progess, registered peers, channel state) and sending actions to Asterisk (e.g. originate call, agent login/logoff, start/stop voice recording). A complete list of the available events and actions is available in the javadocs. |
From: Stefan R. <sr...@us...> - 2005-04-24 14:34:10
|
Update of /cvsroot/asterisk-java/asterisk-java/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv586/xdocs Modified Files: navigation.xml Added Files: patch.xml Log Message: Added patch howto --- NEW FILE: patch.xml --- <?xml version="1.0"?> <!-- /* * 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. * */ --> <document> <properties> <author email="srt at users.sourceforge.net">Stefan Reuter</author> <title>How To Create and Submit a Patch</title> </properties> <meta name="keywords" content="Asterisk,asterisk,Java,java,Manager API,FastAGI,AGI"/> <body> <section name="How To Create and Submit a Patch"> <subsection name="Introduction"> <p>A patch is exactly what the word says: a small piece of code used to repair a breach. It is normally a plain text file containing only the differences between the current version of the code and the fixed version.</p> <p>Often patches are also used to submit enhancements.</p> </subsection> <subsection name="Generating a Patch"> <p>The preferred way of creating a patch is to create it against latest CVS. This ensures that the patch works with the latest version of the source code and makes it easier to apply the patch.</p> <p>To generate the patch you need to check out a copy of the source code from CVS. Look a the <a href="cvs-usage.html">CVS Howto</a> for the details.</p> <p>After you have made the changes to the source code and made sure it compiles and works as expected, you can create the patch file using the command <code>cvs diff -u > /path/to/patchfile.patch</code>.</p> <p>It is recommended to include the diff -up line in <code>~/.cvsrc</code>.</p> <p>If you do not have access to CVS you can generate the patch against the latest release.</p> <p>To generate the patch you will need two copies of the source code: one that is unmodified and one containing your changes to the source. Start by downloading the source code of the latest release, extract it and make a copy of the entire source directory. After you have made your changes to one of the source directories and made sure it compiles and works as expected, you can create the patch file using the command <code>diff -ru /path/to/unmodified/source /path/to/modified/source > /path/to/patchfile.patch</code>.</p> </subsection> <subsection name="Sending a Patch"> <p>The preferred way to submit a patch is via the <a href="mail-lists.html">Asterisk-java Developer List</a>. The patch can be reviewed there in public and other suggestions can be discussed.</p> </subsection> </section> </body> </document> Index: navigation.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/xdocs/navigation.xml,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- navigation.xml 11 Mar 2005 23:17:46 -0000 1.3 +++ navigation.xml 24 Apr 2005 14:34:00 -0000 1.4 @@ -27,6 +27,7 @@ <item name="Home" href="index.html"/> <item name="Building with Maven" href="building.html"/> <item name="Mailing Lists" href="mail-lists.html"/> + <item name="Patch Howto" href="patch.html"/> </menu> <menu name="Documentation"> <item name="Tutorial" href="tutorial.html"/> |
From: Stefan R. <sr...@us...> - 2005-04-24 13:40:02
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/response In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6647/src/java/net/sf/asterisk/manager/response Modified Files: ManagerResponse.java Log Message: Added javadoc to attribute retrieval methods Index: ManagerResponse.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/response/ManagerResponse.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- ManagerResponse.java 23 Apr 2005 22:56:33 -0000 1.4 +++ ManagerResponse.java 24 Apr 2005 13:39:40 -0000 1.5 @@ -45,16 +45,48 @@ public class ManagerResponse implements private String uniqueId; private Map attributes; + /** + * Returns a Map with all attributes of this response.<br> + * The keys are all lower case! + * @see #getAttribute(String) + */ public Map getAttributes() { return attributes; } + /** + * Sets the Map with all attributes. + * @param attributes Map with containing the attributes with all lower + * case keys. + */ public void setAttributes(Map attributes) { this.attributes = attributes; } + /** + * Returns the value of the attribute with the given key.<br> + * This is particulary important when a response contains special + * attributes that are dependent on the action that has been sent.<br> + * An example of this is the response to the GetVarAction. + * It contains the value of the channel variable as an attribute + * stored under the key of the variable name.<br> + * Example: + * <pre> + * GetVarAction action = new GetVarAction(); + * action.setChannel("SIP/1310-22c3"); + * action.setVariable("ALERT_INFO"); + * ManagerResponse response = connection.sendAction(action); + * String alertInfo = response.getAttribute("ALERT_INFO"); + * </pre> + * As all attributes are internally stored in lower case the key is + * automatically converted to lower case before lookup. + * + * @param key the key to lookup. + * @return the value of the attribute stored under this key or + * <code>null</code> if there is no such attribute. + */ public String getAttribute(String key) { return (String) attributes.get(key.toLowerCase()); |
From: Stefan R. <sr...@us...> - 2005-04-23 22:57:34
|
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6393/src/test/net/sf/asterisk/manager/impl Modified Files: ManagerReaderImplTest.java Log Message: Applied Daniel Pocock's patch to the manager: - Added debugging - Added access to the raw attributes of ManagerResponse Index: ManagerReaderImplTest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/impl/ManagerReaderImplTest.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- ManagerReaderImplTest.java 13 Mar 2005 11:26:51 -0000 1.3 +++ ManagerReaderImplTest.java 23 Apr 2005 22:57:25 -0000 1.4 @@ -221,6 +221,11 @@ public class ManagerReaderImplTest exten ((ManagerResponse) dispatcher.dispatchedResponses.get(0)) .getMessage()); + assertEquals("ManagerResponse contains incorrect message (via getAttribute)", + "Authentication accepted", + ((ManagerResponse) dispatcher.dispatchedResponses.get(0)) + .getAttribute("MESSAGE")); + assertEquals("ManagerResponse contains incorrect dateReceived", now, ((ManagerResponse) dispatcher.dispatchedResponses.get(0)) .getDateReceived()); @@ -279,6 +284,10 @@ public class ManagerReaderImplTest exten ((CommandResponse) dispatcher.dispatchedResponses.get(0)) .getActionId()); + assertEquals("CommandResponse contains incorrect actionId (via getAttribute)", "12345", + ((CommandResponse) dispatcher.dispatchedResponses.get(0)) + .getAttribute("actionId")); + assertEquals("CommandResponse contains incorrect result", result, ((CommandResponse) dispatcher.dispatchedResponses.get(0)) .getResult()); |
From: Stefan R. <sr...@us...> - 2005-04-23 22:57:13
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5815/src/java/net/sf/asterisk/manager/impl Modified Files: ResponseBuilderImpl.java ManagerReaderImpl.java Log Message: Applied Daniel Pocock's patch to the manager: - Added debugging - Added access to the raw attributes of ManagerResponse Index: ResponseBuilderImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/impl/ResponseBuilderImpl.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- ResponseBuilderImpl.java 11 Mar 2005 15:27:23 -0000 1.1 +++ ResponseBuilderImpl.java 23 Apr 2005 22:56:29 -0000 1.2 @@ -16,6 +16,7 @@ */ package net.sf.asterisk.manager.impl; +import java.util.HashMap; import java.util.Map; import net.sf.asterisk.manager.ResponseBuilder; @@ -103,6 +104,9 @@ public class ResponseBuilderImpl impleme // fill known attributes response.setResponse(responseType); + // clone this map as it is reused by the ManagerReader + response.setAttributes(new HashMap(attributes)); + if (attributes.containsKey("actionid")) { response.setActionId((String) attributes.get("actionid")); Index: ManagerReaderImpl.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/impl/ManagerReaderImpl.java,v retrieving revision 1.4 retrieving revision 1.5 diff -u -d -p -r1.4 -r1.5 --- ManagerReaderImpl.java 15 Apr 2005 04:47:01 -0000 1.4 +++ ManagerReaderImpl.java 23 Apr 2005 22:56:31 -0000 1.5 @@ -159,6 +159,10 @@ public class ManagerReaderImpl implement commandResponse.setResponse("Follows"); commandResponse.setDateReceived(DateUtil.getDate()); commandResponse.setResult(commandResult); + Map attributes = new HashMap(); + attributes.put("actionid", commandResponse.getActionId()); + attributes.put("response", commandResponse.getResponse()); + commandResponse.setAttributes(attributes); dispatcher.dispatchResponse(commandResponse); processingCommandResult = false; } @@ -197,19 +201,28 @@ public class ManagerReaderImpl implement if (buffer.containsKey("response")) { ManagerResponse response = buildResponse(buffer); + logger.debug("attempting to build response"); if (response != null) { dispatcher.dispatchResponse(response); - } + } } else if (buffer.containsKey("event")) { + logger.debug("attempting to build event: " + buffer.get("event")); ManagerEvent event = buildEvent(asteriskServer, buffer); if (event != null) { dispatcher.dispatchEvent(event); + } else + { + logger.warn("buildEvent returned null"); } } + else + { + logger.warn("buffer contains neither response nor event"); + } buffer.clear(); } @@ -227,6 +240,7 @@ public class ManagerReaderImpl implement value = line.substring(delimiterIndex + 2); buffer.put(name, value); + logger.debug("Got name [" + name + "], value: [" + value + "]"); } } } |
From: Stefan R. <sr...@us...> - 2005-04-23 22:56:48
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/response In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5815/src/java/net/sf/asterisk/manager/response Modified Files: ManagerResponse.java Log Message: Applied Daniel Pocock's patch to the manager: - Added debugging - Added access to the raw attributes of ManagerResponse Index: ManagerResponse.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/response/ManagerResponse.java,v retrieving revision 1.3 retrieving revision 1.4 diff -u -d -p -r1.3 -r1.4 --- ManagerResponse.java 13 Mar 2005 11:26:49 -0000 1.3 +++ ManagerResponse.java 23 Apr 2005 22:56:33 -0000 1.4 @@ -18,6 +18,7 @@ package net.sf.asterisk.manager.response import java.io.Serializable; import java.util.Date; +import java.util.Map; /** * Represents a response received from the Asterisk server as the result of a @@ -42,6 +43,22 @@ public class ManagerResponse implements private String response; private String message; private String uniqueId; + private Map attributes; + + public Map getAttributes() + { + return attributes; + } + + public void setAttributes(Map attributes) + { + this.attributes = attributes; + } + + public String getAttribute(String key) + { + return (String) attributes.get(key.toLowerCase()); + } /** * Returns the point in time this response was received from the asterisk |
From: Stefan R. <sr...@us...> - 2005-04-23 22:56:46
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv5815/src/java/net/sf/asterisk/manager Modified Files: DefaultManagerConnection.java Log Message: Applied Daniel Pocock's patch to the manager: - Added debugging - Added access to the raw attributes of ManagerResponse Index: DefaultManagerConnection.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/DefaultManagerConnection.java,v retrieving revision 1.14 retrieving revision 1.15 diff -u -d -p -r1.14 -r1.15 --- DefaultManagerConnection.java 21 Apr 2005 23:34:39 -0000 1.14 +++ DefaultManagerConnection.java 23 Apr 2005 22:56:38 -0000 1.15 @@ -529,7 +529,7 @@ public class DefaultManagerConnection im response.setActionId(Util.stripInternalActionId(actionId)); } - logger.debug("Dispatching response with internalActionId '" + internalActionId + "':\n" + response); + logger.debug("Dispatching response with internalActionId '" + internalActionId + "':\n" + response); if (internalActionId != null) { @@ -563,6 +563,10 @@ public class DefaultManagerConnection im logger.warn("Exception calling responseHandler", e); } } + else + { + logger.info("responseHandler not found"); + } } /** |
From: Stefan R. <sr...@us...> - 2005-04-21 23:35:47
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22532/src/java/net/sf/asterisk/manager Modified Files: DefaultManagerConnection.java Util.java Log Message: Fixed a possible bug in action id generation when Object.hashCode() returned a negative int. Thanks to Chad Kitching. Index: DefaultManagerConnection.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/DefaultManagerConnection.java,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -p -r1.13 -r1.14 --- DefaultManagerConnection.java 31 Mar 2005 22:29:50 -0000 1.13 +++ DefaultManagerConnection.java 21 Apr 2005 23:34:39 -0000 1.14 @@ -444,15 +444,7 @@ public class DefaultManagerConnection im } internalActionId = createInternalActionId(); - - if (action.getActionId() == null) - { - action.setActionId(internalActionId + "-"); - } - else - { - action.setActionId(internalActionId + "-" + action.getActionId()); - } + action.setActionId(Util.addInternalActionId(action.getActionId(), internalActionId)); if (callbackHandler != null) { Index: Util.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/manager/Util.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- Util.java 23 Feb 2005 22:50:57 -0000 1.2 +++ Util.java 21 Apr 2005 23:34:40 -0000 1.3 @@ -24,6 +24,8 @@ package net.sf.asterisk.manager; */ public class Util { + public static char INTERNAL_ACTION_ID_DELIMITER = '#'; + /** * The hex digits used to build a hex string representation of a byte array. */ @@ -54,7 +56,7 @@ public class Util { int delimiterIndex; - delimiterIndex = actionId.indexOf('-'); + delimiterIndex = actionId.indexOf(INTERNAL_ACTION_ID_DELIMITER); if (delimiterIndex > 0) { return actionId.substring(0, delimiterIndex); @@ -69,7 +71,7 @@ public class Util { int delimiterIndex; - delimiterIndex = actionId.indexOf('-'); + delimiterIndex = actionId.indexOf(INTERNAL_ACTION_ID_DELIMITER); if (delimiterIndex > 0) { if (actionId.length() > delimiterIndex + 1) @@ -86,4 +88,16 @@ public class Util return null; } } + + public static String addInternalActionId(String actionId, String internalActionId) + { + if (actionId == null) + { + return internalActionId + INTERNAL_ACTION_ID_DELIMITER; + } + else + { + return internalActionId + INTERNAL_ACTION_ID_DELIMITER + actionId; + } + } } |
From: Stefan R. <sr...@us...> - 2005-04-21 23:34:55
|
Update of /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22532/src/test/net/sf/asterisk/manager/impl Modified Files: EventBuilderImplTest.java Log Message: Fixed a possible bug in action id generation when Object.hashCode() returned a negative int. Thanks to Chad Kitching. Index: EventBuilderImplTest.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/test/net/sf/asterisk/manager/impl/EventBuilderImplTest.java,v retrieving revision 1.2 retrieving revision 1.3 diff -u -d -p -r1.2 -r1.3 --- EventBuilderImplTest.java 15 Mar 2005 18:01:45 -0000 1.2 +++ EventBuilderImplTest.java 21 Apr 2005 23:34:41 -0000 1.3 @@ -210,7 +210,7 @@ public class EventBuilderImplTest extend ManagerEvent event; properties.put("event", "StatusComplete"); - properties.put("actionid", "1234-origId"); + properties.put("actionid", "1234#origId"); event = eventBuilder.buildEvent(this, properties); assertNotNull(event); |
From: Stefan R. <sr...@us...> - 2005-04-20 23:56:50
|
Update of /cvsroot/asterisk-java/asterisk-java/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv13461/xdocs Modified Files: tutorial.xml Log Message: Fixed links to javadoc Index: tutorial.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/xdocs/tutorial.xml,v retrieving revision 1.10 retrieving revision 1.11 diff -u -d -p -r1.10 -r1.11 --- tutorial.xml 20 Apr 2005 20:43:43 -0000 1.10 +++ tutorial.xml 20 Apr 2005 23:56:41 -0000 1.11 @@ -133,7 +133,7 @@ INFO: End AGIScript HelloAGIScript on AG If you want to use commands that do not yet have a corresponding method in AbstractAGIScript or if you want to extend the FastAGI protocol by adding your own commands you can also use the - <a href="apidocs/net/sf/asterisk/fastagi/AGIChannel.html">channel</a>.sendCommand(<a href="apidocs/net/sf/asterisk/fastagi/AGICommand.html">AGICommand</a>) + <a href="apidocs/net/sf/asterisk/fastagi/AGIChannel.html">channel</a>.sendCommand(<a href="apidocs/net/sf/asterisk/fastagi/command/AGICommand.html">AGICommand</a>) method to send arbitrary commands.</p> <p>You can pass parameters to your scripts by including them in the URL used with the AGI command. These parameters can be read by the getParameter(String) and @@ -222,7 +222,7 @@ write=system,call,log,verbose,agent,comm <a href="apidocs/net/sf/asterisk/manager/ManagerConnection.html">ManagerConnection</a> providing the hostname Asterisk is running on and the username and password as configured in <code>manager.conf</code>. Next we log in and send an - <a href="apidocs/net/sf/asterisk/manager/action/OriginateCallAction.html">OriginateCallAction</a> + <a href="apidocs/net/sf/asterisk/manager/action/OriginateAction.html">OriginateAction</a> and finally we disconnect.</p> <p>An example that does this is shown below.</p> <source><![CDATA[ |
From: Stefan R. <sr...@us...> - 2005-04-20 20:43:52
|
Update of /cvsroot/asterisk-java/asterisk-java/xdocs In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv6367/xdocs Modified Files: tutorial.xml Log Message: Removed references to commons-logging as it is no longer required. Index: tutorial.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/xdocs/tutorial.xml,v retrieving revision 1.9 retrieving revision 1.10 diff -u -d -p -r1.9 -r1.10 --- tutorial.xml 6 Apr 2005 23:07:02 -0000 1.9 +++ tutorial.xml 20 Apr 2005 20:43:43 -0000 1.10 @@ -72,10 +72,9 @@ public class HelloAGIScript extends Abst } ]]></source> <p>Put this Java source file into a directory of your choice, - add the <code>asterisk-java.jar</code> and <code>commons-logging.jar</code> - and compile it:</p> + add the <code>asterisk-java.jar</code> and compile it:</p> <source><![CDATA[ -$ javac -cp asterisk-java.jar:commons-logging.jar HelloAGIScript.java +$ javac -cp asterisk-java.jar HelloAGIScript.java $ ]]></source> <p>Next you have to add a call to your script to your dialplan in Asterisk.</p> @@ -100,14 +99,13 @@ hello.agi = HelloAGIScript <source><![CDATA[ $ ls -l -rw-r--r-- 1 srt srt 163689 2005-03-11 22:07 asterisk-java.jar --rw-r--r-- 1 srt srt 26388 2005-03-11 22:06 commons-logging.jar -rw-r--r-- 1 srt srt 26 2005-03-11 20:50 fastagi-mapping.properties -rw-r--r-- 1 srt srt 624 2005-03-11 22:07 HelloAGIScript.class -rw-r--r-- 1 srt srt 438 2005-03-11 20:50 HelloAGIScript.java ]]></source> <p>Finally we start the AGIServer:</p> <source><![CDATA[ -$ java -cp commons-logging.jar:asterisk-java.jar:. net.sf.asterisk.fastagi.DefaultAGIServer +$ java -cp asterisk-java.jar:. net.sf.asterisk.fastagi.DefaultAGIServer ]]></source> <p>You should see some logging output indicating that the AGIServer has been successfully started and is listening for incoming connections:</p> |
From: Stefan R. <sr...@us...> - 2005-04-20 18:22:23
|
Update of /cvsroot/asterisk-java/asterisk-java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30193 Modified Files: project.xml Log Message: Changed logging to use either log4j, java.util.logging disable logging depending on the classes available at runtime. Index: project.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/project.xml,v retrieving revision 1.13 retrieving revision 1.14 diff -u -d -p -r1.13 -r1.14 --- project.xml 15 Apr 2005 19:18:56 -0000 1.13 +++ project.xml 20 Apr 2005 18:22:13 -0000 1.14 @@ -106,11 +106,11 @@ </developers> <dependencies> <dependency> - <groupId>commons-logging</groupId> - <artifactId>commons-logging</artifactId> - <version>1.0.3</version> + <groupId>log4j</groupId> + <artifactId>log4j</artifactId> + <version>1.2.8</version> <type>jar</type> - <url>http://jakarta.apache.org/commons/logging/</url> + <url>http://logging.apache.org/log4j/</url> </dependency> <dependency> <groupId>easymock</groupId> @@ -138,6 +138,13 @@ </includes> <filtering>false</filtering> </resource> + <resource> + <directory>${basedir}/src/resources/log4j</directory> + <includes> + <include>log4j.properties</include> + </includes> + <filtering>false</filtering> + </resource> </resources> </unitTest> </build> |
From: Stefan R. <sr...@us...> - 2005-04-20 18:22:23
|
Update of /cvsroot/asterisk-java/asterisk-java/src/resources/log4j In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30193/src/resources/log4j Added Files: log4j.properties Log Message: Changed logging to use either log4j, java.util.logging disable logging depending on the classes available at runtime. --- NEW FILE: log4j.properties --- log4j.rootCategory=WARN, Console log4j.appender.Console=org.apache.log4j.ConsoleAppender log4j.appender.Console.layout=org.apache.log4j.PatternLayout log4j.appender.Console.layout.ConversionPattern=%d %c %p - %m\n |
From: Stefan R. <sr...@us...> - 2005-04-20 18:22:23
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/util In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30193/src/java/net/sf/asterisk/util Modified Files: LogFactory.java Removed Files: NullLog.java CommonsLoggingLog.java Log Message: Changed logging to use either log4j, java.util.logging disable logging depending on the classes available at runtime. Index: LogFactory.java =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/util/LogFactory.java,v retrieving revision 1.1 retrieving revision 1.2 diff -u -d -p -r1.1 -r1.2 --- LogFactory.java 31 Mar 2005 22:29:52 -0000 1.1 +++ LogFactory.java 20 Apr 2005 18:22:13 -0000 1.2 @@ -16,6 +16,10 @@ */ package net.sf.asterisk.util; +import net.sf.asterisk.util.impl.JavaLoggingLog; +import net.sf.asterisk.util.impl.Log4JLogger; +import net.sf.asterisk.util.impl.NullLog; + /** * Facade to hide details of the underlying logging system. * @@ -25,12 +29,18 @@ package net.sf.asterisk.util; public final class LogFactory { /** - * Indicates if commons-logging is available on the classpath or not. If the + * Indicates if log4j is available on the classpath or not. If the * check has not yet performed this is <code>null</code>. */ - private static Boolean commonsLoggingAvailable = null; + private static Boolean log4jLoggingAvailable = null; /** + * Indicates if java.util.logging is available on the classpath or not. If the + * check has not yet performed this is <code>null</code>. + */ + private static Boolean javaLoggingAvailable = null; + + /** * Returns an instance of Log suitable for logging from the given class. * * @param clazz the class to create the logger for. @@ -38,26 +48,44 @@ public final class LogFactory */ public static Log getLog(Class clazz) { - if (commonsLoggingAvailable == null) + if (log4jLoggingAvailable == null) { try { - Class.forName("org.apache.commons.logging.LogFactory"); - commonsLoggingAvailable = Boolean.TRUE; + Class.forName("org.apache.log4j.Logger"); + log4jLoggingAvailable = Boolean.TRUE; } catch (Exception e) { - commonsLoggingAvailable = Boolean.FALSE; + log4jLoggingAvailable = Boolean.FALSE; } } - - if (commonsLoggingAvailable.booleanValue()) + if (log4jLoggingAvailable.booleanValue()) { - return new CommonsLoggingLog(clazz); + return new Log4JLogger(clazz); } else { - return new NullLog(); + if (javaLoggingAvailable == null) + { + try + { + Class.forName("java.util.logging.Logger"); + javaLoggingAvailable = Boolean.TRUE; + } + catch (Exception e) + { + javaLoggingAvailable = Boolean.FALSE; + } + } + if (javaLoggingAvailable.booleanValue()) + { + return new JavaLoggingLog(clazz); + } + else + { + return new NullLog(); + } } } } --- NullLog.java DELETED --- --- CommonsLoggingLog.java DELETED --- |
From: Stefan R. <sr...@us...> - 2005-04-20 18:22:22
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/util/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv30193/src/java/net/sf/asterisk/util/impl Added Files: JavaLoggingLog.java NullLog.java Log4JLogger.java package.html Log Message: Changed logging to use either log4j, java.util.logging disable logging depending on the classes available at runtime. --- NEW FILE: JavaLoggingLog.java --- /* * JavaLoggingLog.java * * Created on April 14, 2005, 4:28 PM */ package net.sf.asterisk.util.impl; import java.util.logging.Level; import java.util.logging.Logger; import net.sf.asterisk.util.Log; /** * Log implementation that uses the java.util.logging package. * * @author drach */ public class JavaLoggingLog implements Log { /** * The underlying commons-logging Log object to use. */ private Logger log; /** * Creates a new JavaLoggingLog obtained from java.util.logging for the * given class. * * @param clazz the class to log for. */ public JavaLoggingLog(Class clazz) { log = Logger.getLogger(clazz.getName()); } public void debug(Object obj) { log.fine(obj.toString()); } public void info(Object obj) { log.info(obj.toString()); } public void warn(Object obj) { log.warning(obj.toString()); } public void warn(Object obj, Throwable ex) { log.log(Level.WARNING, obj.toString(), ex); } public void error(Object obj) { log.severe(obj.toString()); } public void error(Object obj, Throwable ex) { log.log(Level.SEVERE, obj.toString(), ex); } } --- 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.impl; import net.sf.asterisk.util.Log; /** * A Log implementation that does nothing. * * @author srt * @version $Id: NullLog.java,v 1.1 2005/04/20 18:22:13 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: Log4JLogger.java --- /* * Copyright 2001-2004 The Apache Software Foundation. * * 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.impl; import java.io.Serializable; import net.sf.asterisk.util.Log; import org.apache.log4j.Logger; import org.apache.log4j.Priority; import org.apache.log4j.Level; /** * <p> * Implementation of {@link Log} that maps directly to a Log4J <strong>Logger</strong>. * Initial configuration of the corresponding Logger instances should be done in * the usual manner, as outlined in the Log4J documentation. * </p> * * @author <a href="mailto:sa...@ap...">Scott Sanders</a> * @author Rod Waldhoff * @author Robert Burrell Donkin * @version $Id: Log4JLogger.java,v 1.1 2005/04/20 18:22:13 srt Exp $ */ public class Log4JLogger implements Log, Serializable { // ------------------------------------------------------------- Attributes /** * The serial version identifier. */ private static final long serialVersionUID = 3545240215095883829L; /** The fully qualified name of the Log4JLogger class. */ private static final String FQCN = Log4JLogger.class.getName(); private static final boolean is12 = Priority.class .isAssignableFrom(Level.class); /** Log to this logger */ private transient Logger logger = null; /** Logger name */ private String name = null; // ------------------------------------------------------------ Constructor public Log4JLogger() { } /** * Base constructor. */ public Log4JLogger(Class clazz) { this.name = clazz.getName(); this.logger = getLogger(); } // --------------------------------------------------------- Implementation /** * Log a message to the Log4j Logger with <code>TRACE</code> priority. * Currently logs to <code>DEBUG</code> level in Log4J. */ public void trace(Object message) { if (is12) { getLogger().log(FQCN, (Priority) Level.DEBUG, message, null); } else { getLogger().log(FQCN, Level.DEBUG, message, null); } } /** * Log an error to the Log4j Logger with <code>TRACE</code> priority. * Currently logs to <code>DEBUG</code> level in Log4J. */ public void trace(Object message, Throwable t) { if (is12) { getLogger().log(FQCN, (Priority) Level.DEBUG, message, t); } else { getLogger().log(FQCN, Level.DEBUG, message, t); } } /** * Log a message to the Log4j Logger with <code>DEBUG</code> priority. */ public void debug(Object message) { if (is12) { getLogger().log(FQCN, (Priority) Level.DEBUG, message, null); } else { getLogger().log(FQCN, Level.DEBUG, message, null); } } /** * Log an error to the Log4j Logger with <code>DEBUG</code> priority. */ public void debug(Object message, Throwable t) { if (is12) { getLogger().log(FQCN, (Priority) Level.DEBUG, message, t); } else { getLogger().log(FQCN, Level.DEBUG, message, t); } } /** * Log a message to the Log4j Logger with <code>INFO</code> priority. */ public void info(Object message) { if (is12) { getLogger().log(FQCN, (Priority) Level.INFO, message, null); } else { getLogger().log(FQCN, Level.INFO, message, null); } } /** * Log an error to the Log4j Logger with <code>INFO</code> priority. */ public void info(Object message, Throwable t) { if (is12) { getLogger().log(FQCN, (Priority) Level.INFO, message, t); } else { getLogger().log(FQCN, Level.INFO, message, t); } } /** * Log a message to the Log4j Logger with <code>WARN</code> priority. */ public void warn(Object message) { if (is12) { getLogger().log(FQCN, (Priority) Level.WARN, message, null); } else { getLogger().log(FQCN, Level.WARN, message, null); } } /** * Log an error to the Log4j Logger with <code>WARN</code> priority. */ public void warn(Object message, Throwable t) { if (is12) { getLogger().log(FQCN, (Priority) Level.WARN, message, t); } else { getLogger().log(FQCN, Level.WARN, message, t); } } /** * Log a message to the Log4j Logger with <code>ERROR</code> priority. */ public void error(Object message) { if (is12) { getLogger().log(FQCN, (Priority) Level.ERROR, message, null); } else { getLogger().log(FQCN, Level.ERROR, message, null); } } /** * Log an error to the Log4j Logger with <code>ERROR</code> priority. */ public void error(Object message, Throwable t) { if (is12) { getLogger().log(FQCN, (Priority) Level.ERROR, message, t); } else { getLogger().log(FQCN, Level.ERROR, message, t); } } /** * Log a message to the Log4j Logger with <code>FATAL</code> priority. */ public void fatal(Object message) { if (is12) { getLogger().log(FQCN, (Priority) Level.FATAL, message, null); } else { getLogger().log(FQCN, Level.FATAL, message, null); } } /** * Log an error to the Log4j Logger with <code>FATAL</code> priority. */ public void fatal(Object message, Throwable t) { if (is12) { getLogger().log(FQCN, (Priority) Level.FATAL, message, t); } else { getLogger().log(FQCN, Level.FATAL, message, t); } } /** * Return the native Logger instance we are using. */ public Logger getLogger() { if (logger == null) { logger = Logger.getLogger(name); } return (this.logger); } /** * Check whether the Log4j Logger used is enabled for <code>DEBUG</code> * priority. */ public boolean isDebugEnabled() { return getLogger().isDebugEnabled(); } /** * Check whether the Log4j Logger used is enabled for <code>ERROR</code> * priority. */ public boolean isErrorEnabled() { if (is12) { return getLogger().isEnabledFor((Priority) Level.ERROR); } else { return getLogger().isEnabledFor(Level.ERROR); } } /** * Check whether the Log4j Logger used is enabled for <code>FATAL</code> * priority. */ public boolean isFatalEnabled() { if (is12) { return getLogger().isEnabledFor((Priority) Level.FATAL); } else { return getLogger().isEnabledFor(Level.FATAL); } } /** * Check whether the Log4j Logger used is enabled for <code>INFO</code> * priority. */ public boolean isInfoEnabled() { return getLogger().isInfoEnabled(); } /** * Check whether the Log4j Logger used is enabled for <code>TRACE</code> * priority. For Log4J, this returns the value of * <code>isDebugEnabled()</code> */ public boolean isTraceEnabled() { return getLogger().isDebugEnabled(); } /** * Check whether the Log4j Logger used is enabled for <code>WARN</code> * priority. */ public boolean isWarnEnabled() { if (is12) { return getLogger().isEnabledFor((Priority) Level.WARN); } else { return getLogger().isEnabledFor(Level.WARN); } } } --- 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.util package.</p> </body> </html> |
From: Stefan R. <sr...@us...> - 2005-04-20 18:22:12
|
Update of /cvsroot/asterisk-java/asterisk-java/src/resources/log4j In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29803/src/resources/log4j Log Message: Directory /cvsroot/asterisk-java/asterisk-java/src/resources/log4j added to the repository |
From: Stefan R. <sr...@us...> - 2005-04-20 18:22:12
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/util/impl In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv29803/src/java/net/sf/asterisk/util/impl Log Message: Directory /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/util/impl added to the repository |
From: Stefan R. <sr...@us...> - 2005-04-15 19:19:05
|
Update of /cvsroot/asterisk-java/asterisk-java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv23675 Modified Files: project.xml Log Message: - Changed currentVersion to 0.1-SNAPSHOT Index: project.xml =================================================================== RCS file: /cvsroot/asterisk-java/asterisk-java/project.xml,v retrieving revision 1.12 retrieving revision 1.13 diff -u -d -p -r1.12 -r1.13 --- project.xml 9 Apr 2005 11:54:47 -0000 1.12 +++ project.xml 15 Apr 2005 19:18:56 -0000 1.13 @@ -28,7 +28,7 @@ </reports> <id>asterisk-java</id> <name>asterisk-java</name> - <currentVersion>0.1-rc1</currentVersion> + <currentVersion>0.1-SNAPSHOT</currentVersion> <organization> <name>Stefan Reuter</name> <url>http://sourceforge.net/projects/asterisk-java/</url> |
From: Stefan R. <sr...@us...> - 2005-04-15 17:06:42
|
Update of /cvsroot/asterisk-java/asterisk-java/src/java/net/sf/asterisk/fastagi In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv12942/src/java/net/sf/asterisk/fastagi Removed Files: ReplyBuilder.java Log Message: - Removed unused ReplyBuilder interface --- ReplyBuilder.java DELETED --- |
Update of /cvsroot/asterisk-java/samples/src/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24217/src/java Added Files: HelloAGIScript.java fastagi.properties fastagi-mapping.properties HelloEvents.java TestFastAGI.java HelloManager.java .cvsignore Log Message: - Initial import --- NEW FILE: HelloAGIScript.java --- import net.sf.asterisk.fastagi.AGIChannel; import net.sf.asterisk.fastagi.AGIException; import net.sf.asterisk.fastagi.AGIRequest; import net.sf.asterisk.fastagi.AbstractAGIScript; public class HelloAGIScript extends AbstractAGIScript { public void service(AGIRequest request, AGIChannel channel) throws AGIException { // Answer the channel... answer(channel); // ...say hello... streamFile(channel, "welcome"); // ...and hangup. hangup(channel); } } --- NEW FILE: fastagi.properties --- poolSize = 1 --- NEW FILE: fastagi-mapping.properties --- hello.agi = HelloAGIScript test.agi = TestFastAGI --- NEW FILE: HelloEvents.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. * */ 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 helloEvents; helloEvents = new HelloEvents(); helloEvents.run(); } } --- NEW FILE: TestFastAGI.java --- import java.util.*; import net.sf.asterisk.fastagi.*; import net.sf.asterisk.fastagi.command.*; import net.sf.asterisk.fastagi.reply.*; /** * This class is a port of the fastagi-test perl script distributed with * Asterisk to demonstrate the FastAGI.<br> * It was kindly donated by Steve Drach. * * @author drach */ public class TestFastAGI extends AbstractAGIScript { private int tests, pass, fail; private int s, p; private void print(String s) { System.err.print(s); } private void checkResult(AGIReply reply) { tests++; if (reply.getStatus() == 200) { if (reply.getResult() == null) { print("FAIL (" + reply.getFirstLine() + ")\n"); fail++; } else { print("PASS (" + reply.getResult() + ")\n"); pass++; } } else { print("FAIL (unexpected result '" + reply.getFirstLine() + "')\n"); fail++; } } public void service(AGIRequest request, AGIChannel channel) throws AGIException { Map values; Iterator i; SortedSet keys = new TreeSet(); keys.addAll((values = request.getRequest()).keySet()); print("AGI Environment Dump from --\n"); i = keys.iterator(); while (i.hasNext()) { String key; key = (String) i.next(); print(" -- " + key + " = " + (String) values.get(key) + "\n"); } print("1. Testing 'sendfile'..."); checkResult(channel.sendCommand(new StreamFileCommand("beep"))); print("2. Testing 'sendtext'..."); checkResult(channel.sendCommand(new SendTextCommand("hello world"))); print("3. Testing 'sendimage'..."); checkResult(channel.sendCommand(new SendImageCommand("asterisk-image"))); print("4. Testing 'saynumber'..."); checkResult(channel.sendCommand(new SayNumberCommand("192837465"))); print("5. Testing 'waitdtmf'..."); checkResult(channel.sendCommand(new WaitForDigitCommand(1000))); print("6. Testing 'record'..."); checkResult(channel.sendCommand(new RecordFileCommand("testagi", "gsm", "1234", 3000))); print("6a. Testing 'record' playback..."); checkResult(channel.sendCommand(new StreamFileCommand("testagi"))); print("================== Complete ======================\n"); print(tests + " tests completed, " + pass + " passed, " + fail + " failed\n"); print("==================================================\n"); } } --- NEW FILE: HelloManager.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. * */ 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.TimeoutException; import net.sf.asterisk.manager.action.OriginateAction; import net.sf.asterisk.manager.response.ManagerResponse; public class HelloManager { private ManagerConnection managerConnection; public HelloManager() throws IOException { ManagerConnectionFactory factory = new ManagerConnectionFactory(); this.managerConnection = factory.getManagerConnection("localhost", "manager", "pa55w0rd"); } public void run() throws IOException, AuthenticationFailedException, TimeoutException { OriginateAction originateAction; ManagerResponse originateResponse; originateAction = new OriginateAction(); originateAction.setChannel("Local/1310"); originateAction.setContext("default"); originateAction.setExten("1330"); originateAction.setPriority(new Integer(1)); originateAction.setTimeout(new Integer(30000)); // connect to Asterisk and log in managerConnection.login(); // send the originate action and wait for a maximum of 30 seconds for // Asterisk // to send a reply originateResponse = managerConnection.sendAction(originateAction, 30000); // print out whether the originate succeeded or not System.out.println(originateResponse.getResponse()); // and finally log off and disconnect managerConnection.logoff(); } public static void main(String[] args) throws Exception { HelloManager helloManager; helloManager = new HelloManager(); helloManager.run(); } } --- NEW FILE: .cvsignore --- *.jar *.class |
From: Stefan R. <sr...@us...> - 2005-04-15 06:04:45
|
Update of /cvsroot/asterisk-java/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24217 Added Files: .cvsignore Log Message: - Initial import --- NEW FILE: .cvsignore --- .settings target .classpath .project |
From: Stefan R. <sr...@us...> - 2005-04-15 06:04:13
|
Update of /cvsroot/asterisk-java/samples/src/java In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24078/src/java Log Message: Directory /cvsroot/asterisk-java/samples/src/java added to the repository |
From: Stefan R. <sr...@us...> - 2005-04-15 06:04:13
|
Update of /cvsroot/asterisk-java/samples/src In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv24078/src Log Message: Directory /cvsroot/asterisk-java/samples/src added to the repository |
From: Stefan R. <sr...@us...> - 2005-04-15 06:02:11
|
Update of /cvsroot/asterisk-java/samples In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv22882/samples Log Message: Directory /cvsroot/asterisk-java/samples added to the repository |