• freeswitch自动接听(用于测试asr识别)


    拨号计划:

             <extension name="auto1">
                  <condition field="destination_number" expression="^(4001)$">
    
                    <action application="set" data="robotring=${sounds_dir}/musics/萨克斯-回家-铃声.wav"/>
                    <action application="set" data="called_number=$1"/>
                    <action application="set" data="call_uuid=${uuid}"/>
                    <action application="lua" data="call_robot.lua ${caller_id_number} ${called_number} ${call_uuid} ${robotring}"/>
                  </condition>
             </extension>
    
    cat ../../scripts/call_robot.lua 
    -- call_robot.lua
    
    session:answer();
    
    local caller_number = argv[1];     --主叫号码
    local called_number = argv[2];     --被叫号码
    local robotring = argv[3]; 
    --通话的唯一标识
    math.randomseed(tostring(os.time()):reverse():sub(1,7))
    local callUserId = math.random(100000000000) 
    --time
    local begintime = os.date("%Y%m%d%H%M%S")  ;
    
    -- 播放音频
    -- session:streamFile(robotring); 
    
    
    if (session:ready()) then
        -- Line is live, start talking
        -- session:flushDigits();
    
        session:execute("detect_speech", "unimrcp {sid="..callUserId..",caller_number="..caller_number..",called_number="..called_number..",begintime="..begintime..",role=0}hello default")
        session:execute( "playback" , "robot.wav");
    end
    
    session:hangup()
    

      能通话30s左右,有识别,但是播放音频有问题

  • 相关阅读:
    避免Node.js中回调地狱
    XSS和CSRF攻击
    浅析SPDY
    移动端的图片优化
    js中的事件委托技术
    js的5种继承方式——前端面试
    深入理解前端跨域问题的解决方案——前端面试
    javascript中“use strict”的好处和坏处
    Http请求中POST与GET的区别——前端面试
    滚动条离底部的距离小于某个值
  • 原文地址:https://www.cnblogs.com/jifeng/p/13194213.html
Copyright © 2020-2023  润新知