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