diff --git a/README.md b/README.md
index 8b58e64..17fb1ce 100644
--- a/README.md
+++ b/README.md
@@ -55,6 +55,7 @@
defaultPassword: ClueCon
performance: false
performanceCostTime: 200
+ #read-timeout-seconds: 0
servers:
- host: 127.0.0.1
port: 8021
diff --git a/freeswitch-esl-example/pom.xml b/freeswitch-esl-example/pom.xml
index 8fa3807..bce4420 100644
--- a/freeswitch-esl-example/pom.xml
+++ b/freeswitch-esl-example/pom.xml
@@ -22,7 +22,7 @@
freeswitch-esl-all
link.thingscloud
- 1.6.5.SNAPSHOT
+ 1.6.5.RELEASE
4.0.0
diff --git a/freeswitch-esl-spring-boot-starter-example/pom.xml b/freeswitch-esl-spring-boot-starter-example/pom.xml
index 2ec15f8..e755efe 100644
--- a/freeswitch-esl-spring-boot-starter-example/pom.xml
+++ b/freeswitch-esl-spring-boot-starter-example/pom.xml
@@ -22,7 +22,7 @@
freeswitch-esl-all
link.thingscloud
- 1.6.5.SNAPSHOT
+ 1.6.5.RELEASE
freeswitch-esl-spring-boot-starter-example
diff --git a/freeswitch-esl-spring-boot-starter/pom.xml b/freeswitch-esl-spring-boot-starter/pom.xml
index fe4cb73..740a422 100644
--- a/freeswitch-esl-spring-boot-starter/pom.xml
+++ b/freeswitch-esl-spring-boot-starter/pom.xml
@@ -22,7 +22,7 @@
freeswitch-esl-all
link.thingscloud
- 1.6.5.SNAPSHOT
+ 1.6.5.RELEASE
4.0.0
diff --git a/freeswitch-esl/pom.xml b/freeswitch-esl/pom.xml
index eebbf93..c0afc68 100644
--- a/freeswitch-esl/pom.xml
+++ b/freeswitch-esl/pom.xml
@@ -22,7 +22,7 @@
freeswitch-esl-all
link.thingscloud
- 1.6.5.SNAPSHOT
+ 1.6.5.RELEASE
4.0.0
diff --git a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/builder/Command.java b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/builder/Command.java
deleted file mode 100644
index 55013bb..0000000
--- a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/builder/Command.java
+++ /dev/null
@@ -1,53 +0,0 @@
-package link.thingscloud.freeswitch.esl.builder;
-
-import link.thingscloud.freeswitch.esl.util.StringUtils;
-
-/**
- * @author zhouhailin
- * @since 1.6.0
- */
-public class Command {
-
- public static final String UUID_ANSWER = "uuid_answer";
- public static final String UUID_BRIDGE = "uuid_bridge";
- public static final String UUID_BROADCAST = "uuid_broadcast";
- public static final String UUID_BREAK = "uuid_break";
- public static final String UUID_HOLD = "uuid_hold";
- public static final String UUID_GETVAR = "uuid_getvar";
- public static final String UUID_SETVAR = "uuid_setvar";
- public static final String UUID_SETVAR_MULTI = "uuid_setvar_multi";
- public static final String UUID_RECORD = "uuid_record";
- public static final String UUID_TRANSFER = "uuid_transfer";
-
- private final StringBuilder builder = new StringBuilder();
-
- public static Command cmd(String cmd) {
- return new Command().arg(cmd);
- }
-
- public Command arg(String arg) {
- if (arg == null || arg.isEmpty()) {
- return this;
- }
- builder.append(arg).append(StringUtils.BLANK);
- return this;
- }
-
- public Command arg(int arg) {
- builder.append(arg).append(StringUtils.BLANK);
- return this;
- }
-
- public Command arg(boolean arg) {
- builder.append(arg).append(StringUtils.BLANK);
- return this;
- }
-
- @Override
- public String toString() {
- if (builder.length() > 0) {
- builder.deleteCharAt(builder.length() - 1);
- }
- return builder.toString();
- }
-}
diff --git a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/constant/EslConstant.java b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/constant/Constants.java
similarity index 69%
rename from freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/constant/EslConstant.java
rename to freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/constant/Constants.java
index 02171e6..b58d50c 100644
--- a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/constant/EslConstant.java
+++ b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/constant/Constants.java
@@ -23,7 +23,7 @@
* @author : zhouhailin
* @version 1.0.0
*/
-public class EslConstant {
+public class Constants {
/**
* Constant BACKGROUND_JOB="BACKGROUND_JOB"
@@ -38,4 +38,16 @@ public class EslConstant {
public static final String SMF_BLEG = "bleg";
public static final String SMF_HOLDB = "holdb";
public static final String SMF_BOTH = "both";
+
+ public static final String UUID_ANSWER = "uuid_answer";
+ public static final String UUID_BRIDGE = "uuid_bridge";
+ public static final String UUID_BROADCAST = "uuid_broadcast";
+ public static final String UUID_BREAK = "uuid_break";
+ public static final String UUID_HOLD = "uuid_hold";
+ public static final String UUID_GETVAR = "uuid_getvar";
+ public static final String UUID_SETVAR = "uuid_setvar";
+ public static final String UUID_SETVAR_MULTI = "uuid_setvar_multi";
+ public static final String UUID_RECORD = "uuid_record";
+ public static final String UUID_TRANSFER = "uuid_transfer";
+
}
diff --git a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/helper/CommandHelper.java b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/helper/CommandHelper.java
new file mode 100644
index 0000000..5344e3a
--- /dev/null
+++ b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/helper/CommandHelper.java
@@ -0,0 +1,59 @@
+/*
+ * Licensed to the Apache Software Foundation (ASF) under one or more
+ * contributor license agreements. See the NOTICE file distributed with
+ * this work for additional information regarding copyright ownership.
+ * The ASF licenses this file to You 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 link.thingscloud.freeswitch.esl.helper;
+
+/**
+ * @author zhouhailin
+ * @since 1.6.5
+ */
+public class CommandHelper {
+
+ private StringBuilder builder = new StringBuilder();
+
+ private CommandHelper(String cmd) {
+ builder.append(cmd);
+ }
+
+ public static CommandHelper cmd(String cmd) {
+ return new CommandHelper(cmd);
+ }
+
+ public CommandHelper arg(String arg) {
+ builder.append(" ").append(arg);
+ return this;
+ }
+
+ public CommandHelper arg(boolean arg) {
+ builder.append(" ").append(arg);
+ return this;
+ }
+
+ public CommandHelper arg(int arg) {
+ builder.append(" ").append(arg);
+ return this;
+ }
+
+ public CommandHelper arg(long arg) {
+ builder.append(" ").append(arg);
+ return this;
+ }
+
+ @Override
+ public String toString() {
+ return builder.toString();
+ }
+
+}
diff --git a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/AbstractInboundClient.java b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/AbstractInboundClient.java
index 360f913..de51346 100644
--- a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/AbstractInboundClient.java
+++ b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/AbstractInboundClient.java
@@ -20,7 +20,7 @@
import io.netty.channel.ChannelFutureListener;
import io.netty.util.concurrent.DefaultThreadFactory;
import link.thingscloud.freeswitch.esl.InboundClient;
-import link.thingscloud.freeswitch.esl.constant.EslConstant;
+import link.thingscloud.freeswitch.esl.constant.Constants;
import link.thingscloud.freeswitch.esl.exception.InboundClientException;
import link.thingscloud.freeswitch.esl.inbound.handler.InboundChannelHandler;
import link.thingscloud.freeswitch.esl.inbound.listener.EventListener;
@@ -34,7 +34,6 @@
import link.thingscloud.freeswitch.esl.transport.message.EslMessage;
import link.thingscloud.freeswitch.esl.util.StringUtils;
-import java.util.HashMap;
import java.util.List;
import java.util.Map;
import java.util.concurrent.ConcurrentHashMap;
@@ -214,7 +213,7 @@ public void handleEslEvent(String addr, EslEvent event) {
* Use a different worker thread pool for async job results than for event driven
* events to keep the latency as low as possible.
*/
- if (StringUtils.equals(event.getEventName(), EslConstant.BACKGROUND_JOB)) {
+ if (StringUtils.equals(event.getEventName(), Constants.BACKGROUND_JOB)) {
try {
listener.backgroundJobResultReceived(addr, event);
} catch (Throwable t) {
diff --git a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/AbstractInboundClientCommand.java b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/AbstractInboundClientCommand.java
index 1d76b06..921037a 100644
--- a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/AbstractInboundClientCommand.java
+++ b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/AbstractInboundClientCommand.java
@@ -1,12 +1,12 @@
package link.thingscloud.freeswitch.esl.inbound;
-import link.thingscloud.freeswitch.esl.builder.Command;
+import link.thingscloud.freeswitch.esl.helper.CommandHelper;
import link.thingscloud.freeswitch.esl.inbound.option.InboundClientOption;
import java.util.List;
import java.util.Map;
-import static link.thingscloud.freeswitch.esl.builder.Command.*;
+import static link.thingscloud.freeswitch.esl.constant.Constants.*;
/**
* @author zhouhailin
@@ -27,7 +27,7 @@ abstract class AbstractInboundClientCommand extends AbstractInboundClient {
*/
@Override
public String answer(String addr, String uuid) {
- String command = Command.cmd(UUID_ANSWER).arg(uuid).toString();
+ String command = CommandHelper.cmd(UUID_ANSWER).arg(uuid).toString();
if (debugEnabled) {
log.debug("answer addr : {}, command : {}", addr, command);
}
@@ -39,7 +39,7 @@ public String answer(String addr, String uuid) {
*/
@Override
public String bridge(String addr, String uuid, String otherUuid) {
- String command = Command.cmd(UUID_BRIDGE).arg(uuid).arg(otherUuid).toString();
+ String command = CommandHelper.cmd(UUID_BRIDGE).arg(uuid).arg(otherUuid).toString();
if (debugEnabled) {
log.debug("bridge addr : {}, command : {}", addr, command);
}
@@ -51,7 +51,7 @@ public String bridge(String addr, String uuid, String otherUuid) {
*/
@Override
public String broadcast(String addr, String uuid, String path, String smf) {
- String command = Command.cmd(UUID_BROADCAST).arg(uuid).arg(path).arg(smf).toString();
+ String command = CommandHelper.cmd(UUID_BROADCAST).arg(uuid).arg(path).arg(smf).toString();
if (debugEnabled) {
log.debug("broadcast addr : {}, command : {}", addr, command);
}
@@ -63,7 +63,7 @@ public String broadcast(String addr, String uuid, String path, String smf) {
*/
@Override
public String break0(String addr, String uuid, boolean all) {
- String command = Command.cmd(UUID_BREAK).arg(uuid).arg(all ? "all" : null).toString();
+ String command = CommandHelper.cmd(UUID_BREAK).arg(uuid).arg(all ? "all" : null).toString();
if (debugEnabled) {
log.debug("break0 addr : {}, command : {}", addr, command);
}
@@ -75,7 +75,7 @@ public String break0(String addr, String uuid, boolean all) {
*/
@Override
public String hold(String addr, String smf, String uuid, boolean display) {
- String command = Command.cmd(UUID_HOLD).arg(smf).arg(uuid).arg(display ? "all" : EMPTY).toString();
+ String command = CommandHelper.cmd(UUID_HOLD).arg(smf).arg(uuid).arg(display ? "all" : EMPTY).toString();
if (debugEnabled) {
log.debug("hold addr : {}, command : {}", addr, command);
}
@@ -87,7 +87,7 @@ public String hold(String addr, String smf, String uuid, boolean display) {
*/
@Override
public List getVar(String addr, String uuid, String var) {
- String command = Command.cmd(UUID_GETVAR).arg(uuid).arg(var).toString();
+ String command = CommandHelper.cmd(UUID_GETVAR).arg(uuid).arg(var).toString();
if (debugEnabled) {
log.debug("getVar addr : {}, command : {}", addr, command);
}
@@ -99,7 +99,7 @@ public List getVar(String addr, String uuid, String var) {
*/
@Override
public String setVar(String addr, String uuid, String var, String val) {
- String command = Command.cmd(UUID_SETVAR).arg(uuid).arg(var).arg(val).toString();
+ String command = CommandHelper.cmd(UUID_SETVAR).arg(uuid).arg(var).arg(val).toString();
if (debugEnabled) {
log.debug("setVar addr : {}, command : {}", addr, command);
}
@@ -128,7 +128,7 @@ public String multiSetVar(String addr, String uuid, Map map) {
*/
@Override
public String record(String addr, String uuid, String action, String path, int limit) {
- String command = Command.cmd(UUID_RECORD).arg(uuid).arg(action).arg(path).arg(limit < 1 ? null : String.valueOf(limit)).toString();
+ String command = CommandHelper.cmd(UUID_RECORD).arg(uuid).arg(action).arg(path).arg(limit < 1 ? null : String.valueOf(limit)).toString();
if (debugEnabled) {
log.debug("record addr : {}, command : {}", addr, command);
}
@@ -140,7 +140,7 @@ public String record(String addr, String uuid, String action, String path, int l
*/
@Override
public String transfer(String addr, String uuid, String smf, String dest, String dialplan, String context) {
- String command = Command.cmd(UUID_TRANSFER).arg(uuid).arg(smf).arg(dest).arg(dialplan).arg(context).toString();
+ String command = CommandHelper.cmd(UUID_TRANSFER).arg(uuid).arg(smf).arg(dest).arg(dialplan).arg(context).toString();
if (debugEnabled) {
log.debug("transfer addr : {}, command : {}", addr, command);
}
diff --git a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/NettyInboundClient.java b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/NettyInboundClient.java
index 594069c..4fa4657 100644
--- a/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/NettyInboundClient.java
+++ b/freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/NettyInboundClient.java
@@ -18,7 +18,7 @@
package link.thingscloud.freeswitch.esl.inbound;
import link.thingscloud.freeswitch.esl.InboundClient;
-import link.thingscloud.freeswitch.esl.constant.EslConstant;
+import link.thingscloud.freeswitch.esl.constant.Constants;
import link.thingscloud.freeswitch.esl.exception.InboundTimeoutExcetion;
import link.thingscloud.freeswitch.esl.inbound.handler.InboundChannelHandler;
import link.thingscloud.freeswitch.esl.inbound.option.InboundClientOption;
@@ -129,7 +129,7 @@ public void sendAsyncApiCommand(String addr, String command, String arg, Consume
*/
@Override
public CommandResponse setEventSubscriptions(String addr, String format, String events) {
- if (!StringUtils.equals(format, EslConstant.PLAIN)) {
+ if (!StringUtils.equals(format, Constants.PLAIN)) {
throw new IllegalStateException("Only 'plain' event format is supported at present");
}
InboundChannelHandler handler = getAuthedHandler(addr);
diff --git a/freeswitch-esl/src/test/java/link/thingscloud/freeswitch/esl/builder/CommandTest.java b/freeswitch-esl/src/test/java/link/thingscloud/freeswitch/esl/builder/CommandTest.java
deleted file mode 100644
index 5401087..0000000
--- a/freeswitch-esl/src/test/java/link/thingscloud/freeswitch/esl/builder/CommandTest.java
+++ /dev/null
@@ -1,10 +0,0 @@
-package link.thingscloud.freeswitch.esl.builder;
-
-import junit.framework.TestCase;
-
-public class CommandTest extends TestCase {
-
- public void testCmd() {
- System.out.println(Command.cmd("").toString());
- }
-}
\ No newline at end of file
diff --git a/pom.xml b/pom.xml
index 02e1638..258b5ab 100644
--- a/pom.xml
+++ b/pom.xml
@@ -24,7 +24,7 @@
link.thingscloud
freeswitch-esl-all
pom
- 1.6.5.SNAPSHOT
+ 1.6.5.RELEASE
freeswitch-esl-all-${project.version}
freeswitch event socket library on netty 4.1
@@ -56,7 +56,7 @@
https://github.com/zhouhailin/freeswitch-esl-all
scm:git:https://github.com/zhouhailin/freeswitch-esl-all.git
scm:git:https://github.com/zhouhailin/freeswitch-esl-all.git
- 1.6.5.SNAPSHOT
+ 1.6.5.RELEASE