zoukankan      html  css  js  c++  java
  • 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左右,有识别,但是播放音频有问题

  • 相关阅读:
    Java基础之Comparable与Comparator
    Java基础之访问权限控制
    Java基础之抽象类与接口
    Java基础之多态和泛型浅析
    Spring MVC入门
    Spring框架之事务管理
    伸展树(Splay Tree)进阶
    2018牛客网暑期ACM多校训练营(第三场) A
    2018牛客网暑期ACM多校训练营(第三场) H
    HDU 6312
  • 原文地址:https://www.cnblogs.com/jifeng/p/13194213.html
Copyright © 2011-2022 走看看