当前位置:网站首页>Freeswitch使用originate转dialplan
Freeswitch使用originate转dialplan
2022-06-28 06:20:00 【求真得真】

概述
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/[email protected] &bridge({origination_caller_id_number=8001234567}sofia/profile/[email protected])
从接口格式来看,originate接口可以使用“&”接一个APP接口,在呼叫接通之后继续处理流程,但是有时候一个APP是不够用的,这样我们就需要在“originate”之后把呼叫流程转到dialplan中继续处理。
转dialplan的接口实例。
originate {origination_caller_id_number=9005551212}sofia/default/[email protected] 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。
[email protected]> originate {originator_codec=PCMA,origination_caller_id_number=0755110}sofia/external/sip:[email protected]:5080 1001 XML ext_test
fs呼叫138服务器上的1001,呼叫接通之后,发送DTMF并播放提示语音,日志如下。
[email protected]> originate {originator_codec=PCMA,origination_caller_id_number=0755110}sofia/external/sip:[email protected]:5080 1001 XML ext_test
...
2022-06-13 11:37:15.601015 [DEBUG] sofia.c:7084 Channel sofia/external/[email protected]: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/[email protected]:5080 parsing [ext_test->test] continue=false
Dialplan: sofia/external/[email protected]:5080 Regex (PASS) [test] destination_number(1001) =~ /^(\d+)$/ break=on-false
Dialplan: sofia/external/[email protected]:5080 Action sched_hangup(+10)
Dialplan: sofia/external/[email protected]:5080 Action send_dtmf(1234)
Dialplan: sofia/external/[email protected]:5080 Action sleep(5000)
Dialplan: sofia/external/[email protected]:5080 Action endless_playback(/usr/local/freeswitch/sounds/101-baidu-mp3.mp3)
...
EXECUTE sofia/external/[email protected]:5080 sched_hangup(+10)
EXECUTE sofia/external/[email protected]:5080 send_dtmf(1234)
2022-06-13 11:37:15.610983 [DEBUG] switch_core_io.c:1918 sofia/external/[email protected]:5080 send dtmf digit=1 ms=250 samples=2000
...
EXECUTE sofia/external/[email protected]:5080 sleep(5000)
...
EXECUTE sofia/external/[email protected]: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/[email protected]:5080 hanging up, cause: ALLOTTED_TIMEOUT
总结
使用originate接口,可以直接实现呼叫转dialplan的业务流程。
仔细想一想,通过bridge转接到某一个dailplan应该也有实现的可行性。具体情况未详细深入了解。
空空如常
求真得真
边栏推荐
- Is it safe to open a stock account? How to open a stock account?
- Yygh-7-user management
- socke. IO long connection enables push, version control, and real-time active user statistics
- ThreadLocal
- Apple MDM Bypass 免越狱绕过MDM配置锁 免费
- Oracle fundamentals summary
- idea创建类时自动添加注释
- No one can only use foreach to traverse arrays, right?
- Differences between overloads, rewrites, abstract classes and interfaces
- YOLOv5增加小目标检测层
猜你喜欢

Promotion intégrale et ordre des octets de fin de taille

基于Kotlin+JetPack实现的MVVM框架的示例

Camx架构开UMD、KMD log以及dump图的方式
![Taobao seo training video course [22 lectures]](/img/81/21e844542b35010760d061abe905e9.jpg)
Taobao seo training video course [22 lectures]

Development trend of mobile advertising: Leveraging stock and fine marketing

慢内容广告:品牌增长的长线主义

YYGH-7-用户管理

FPGA - 7系列 FPGA SelectIO -09- 高级逻辑资源之IO_FIFO

JSP

What is the e-commerce conversion rate so abstract?
随机推荐
ImportError: cannot import name 'ensure_dir_exists'的可解决办法
自定义 cube-ui 弹出框dialog支持多个且多种类型的input框
阿里云短信服务(完整指南),短信发送功能实现。
YYGH-BUG-02
FPGA - 7系列 FPGA SelectIO -09- 高级逻辑资源之IO_FIFO
[staff] arpeggio mark
Idea automatically adds comments when creating classes
助力涨点 | YOLOv5结合Alpha-IoU
Integer promotion and size side byte order
使用SQL select count distinct查询语句统计数据库中某个字段的唯一值总数量
PKG package node project (express)
Apple MDM Bypass 免越狱绕过MDM配置锁 免费
Unity packaging webgl uses IIS to solve the error
报错--解决core-js/modules/es.error.cause.js报错
YYGH-BUG-02
Pre training model parameter mismatch
The length of pytorch dataloader the difference between epoch and iteration
Exception handling (I) -- null pointer and array index out of bounds
ROS rviz_satellite功能包可视化GNSS轨迹,卫星地图的使用
Independent station sellers are using the five e-mail marketing skills, do you know?