简体   繁体   English

使用 AsterNET.ARI 执行 Asterisk 语音识别应用程序

[英]Executing Asterisk speech recognition application using AsterNET.ARI

I have a sample dialplan:我有一个示例拨号计划:

exten => 1,1,Wait(1)
exten => 1,n,SpeechCreate
exten => 1,n,SpeechBackground(beep)
exten => 1,n,Verbose(0, ${SPEECH_TEXT(0)})
exten => 1,n,Hangup() 

And I need to execute speech recognition using ARI stasis application and get recognition result in this application using AsterNET.ARI library.我需要使用 ARI stasis 应用程序执行语音识别,并使用 AsterNET.ARI 库在此应用程序中获得识别结果。

Currently everything is configured and stasis application connects and receives events:目前一切都已配置,stasis 应用程序连接并接收事件:

static async void c_OnStasisStartEvent(IAriClient sender, StasisStartEvent e)
{
    // Answer the channel
    await sender.Channels.AnswerAsync(e.Channel.Id);

    // Play an announcement
    await sender.Channels.PlayAsync(e.Channel.Id, "sound:hello-world");
}

But I don't know how to call an extension application.但我不知道如何调用扩展应用程序。 For example this dialplan string: exten => 1,n,SpeechBackground(beep)例如这个拨号方案字符串: exten => 1,n,SpeechBackground(beep)

I tried something like this:我试过这样的事情:

var endpoints = sender.Endpoints.List();
await sender.Channels.OriginateAsync(endpoints[0].Resource, "1,n,BackGround(hello-world)");

But it results in exception: Response status code does not indicate success: 400 (Bad Request).但它导致异常: Response status code does not indicate success: 400 (Bad Request).

How can I do this correctly?我怎样才能正确地做到这一点?

To make the RTP audio streams ready for use ( open it ) i recommended not to use...为了使 RTP 音频流准备好使用(打开它),我建议不要使用...

exten => 1,1,Wait(1)

...try... ...尝试...

exten => 1,1,Answer(1000)

...instead. ...反而。

Read: https://wiki.asterisk.org/wiki/display/AST/Answer%2C+Playback%2C+and+Hangup+Applications阅读: https : //wiki.asterisk.org/wiki/display/AST/Answer%2C+Playback%2C+and+Hangup+Applications

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM