User-Profile-Image
hankin
  • 5
  • centos7
  • docker
  • mysql
  • PostgreSQL
  • git/gitlab
  • ELK
  • python
    • python-Tornado
    • python-django
  • redis
  • nginx
  • kvm
  • proxmox
  • mongo
  • kubernetes
  • prometheus
  • GlusterFs
  • nfs
  • freeswitch
  • httpd
  • shell脚本
  • linux
  • fastdfs
  • nextcloud
  • openssl
  • openvpn
  • rabbitmq
  • sqlite
  • svn
  • java
  • ubuntu
  • vue2
  • wordpress
  • php
  • IOT物联网
  • 项目
  • 故障处理
  • 树莓派
  • 博客存档
  • 未分类
  • 杂项
  • #1742(无标题)
  • 新视野
  • 分类
    • 项目
    • 树莓派
    • 杂项
    • 未分类
    • 新视野
    • 故障处理
    • 博客存档
    • 交换机
    • wordpress
    • vue2
    • ubuntu
    • svn
    • sqlite
    • shell脚本
    • redis
    • rabbitmq
    • python-django
    • python
    • proxmox
    • prometheus
    • PostgreSQL
    • php
    • openvpn
    • openssl
    • nginx
    • nfs
    • nextcloud
    • mysql
    • mongo
    • linux
    • kvm
    • kubernetes
    • java
    • IOT物联网
    • httpd
    • GlusterFs
    • git/gitlab
    • freeswitch
    • fastdfs
    • ELK
    • docker
    • centos7
  • 页面
    • #1742(无标题)
  • 友链
      请到[后台->主题设置->友情链接]中设置。
Help?

Please contact us on our email for need any support

Support
    首页   ›   freeswitch   ›   正文
freeswitch

freeswitch根据呼叫结果播放提示音

2023-01-16 11:13:21
1533  0 0

freeswitch针对不同的返回状态播放提示音
freeswitch呼叫未接通返回状态播放提示音

需求
部分线路没有返回正确的提示音或没有,但是又需要根据状态码播放一个提示音
准备提示音
将提示音上传到服务器,freeswitch默认要求是wav格式,8khz
修改拨号计划

<?xml version="1.0" encoding="utf-8"?>
<!-- http://wiki.freeswitch.org/wiki/Dialplan_XML -->
<include>
  <context name="inter1">

<!--未接一声提示-->
<extension name="gejin">
        <condition field="destination_number" expression="^(\d{8})$"/>
            <condition field="caller_id_number" expression="^1\d{2}$">
                <action application="set" data="continue_on_fail=true"/>
                <action application="set" data="effective_caller_id_name=${caller_id_name}"/>
                <action application="set" data="effective_caller_id_number=${caller_id_name}${caller_id_number}"/>
              <action application="bridge" data="{absolute_codec_string='PCMA'}sofia/xxx/${destination_number}@ip:port"/>
                <action application="transfer" data="play-cause-${bridge_hangup_cause}"/>
                <action application="hangup"/>
            </condition>
</extension>

<!--提示音-->
<extension name="Local_Extension_play-cause">
      <!--condition field="destination_number" expression="^play-cause(.*)$"-->
      <condition field="destination_number" expression="^play-cause-RECOVERY_ON_TIMER_EXPIRE">
                <action application="playback" data="/du.wav"/>
      </condition>
</extension>

  </context>
</include>
其中bridge_hangup_cause是捕获到的落地返回的结束原因,设置后f6,呼叫测试可在控制查看到具体的值。
然后将该值例如RECOVERY_ON_TIMER_EXPIRE,写入提示音。
捕获到RECOVERY_ON_TIMER_EXPIRE状态,freeswitch将会返回/du.wav给主叫。
测试
测试正常的话,将会在RECOVERY_ON_TIMER_EXPIRE状态后播放/du.wav提示音。
其他方案
<!未接一声提示-->
<extension name="gejin">
     <condition field="caller_id_name" expression="123"/>
            <condition field="caller_id_number" expression="^1\d{10}$">
        <action application="set" data="hangup_after_bridge=true"/>
                <action application="set" data="continue_on_fail=RECOVERY_ON_TIMER_EXPIRE"/>
              <action application="bridge" data="{absolute_codec_string='PCMA'}sofia/xxx/${destination_number}@ip:port"/>
        <action application="playback" data="/opt/freeswitch/etc/freeswitch/du.wav"/>
                <action application="hangup"/>
            </condition>
</extension>

其中RECOVERY_ON_TIMER_EXPIRE也是根据实际呼叫测试找到落地返回的状态
评论 (0)

点击这里取消回复。

欢迎您 游客  

Copyright © 2025 网站备案号 : 蜀ICP备2022017747号
smarty_hankin 主题. Designed by hankin
主页
页面
  • #1742(无标题)
博主
tang.show
tang.show 管理员
linux、centos、docker 、k8s、mysql等技术相关的总结文档
213 文章 2 评论 201912 浏览
测试
测试