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 ...
随机推荐
- zookeeper面试1-9
1.选举机制 SID:服务器ID.用来唯一标识一台ZooKeeper集群中的机器,每台机器不能重复,和myid一致. ZXID:事务ID.ZXID是一个事务ID,用来标识一次服务器状态的变更.在某一时 ...
- Java学习day12
Set集合特点:不能包含重复的元素:没有所有的方法,不能通过普通的for循环遍历集合 哈希值是JDK根据对象的地址或者字符串或者数字算出来的int类型的数值,同一个对象多次调用hashCode()方法 ...
- golang-grpc
目录 1. 什么是grpc和protobuf 1.1 grpc 1.2 protobuf 2.go下grpc 2.1官网下载protobuf工具 2.2 下载go的依赖包 2.3 编写proto文件 ...
- Maven中央仓库地址大全
1.默认的Maven中央仓库 在Maven安装目录下,找到:/lib/maven-model-builder-${version}.jar 打开该文件,能找到超级POM:\org\apache\ma ...
- Go汇编语法和MatrixOne使用介绍
目录 MatrixOne数据库是什么? Go汇编介绍 为什么使用Go汇编? 为什么不用CGO? Go汇编语法特点 操作数顺序 寄存器宽度标识 函数调用约定 对写Go汇编代码有帮助的工具 avo tex ...
- 技术管理进阶——一线Leader与大Leader的差异是什么?
原创不易,求分享.求一键三连 前几年,因为下属的一些骚操作,Leader对我产生了误会,这导致了一些"不信任",这种不信任在短时间会让人丧失安全感,很多人会因此患得患失. 这种 ...
- FreeRTOS --(5)内存管理 heap4
FreeRTOS 中的 heap 4 内存管理,可以算是 heap 2 的增强版本,在 <FreeRTOS --(3)内存管理 heap2>中,我们可以看到,每次内存分配后都会产生一个内存 ...
- python数据可视化-matplotlib入门(5)-饼图和堆叠图
饼图常用于统计学模块,画饼图用到的方法为:pie( ) 一.pie()函数用来绘制饼图 pie(x, explode=None, labels=None, colors=None, autopct=N ...
- GDB调试小白教程
1.GDB是什么? 想必很多人都用过windows下各种编译器软件的调试功能,例如Visio Studio里面"断点"."开始调试"."逐语句&quo ...
- MySQL体系结构与数据类型
layout: post title: "MySQL体系结构与数据类型" date: 2018-02-26 categories: MySQL tags: MySQL 一.MySQ ...