`
haoningabc
  • 浏览: 1449196 次
  • 性别: Icon_minigender_1
  • 来自: 北京
社区版块
存档分类
最新评论

freeswitch的event_socket

    博客分类:
  • sip
阅读更多
event socket


A: 
nc -l -k 192.168.0.100  8040

B:
nc 192.168.0.100 8040

外连就是freeswitch代替B
内连就是freeswitch代替A

外连
dialplan/default.xml
<extension name="socket">
  <condition field="destination_number" expression="^1237$">
    <action application="socket" data="192.168.0.100:8040 async full"/>
  </condition>
</extension>


watch -n 1 'netstat -an|grep 8040'
监控nc端口

用客户端拨打1237
看端口变成 ESTABLISHED

去终端A 输入
connect 回车两下

Event-Name: CHANNEL_DATA
Core-UUID: c6699b05-fb5b-4feb-ae89-1d302ae28b21
FreeSWITCH-Hostname: bogon
FreeSWITCH-Switchname: bogon
FreeSWITCH-IPv4: 192.168.0.100
FreeSWITCH-IPv6: 2408%3A84e1%3A41%3A926d%3Af0f6%3A8a6f%3Ac0d%3A699c
Event-Date-Local: 2019-05-31%2011%3A22%3A50
Event-Date-GMT: Fri,%2031%20May%202019%2003%3A22%3A50%20GMT
Event-Date-Timestamp: 1559272970377169
Event-Calling-File: mod_event_socket.c
Event-Calling-Function: parse_command
Event-Calling-Line-Number: 2011
Event-Sequence: 829
Channel-Direction: inbound
Channel-Logical-Direction: inbound
Channel-Username: 1006
Channel-Dialplan: XML
Channel-Caller-ID-Name: 1006
Channel-Caller-ID-Number: 1006
Channel-Orig-Caller-ID-Name: 1006
Channel-Orig-Caller-ID-Number: 1006
Channel-Network-Addr: 192.168.0.101
Channel-ANI: 1006
Channel-Destination-Number: 1237




输入命令播放声音




sendmsg
call-command: execute
execute-app-name: playback
execute-app-arg: local_stream://moh
两下回车


返回
Content-Type: command/reply
Reply-Text: +OK

客户端开始播放声音



############

内连
配置 默认有
在 autoload_configs/event_socket.conf.xml里面
打开注释apply-inbound-acl ,value改成成lan
和修改ip
不改会报错:[WARNING] mod_event_socket.c:2641 IP 172.18.1.112 Rejected by acl "loopback.auto"
<configuration name="event_socket.conf" description="Socket Client">
  <settings>
    <param name="nat-map" value="false"/>
    <!--<param name="listen-ip" value="::"/>-->
    <param name="listen-ip" value="192.168.0.100"/>
    <param name="listen-port" value="8021"/>
    <param name="password" value="ClueCon"/>
    <!--<param name="apply-inbound-acl" value="loopback.auto"/>-->
    <param name="apply-inbound-acl" value="lan"/>
    <!--<param name="stop-on-bind-error" value="true"/>-->
  </settings>
</configuration>

端口为8021

所以用
#nc 192.168.0.100 8021
nc localhost 8021

auth ClueCon 两下回车

源码里的testclient.c

freeswitch/libs/esl/下的
#include <stdio.h>
#include <stdlib.h>
#include <esl.h>


int main(void)
{
    esl_handle_t handle = {{0}};

    esl_connect(&handle, "192.168.0.100", 8021, NULL, "ClueCon");

    esl_send_recv(&handle, "api status\n\n");

    if (handle.last_sr_event && handle.last_sr_event->body) {
        printf("%s\n", handle.last_sr_event->body);
    } else {
        // this is unlikely to happen with api or bgapi (which is hardcoded above) but prefix but may be true for other commands
        printf("%s\n", handle.last_sr_reply);
    }

    esl_disconnect(&handle);

    return 0;
}


   
#########

/opt/meituan/sip/freeswitch/libs/esl# make
生成.lib/libesl.a

FSDG-code/chapter19/myesl$ make

######

open -a /Applications/Google\ Chrome.app
open  "http://www.baidu.com"
分享到:
评论

相关推荐

    FreeSwitch的event_socket模块分析

    mod_event_socket以socket的形式,对外提供控制FS一种途径,缺省的IP是127.0.0.1,TCP端口是8021。可以在外部通过sokcet执行API/APP命令。配置文件是conf/autoload_configs/modules.conf.xml,连接分两种模式: ...

    freeswitch-eventsocket:这是一个正在进行的抽象类,用于处理 freeswitch 的 eventsocket 命令行

    自由切换事件套接字这是一个正在进行的抽象类,用于处理 freeswitch 的 eventsocket 命令行。 目前只实现了入站服务器。安装..代码块:: bash pip 安装 freeswitch-eventsocketTornado 的 IOLoop 下的实现下面是下的...

    go-eventsocket, 面向go编程语言的FreeSWITCH事件套接字库.zip

    go-eventsocket, 面向go编程语言的FreeSWITCH事件套接字库 eventsocketFreeSWITCH 事件套接字 程序语言库。它支持入站和出站事件套接字连接,充当连接FreeSWITCH或者接受来自FreeSWITCH的连接以控制调用调用的客户端...

    freeswitch

    Java ESL调用FreeSWITCH发起呼叫 ... 修改D:\VS\freeswitch-1.6.19\Win32\Debug\conf\autoload_configs\event_socket.conf.xml文件 所依赖包:JAVA调用FreeSWITCH: 需要Jar包:org.freeswitch.esl.client-0.9.2.jar

    NetFreeSwitch.Framework-master.zip

    This framework helps interact with the FreeSwitch via its mod_event_socket. For more information about the mod_event_socket refer to FreeSwitch web site. It is fully asynchronous. Also it offers more ...

    eventsocket:FreeSWITCH事件套接字的扭曲协议

    eventsocket是FreeSWITCH的事件套接字的扭曲协议。 该协议在单个文件类中同时支持事件套接字的入站和出站方法。 它可以用于各种各样的目的。 它的目标是简单和可扩展,并将FreeSWITCH的所有功能导出到基于Twisted的...

    freeswitch的esl控制方式demo

    freeswitch除了xml控制方式除外还支持eventsocket控制方式,本资源提供了eventsocket控制方式的demo

    FreeSwitchJavaEventLogger:用于记录 FreeSwitch 服务器套接字的所有事件的 Java 应用程序

    否则,要允许来自网络上任何主机的连接,请在 /freeswitch/conf/autoload_configs/event_socket.conf.xml 文件中使用 0.0.0.0 而不是默认的 127.0.0.1。 运行 Java 记录器: 此应用程序是在 Windows Eclipse IDE ...

    C#连接FreeSwitch执行一些操作操作例子

    C#环境下连接,操作FreeSwitch的例子,完全开源 如有改进意见请邮件或QQ联系: Email:hotzenplotz@163.com QQ:1969630628

    freeswitch-esl-all:基于netty 4的freeswitch事件套接字,并具有一些新功能

    FreeSWITCH ESL ALL目标1、支持连接FreeSWITCH大规模集群2、更易于集成使用4、与spring boot 2.3.x深度整合,提供 starter5、可动态配置模块说明1.freeswitch esl 客户端(详细信息,移步至子模块)2.基于 freeswitch...

    FreeSWITCH.1.6.Cookbook.17852809

    Control FreeSWITCH remotely with the powerful event socket interface Route inbound and outbound calls Insert CDRs into a database Enable text-to-speech in your voice applications Set up SSL ...

    FreeSWITCH Cookbook

    Control FreeSWITCH remotely with the powerful event socket interface Route inbound and outbound calls Handle call detail records, which includes inserting CDRs into a database Enable text-to-speech ...

    FreeSWITCH VoIP 实战

    第一章 PSTN 与 VoIP 第二章 初识 FreeSWITCH 第三章 PSTN 与 PBX 服务 第四章 SIP 协议 第五章 FreeSWITCH 架构 第六章 运 行 FreeSWITCH 第七章 SIP 模块 - mod_...Event Socket FreeSWITCH 实战

    java通过ESL连接Freeswitch,实现基本的音视频通话(通过指令实现主叫A与被叫B之间的互联互通)

    使用Java通过ESL(Event Socket Library)连接FreeSWITCH实现基本的音视频通话功能,主要实现以下核心功能: 1. 连接管理:Java应用程序能够与FreeSWITCH服务器建立稳定的ESL连接,允许双方进行实时通信。连接过程...

    esl-client:来自http的叉子

    客户端 esl-client是项目的基于Java的事件套接字库。...import org.freeswitch.esl.client.internal.IModEslApi.EventFormat ; import org.freeswitch.esl.client.outbound.Context ; import org.freeswitch.e

    PySWITCH-开源

    与FreeSWITCH进行通信的Twisted协议PySWITCH是Twisted Python库,允许您使用入站和出站EventSocket连接与FreeSWITCH进行通信。

Global site tag (gtag.js) - Google Analytics