简体   繁体   中英

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.

Currently everything is configured and stasis application connects and receives events:

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)

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).

How can I do this correctly?

To make the RTP audio streams ready for use ( open it ) i recommended not to use...

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

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

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