ASR(Automatic Speech Recognition)自动语音识别技术是一种将人的语音转换为文本的技术。
一、freeswitch如何使用asr
freeswitch提供两个app功能detect_speech和play_and_detect_speech给用户调用,detect_speech是异步的,play_and_detect_speech是同步的。
1、detect_speech
1.1语法:detect_speech <mod_name> <gram_name> <name> <dest>
detect_speech stop
mod_name: 识别模块名称 如ali_asr[:params],其中params是param1=value1,param2=value2类型格式传入到switch_asr_interface_t接口中asr_open接口函数
gram_name:switch_asr_interface_t接口中asr_load_grammar接口函数传入参数
name: switch_asr_interface_t接口中asr_load_grammar接口函数传入参数
dest:switch_asr_interface_t接口中asr_open接口函数传入参数
stop:停止识别
1.2识别事件:设置通道变量fire_asr_events为true。freeswitch会触发SWITCH_EVENT_DETECTED_SPEECH事件返回给事件回调函数。
1.2.1事件头Speech-Type:
begin-speaking:检测到用户说话
detected-speech:识别结果
closed:识别关闭
1.2.2 事件body