Executing Asterisk speech recognition application using AsterNET.ARI

1.1k views Asked by At

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?

1

There are 1 answers

1
koyaanisqatsi On

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