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

  • 相关阅读:
    设计模式-装饰器模式
    自定义 RestTemplate 异常处理 (转)
    Jackson 高级应用
    Jackson 的 基本用法
    Jackson转换为Collection、Array
    Jackson中处理map中的null key 或者null value 及实体字段中的null value
    sed
    MySQL server has gone away 异常
    nl命令
    线程池
  • 原文地址:https://www.cnblogs.com/jifeng/p/13194213.html
Copyright © 2011-2022 走看看