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左右,有识别,但是播放音频有问题


免责声明!

本站转载的文章为个人学习借鉴使用,本站对版权不负任何法律责任。如果侵犯了您的隐私权益,请联系本站邮箱yoyou2525@163.com删除。



 
粤ICP备18138465号  © 2018-2025 CODEPRJ.COM