zoukankan      html  css  js  c++  java
  • FreeSwitch通过远程接口返回动态IVR语音菜单

    IVR语音菜单需要动态生成,找了一圈的资料,终于被自己试出来。

    第一步:修改xml_curl.conf 

    <binding name="dialplan">
    <param name="gateway-url" value="http://localhost:12569/Dialplan.ashx" bindings="dialplan"/>
    </binding>
    <binding name="ivr">
    <param name="gateway-url" value="http://localhost:12569/Ivr.ashx" bindings="ivr"/>

    </binding>   

    第二步:Ivr.ashx编码

            public void ProcessRequest(HttpContext context)
            {
                context.Response.ContentType = "text/plain";
                context.Response.Write(OutPut());
            }
            public bool IsReusable
            {
                get
                {
                    return false;
                }
            }
            public string OutPut()
            {
                var sFs = "<document type=\"freeswitch/xml\">";
                sFs = sFs + "<section name=\"configuration\">";
                sFs = sFs + "<configuration name=\"ivr.conf\" description=\"IVR menus\">";
                sFs = sFs + "<menus>";
                sFs = sFs + "<menu name=\"welcome\" ";
                sFs = sFs + "greet-long=\"custom/welcome.wav\" ";
                sFs = sFs + "greet-short=\"custom/welcom_short.wav\" ";
                sFs = sFs + "invalid-sound=\"custom/invalid.wav\" ";
                sFs = sFs + "exit-sound=\"custom/goodbye.wav\" ";
                sFs = sFs + "timeout=\"15000\" ";
                sFs = sFs + "max-failures=\"3\" ";
                sFs = sFs + "max-timeouts=\"3\" ";
                sFs = sFs + "inter-digit-timeout=\"2000\" ";
                sFs = sFs + "digit-len=\"4\">";
                sFs = sFs + "<entry action=\"menu-exec-app\" digits=\"1\" param=\"record_session::$${recordings_dir}/${caller_id_number}.${strftime(%Y-%m-%d-%H-%M-%S)}.wav\"/>";
                sFs = sFs + "</menu>";
                sFs = sFs + "</menus>";
                sFs = sFs + "</configuration>";
                sFs = sFs + "</section>";
                sFs = sFs + "</document>";
                return sFs;

            } 

    Dialplan.ashx 相关说明请看:http://www.cnblogs.com/chendaoyin/archive/2012/07/30/2615723.html  

      

    说明:今天在官方wiki查资料,显示xml_curl只能绑定4个节点

    Section names are passed to the script(s) on the webserver; currently, section names include:

  • 相关阅读:
    Ceph纠删码编码机制
    Vmware error:无法获得 VMCI 驱动程序的版本: 句柄无效。
    Virtual Box 安装过程(卸载Vmware后)
    解决安卓SDK更新dl-ssl.google.com无法连接的方法
    《中文核心期刊要目总览(2014年版)》——计算机、自动化类
    2014中国科技核心期刊(中国科技论文统计源期刊)名录——计算机类
    计算机专业方面的期刊
    Office 中的各种小tips(更新中)
    博客园添加背景音乐
    jmeter定时器
  • 原文地址:https://www.cnblogs.com/chendaoyin/p/2729519.html
Copyright © 2011-2022 走看看