Freeswitch使用originate转dialplan

概述
Freeswitch是一款非常好用的开源VOIP软交换平台。
最近在对fs做一些功能测试,测试的过程中产生的一个需求,如何从fs发起呼叫并把后续的呼叫流程转到某一个dialplan上,这样在测试时会非常方便好用,可以随时修改dialplan定制业务流程。
通过对fs官方文档搜索后,排除了“transfer”、“execute_extension”、“bind_meta_app”,偶然发现“originate”接口可以直接实现这样的功能需求。
环境
centos:CentOS release 7.0 (Final)或以上版本
freeswitch:v1.8.7
GCC:4.8.5
originate
originate是一个API接口,接口格式如下。
originate <call url> <exten>|&<application_name>(<app_args>) [<dialplan>] [<context>] [<cid_name>] [<cid_num>] [<timeout_sec>]
接口实例。
originate {origination_caller_id_number=9005551212}sofia/default/whatever@wherever &bridge({origination_caller_id_number=8001234567}sofia/profile/someother@destination.com)
从接口格式来看,originate接口可以使用“&”接一个APP接口,在呼叫接通之后继续处理流程,但是有时候一个APP是不够用的,这样我们就需要在“originate”之后把呼叫流程转到dialplan中继续处理。
转dialplan的接口实例。
originate {origination_caller_id_number=9005551212}sofia/default/whatever@wherever 19005551212 XML default CALLER_ID_NAME CALLER_ID_NUMBER
这个实例中,使用originate接口发起呼叫,然后转到XML类型的拨号计划“default”中。
配置
修改配置文件“/usr/local/freeswitch/conf/dialplan/test.xml”。
<include>
<context name="ext_test">
<extension name="test" continue="false">
<condition field="destination_number" expression="^(\d+)$">
<action application="sched_hangup" data="+10"/>
<action application="send_dtmf" data="1234"/>
<action application="sleep" data="5000"/>
<action application="endless_playback" data="/usr/local/freeswitch/sounds/101-baidu-mp3.mp3"/>
</condition>
</extension>
</context>
</include>
测试
在freeswitch命令行中使用originate发起呼叫,再转到拨号计划ext_test发送DTMF。
freeswitch@localhost.localdomain> originate {originator_codec=PCMA,origination_caller_id_number=0755110}sofia/external/sip:1001@10.55.55.138:5080 1001 XML ext_test
fs呼叫138服务器上的1001,呼叫接通之后,发送DTMF并播放提示语音,日志如下。
freeswitch@localhost.localdomain> originate {originator_codec=PCMA,origination_caller_id_number=0755110}sofia/external/sip:1001@10.55.55.138:5080 1001 XML ext_test
...
2022-06-13 11:37:15.601015 [DEBUG] sofia.c:7084 Channel sofia/external/1001@10.55.55.138:5080 entering state [ready][200]
...
2022-06-13 11:37:15.610983 [INFO] mod_dialplan_xml.c:637 Processing <0755110>->1001 in context ext_test
Dialplan: sofia/external/1001@10.55.55.138:5080 parsing [ext_test->test] continue=false
Dialplan: sofia/external/1001@10.55.55.138:5080 Regex (PASS) [test] destination_number(1001) =~ /^(\d+)$/ break=on-false
Dialplan: sofia/external/1001@10.55.55.138:5080 Action sched_hangup(+10)
Dialplan: sofia/external/1001@10.55.55.138:5080 Action send_dtmf(1234)
Dialplan: sofia/external/1001@10.55.55.138:5080 Action sleep(5000)
Dialplan: sofia/external/1001@10.55.55.138:5080 Action endless_playback(/usr/local/freeswitch/sounds/101-baidu-mp3.mp3)
...
EXECUTE sofia/external/1001@10.55.55.138:5080 sched_hangup(+10)
EXECUTE sofia/external/1001@10.55.55.138:5080 send_dtmf(1234)
2022-06-13 11:37:15.610983 [DEBUG] switch_core_io.c:1918 sofia/external/1001@10.55.55.138:5080 send dtmf digit=1 ms=250 samples=2000
...
EXECUTE sofia/external/1001@10.55.55.138:5080 sleep(5000)
...
EXECUTE sofia/external/1001@10.55.55.138:5080 endless_playback(/usr/local/freeswitch/sounds/101-baidu-mp3.mp3)
...
2022-06-13 11:37:25.121013 [DEBUG] switch_ivr_play_say.c:1942 done playing file /usr/local/freeswitch/sounds/101-baidu-mp3.mp3
...
2022-06-13 11:37:25.121013 [DEBUG] mod_sofia.c:440 Channel sofia/external/1001@10.55.55.138:5080 hanging up, cause: ALLOTTED_TIMEOUT
总结
使用originate接口,可以直接实现呼叫转dialplan的业务流程。
仔细想一想,通过bridge转接到某一个dailplan应该也有实现的可行性。具体情况未详细深入了解。
空空如常
求真得真
Freeswitch使用originate转dialplan的更多相关文章
- FreeSWITCH 学习笔记
[1]FreeSWITCH学习笔记 1.Windows安装包下载地址:http://files.freeswitch.org/windows/installer/ 2.源码下载地址:http://fi ...
- 认识拨号计划-dialplan
拨号计划是 FreeSWITCH 中至关重要的一部分.它的主要作用就是对电话进行路由(从这一点上来说,相当于一个路由表).说的简明一点,就是当一个用户拨号时,对用户所拨的号码进行分析,进而决定下一步该 ...
- fs event_socket
mod_event_socket Skip to end of metadata Created by John Boteler, last modified by Niek Vlesse ...
- FreeSWITCH 内线拨号 总是使用 dialplan/public 拨号计划,而对 dialplan/default 视而不见
FreeSWITCH 内线拨号 总是使用 dialplan/public 拨号计划,而对 dialplan/default 视而不见 昨天还是 好好的额, 今天 就这样了, 导致 配置都乱了, 搞了 ...
- freeswitch dialplan 基础
freeswitch dialplan 基础 一.基础概念 dialplan 拨号方案 context 拨号表(块) extension 拨号去向 action (拨号后执行的)动作 condit ...
- Freeswitch录音Dialplan
<extension name="record"> <condition field="destination_number" express ...
- freeswitch模块之event_socket
这是我之前整理的关于freeswitch mod_event_socket的相关内容,这里记录下,也方便我以后查阅. mod_event_socket以socket的形式,对外提供控制FS一种途径, ...
- FreeSWITCH 1.2.5.3 Step by Step Install
Ubuntu: apt-get -y install build-essential automake autoconf git-core wget libtool apt-get -y instal ...
- FreeSwitch 终端命令详细介绍
FreeSwitch版本:1.6.9 以下为部分终端命令 alias 语法: alias [add|stickyadd] <alias> <command> | del [&l ...
随机推荐
- PicCompress —— 一款精简的图片压缩工具
PicCompress 说明 之前上传博客图片过大不方便加载,还有一些微信平台的图片无法上传有大小限制,于是就打算开发个压缩图片的工具 支持图片格式 PNG(.png) JPEG(.jpg, .jpe ...
- Java学习day39
类加载的作用:将class文件字节码内容加载到内存中,并将这些静态数据转换成方法区的运行时数据结构,然后在堆中生成一个代表这个类的java.lang.Class对象,作为方法区中类数据的访问入口. 类 ...
- 原生js 复选框全选案例
注 : 本文章主要写功能 代码示例 : <body> <input type="checkbox" id="che" /><br& ...
- mosquitto服务器的安装以及mqtt.fx软件的使用
一.MQTT描述 MQTT 全称为 Message Queuing Telemetry Transport(消息队列遥测传输)是一种基于发布/订阅范式的"轻量级"消息协议,由 IB ...
- JavaScript一行代码获取公网IP及城市信息
废话不多说,直接上代码! <script type="text/javascript" src="http://pv.sohu.com/cityjson?ie=ut ...
- PDCA循环——快速提升软件质量的必备工具
近年来,软件项目的规模及其复杂性正在以空前的速度增长,互联网用户市场庞大,互联网公司和相应的软件产品层出不穷.快速响应需求变化往往是互联网行业的常态,软件产品的快速开发迭代对于公司迅速占领市场.抢占商 ...
- Bugku练习题---Web---计算器
Bugku练习题---Web---计算器 flag:flag{8b4b2f83db2992d17d770be1db965147} 解题步骤: 1.观察题目,打开场景 2.场景打开后发现是一个验证码界面 ...
- nginx + nginx-rtmp-module搭建直播流服务器实现推流实时直播功能
业务需求 最近公司在做养老相关的业务,现在需要子女从小程序端对家里的老人通过家庭终端交互屏进行实时看护. 解决方案 第三方的一些现成的服务:腾讯音视频通话.直播功能; 阿里的音视频通信;两者都挺好的, ...
- 【论文笔记】A review of applications in federated learning(综述)
A review of applications in federated learning Authors Li Li, Yuxi Fan, Mike Tse, Kuo-Yi Lin Keyword ...
- 干货|Linux平台搭建网关服务器
概述 集群中一共10台服务器组成了局域网环境,但其中只有一台有外网网卡可以访问互联网.现要求另外9台服务器通过这台主机进行互联网访问. 实验环境介绍 利用iptables搭建网关服务器,即通过SNA ...