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:

  • 相关阅读:
    selenium 详解
    验证码破解
    Jupyter Notebook 安装
    分布式
    selenium +scrapy 实现网易新闻
    scrapy 反扒措施_2
    Typora简单使用
    20155215 2016-2017-2 《Java程序设计》第4周学习总结
    20155215 2016-2017-2 《Java程序设计》第3周学习总结
    20155215 2006-2007-2 《Java程序设计》第2周学习总结
  • 原文地址:https://www.cnblogs.com/chendaoyin/p/2729519.html
Copyright © 2011-2022 走看看