zhouhailin / freeswitch-externals Goto Github PK
View Code? Open in Web Editor NEWFreeSWITCH externals projects
Home Page: https://zhouhailin.github.io/freeswitch-externals/
License: Apache License 2.0
FreeSWITCH externals projects
Home Page: https://zhouhailin.github.io/freeswitch-externals/
License: Apache License 2.0
接收ASR消息如下:
¥ᆬᄑ¥ᆬᄑ¥ᆬᄑ¥ᆬᄑ ̄タツ 2490 4120 8faf3019e71a44a68108ff507fc59751 f5ae0db56a6844a1-3.wav ¥ᆬᄑ¥ᆬᄑ¥ᆬᄑ¥ᆬᄑ ̄タツ待补充
提供系统参数优化设置
I has 2 class implement EslEventHandler, that is HeartbeatEslEventHandler and ReScheduleEslEventHandler. On both that EslEventHandler's subclasses include code:
@Autowired
private InboundClient inboundClient;
So, after bean IEslEventListenerTemplate initialized, method afterPropertiesSet() got only one bean of subclass EslEventHandler.
线程池未定义队列大小导致内存溢出:
link.thingscloud.freeswitch.esl.inbound.AbstractNettyInboundClient
publicExecutor = new ScheduledThreadPoolExecutor(option.publicExecutorThread(), new DefaultThreadFactory("publicExecutor", true)); privateExecutor = new ScheduledThreadPoolExecutor(option.privateExecutorThread(), new DefaultThreadFactory("privateExecutor", true));
我本地sping boot项目注入 inboundClient后,使用inboundClient.sendAsyncApiCommand("192.168.1.11:8021", originateCommand, null) 方式进行连接并提交,但是报错了,这是什么原因导致的
192.168.1.11是我freeswitch的地址,event_socket端口用的8021,我用telnet都是通的
Missing Job-UUID header in bgapi response
方便留个联系方式吗,有点freeswitch-esl的问题想请教下。
esl版本:1.6.7.RELEASE
freeswitch通过ctrl+z暂停之后,
发送异步指令会导致publicExecutor卡死,
重启freeswitch之后不会恢复,
导致不能收到正常的eslEvent。
/** {@inheritDoc} */
@Override
public void handleAuthRequest(String addr, InboundChannelHandler inboundChannelHandler) {
log.info("Auth requested[{}], sending [auth {}]", addr, "*****");
for (ServerOption serverOption : option().serverOptions()) {
String password = serverOption.password();
if (password == null) {
password = option().defaultPassword();
}
if (StringUtils.equals(addr, serverOption.addr())) {
EslMessage response = inboundChannelHandler.sendSyncSingleLineCommand("auth " + password);
log.debug("Auth response [{}]", response);
if (response.getContentType().equals(EslHeaders.Value.COMMAND_REPLY)) {
CommandResponse reply = new CommandResponse("auth " + password, response);
serverOption.state(ConnectState.AUTHED);
log.info("Auth response success={}, message=[{}]", reply.isOk(), reply.getReplyText());
if (!option().events().isEmpty()) {
StringBuilder sb = new StringBuilder();
sb.append("event plain ");
for (String event : option().events()) {
sb.append(event).append(" ");
}
setEventSubscriptions(addr, "plain", sb.toString());
}
} else {
serverOption.state(ConnectState.AUTHED_FAILED);
log.error("Bad auth response message [{}]", response);
throw new IllegalStateException("Incorrect auth response");
}
}
}
}
setEventSubscriptions(addr, "plain", sb.toString());
这句是不是有个bug呢,因为setEventSubscriptions里面的逻辑是'event ' + 'plain ' + sb.toString(),
这时会造成重复拼接,以all为例,最后出来一个event plain event plain all
。
仅看了代码,没有调试~
openjdk version "11" 2018-09-25
OpenJDK Runtime Environment 18.9 (build 11+28)
OpenJDK 64-Bit Server VM 18.9 (build 11+28, mixed mode)
CentOS Linux release 7.5.1804 (Core)
[2019-11-20 07:36:21:766] [nioEventLoopGroup-2-1] [WARN] - io.netty.channel.DefaultChannelPipeline.onUnhandledInboundException(DefaultChannelPipeline.java:1164) - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:175) ~[?:?]
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118) ~[?:?]
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317) ~[?:?]
at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:758) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:734) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:245) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PoolArena.allocate(PoolArena.java:227) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PoolArena.allocate(PoolArena.java:147) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PooledByteBufAllocator.newDirectBuffer(PooledByteBufAllocator.java:342) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:187) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.AbstractByteBufAllocator.directBuffer(AbstractByteBufAllocator.java:178) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.AbstractByteBufAllocator.ioBuffer(AbstractByteBufAllocator.java:139) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.DefaultMaxMessagesRecvByteBufAllocator$MaxMessageHandle.allocate(DefaultMaxMessagesRecvByteBufAllocator.java:114) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:147) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at java.lang.Thread.run(Thread.java:834) [?:?]
[2019-11-20 07:36:22:374] [nioEventLoopGroup-2-1] [WARN] - io.netty.channel.DefaultChannelPipeline.onUnhandledInboundException(DefaultChannelPipeline.java:1164) - An exceptionCaught() event was fired, and it reached at the tail of the pipeline. It usually means the last handler in the pipeline did not handle the exception.
java.lang.OutOfMemoryError: Direct buffer memory
at java.nio.Bits.reserveMemory(Bits.java:175) ~[?:?]
at java.nio.DirectByteBuffer.<init>(DirectByteBuffer.java:118) ~[?:?]
at java.nio.ByteBuffer.allocateDirect(ByteBuffer.java:317) ~[?:?]
at io.netty.buffer.PoolArena$DirectArena.allocateDirect(PoolArena.java:758) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PoolArena$DirectArena.newChunk(PoolArena.java:734) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PoolArena.allocateNormal(PoolArena.java:245) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PoolArena.allocate(PoolArena.java:227) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PoolArena.reallocate(PoolArena.java:397) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.PooledByteBuf.capacity(PooledByteBuf.java:119) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.AbstractByteBuf.ensureWritable0(AbstractByteBuf.java:310) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.AbstractByteBuf.ensureWritable(AbstractByteBuf.java:281) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1118) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1111) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.buffer.AbstractByteBuf.writeBytes(AbstractByteBuf.java:1102) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.handler.codec.ByteToMessageDecoder$1.cumulate(ByteToMessageDecoder.java:96) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.handler.codec.ByteToMessageDecoder.channelRead(ByteToMessageDecoder.java:281) ~[netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.AbstractChannelHandlerContext.fireChannelRead(AbstractChannelHandlerContext.java:352) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.DefaultChannelPipeline$HeadContext.channelRead(DefaultChannelPipeline.java:1422) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:374) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.AbstractChannelHandlerContext.invokeChannelRead(AbstractChannelHandlerContext.java:360) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.DefaultChannelPipeline.fireChannelRead(DefaultChannelPipeline.java:931) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.AbstractNioByteChannel$NioByteUnsafe.read(AbstractNioByteChannel.java:163) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKey(NioEventLoop.java:700) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeysOptimized(NioEventLoop.java:635) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.NioEventLoop.processSelectedKeys(NioEventLoop.java:552) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.channel.nio.NioEventLoop.run(NioEventLoop.java:514) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.util.concurrent.SingleThreadEventExecutor$6.run(SingleThreadEventExecutor.java:1044) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.util.internal.ThreadExecutorMap$2.run(ThreadExecutorMap.java:74) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at io.netty.util.concurrent.FastThreadLocalRunnable.run(FastThreadLocalRunnable.java:30) [netty-all-4.1.42.Final.jar!/:4.1.42.Final]
at java.lang.Thread.run(Thread.java:834) [?:?]
freeswitch-esl/src/main/java/link/thingscloud/freeswitch/esl/inbound/handler/InboundChannelHandler.java
public String sendAsyncCommand(final String command) {
/*
* Send synchronously to get the Job-UUID to return, the results of the actual
* job request will be returned by the server as an async event.
*/
EslMessage response = sendSyncSingleLineCommand(command);
if (isTraceEnabled) {
log.trace("sendAsyncCommand command : {}, response : {}", command, response);
}
if (response.hasHeader(EslHeaders.Name.JOB_UUID)) {
return response.getHeaderValue(EslHeaders.Name.JOB_UUID);
} else {
log.warn("sendAsyncCommand command : {}, response : {}", command, EslHelper.formatEslMessage(response));
throw new IllegalStateException("Missing Job-UUID header in bgapi response");
}
}
sendAsyncCommand 方法内部还是调用
sendSyncSingleLineCommand
的方法,这样岂不是异步调用的也是同步命令?
freeswitch不知道为啥,大概一天会断开一次连接,重新连上的时候之前监听的事件就收不到了。
我试过用ServerConnectionListener在连接连上的时候去监听,但好像这个事件发生的时候,client还没有初始化,调用监听事件会报没有权限,所以我现在是加了异步延时去弄,这个问题有其他好的办法解决吗
看了下日志,是2个不同的线程同时触发一个事件,这个可以配置吗
我的服务出现了几次事件丢失的情况,排查后发现有个onClose的日志,过了大约20秒,才重新连接上了
freeswitch esl inbound是否支持集群部署?部署多个实例,会不会重复收到消息?
单线程池调用link.thingscloud.freeswitch.esl.inbound.handler.InboundChannelHandler#sendSyncSingleLineCommand方法时,如果服务端挂了或者重启了一直收不到响应时,这个线程会一直阻塞
public EslMessage sendSyncSingleLineCommand(final String command) {
if (isTraceEnabled) {
log.trace("sendSyncSingleLineCommand command : {}", command);
}
SyncCallback callback = new SyncCallback();
syncLock.lock();
try {
syncCallbacks.add(callback);
channel.writeAndFlush(command + MESSAGE_TERMINATOR);
} finally {
syncLock.unlock();
}
return callback.get();
}
callback.get()方法一直在等待返回,link.thingscloud.freeswitch.esl.inbound.handler.InboundChannelHandler.SyncCallback中的get方法中的latch.await()这个方法是否可以设置一个等待超时
/**
* Block waiting for the countdown latch to be released, then return the
* associated response object.
*
* @return msg
*/
EslMessage get() {
try {
log.trace("awaiting latch ... ");
latch.await();
} catch (InterruptedException e) {
throw new RuntimeException(e);
}
log.trace("returning response [{}]", response);
return response;
}
@EslEventName("CUSTOM verto::login")
java配置如上监听,没有任何反应
使用@EslEventName(EventNames.ALL)注解后,没法按照预期收到所有事件
event 是否可以支持json格式?
已连接至服务端,服务端断电宕机(虚拟机关闭电影可重现)
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.