Skip to content

Commit

Permalink
迭代:1.6.5.RELEASE
Browse files Browse the repository at this point in the history
  • Loading branch information
zhouhailin committed Dec 21, 2021
1 parent d9466ea commit 763a6fe
Show file tree
Hide file tree
Showing 13 changed files with 94 additions and 86 deletions.
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@
defaultPassword: ClueCon
performance: false
performanceCostTime: 200
#read-timeout-seconds: 0
servers:
- host: 127.0.0.1
port: 8021
Expand Down
2 changes: 1 addition & 1 deletion freeswitch-esl-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>freeswitch-esl-all</artifactId>
<groupId>link.thingscloud</groupId>
<version>1.6.5.SNAPSHOT</version>
<version>1.6.5.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion freeswitch-esl-spring-boot-starter-example/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>freeswitch-esl-all</artifactId>
<groupId>link.thingscloud</groupId>
<version>1.6.5.SNAPSHOT</version>
<version>1.6.5.RELEASE</version>
</parent>

<artifactId>freeswitch-esl-spring-boot-starter-example</artifactId>
Expand Down
2 changes: 1 addition & 1 deletion freeswitch-esl-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>freeswitch-esl-all</artifactId>
<groupId>link.thingscloud</groupId>
<version>1.6.5.SNAPSHOT</version>
<version>1.6.5.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down
2 changes: 1 addition & 1 deletion freeswitch-esl/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
<parent>
<artifactId>freeswitch-esl-all</artifactId>
<groupId>link.thingscloud</groupId>
<version>1.6.5.SNAPSHOT</version>
<version>1.6.5.RELEASE</version>
</parent>
<modelVersion>4.0.0</modelVersion>

Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@
* @author : <a href="mailto:[email protected]">zhouhailin</a>
* @version 1.0.0
*/
public class EslConstant {
public class Constants {

/**
* Constant <code>BACKGROUND_JOB="BACKGROUND_JOB"</code>
Expand All @@ -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";

}
Original file line number Diff line number Diff line change
@@ -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();
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand All @@ -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;
Expand Down Expand Up @@ -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) {
Expand Down
Original file line number Diff line number Diff line change
@@ -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
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -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);
}
Expand All @@ -87,7 +87,7 @@ public String hold(String addr, String smf, String uuid, boolean display) {
*/
@Override
public List<String> 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);
}
Expand All @@ -99,7 +99,7 @@ public List<String> 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);
}
Expand Down Expand Up @@ -128,7 +128,7 @@ public String multiSetVar(String addr, String uuid, Map<String, String> 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);
}
Expand All @@ -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);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -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);
Expand Down

This file was deleted.

4 changes: 2 additions & 2 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@
<groupId>link.thingscloud</groupId>
<artifactId>freeswitch-esl-all</artifactId>
<packaging>pom</packaging>
<version>1.6.5.SNAPSHOT</version>
<version>1.6.5.RELEASE</version>

<name>freeswitch-esl-all-${project.version}</name>
<description>freeswitch event socket library on netty 4.1</description>
Expand Down Expand Up @@ -56,7 +56,7 @@
<url>https://github.com/zhouhailin/freeswitch-esl-all</url>
<connection>scm:git:https://github.com/zhouhailin/freeswitch-esl-all.git</connection>
<developerConnection>scm:git:https://github.com/zhouhailin/freeswitch-esl-all.git</developerConnection>
<tag>1.6.5.SNAPSHOT</tag>
<tag>1.6.5.RELEASE</tag>
</scm>
<licenses>
<license>
Expand Down

0 comments on commit 763a6fe

Please sign in to comment.