Speech Recognization in asterisk


I am implementing one application which can detect the voice input given by customer and do the task according to that.

My requirement is to detect the voice in between prompt. I am able to do it by “BackgroundDetect” function. Which is mentioned below.

exten => 9899,1,Answer();
exten => 9899,n,wait(5);
exten => 9899,n,BackgroundDetect(Welcome_Customer,0,100)
exten => talk,1,Record(message:wav,,,q)
exten => talk,2,Playback(message)

When the user will say something asterisk will detect that voice and jump to talk extension. Now my problem is that i am getting lose in recorded file as asterisk is taking 20-30 ms to jump BackgroundDetect to talk extension.

Case :
–> Suppose customer say ‘yes good morning’.
In this case i am not able to record whole sentence. ‘Yes’ is getting lost.

And one another issue is that in some cases asterisk is not able to detect the voice even if the intensity is too high.

How can i resolve this issue? Please suggest me.

I am thinking to change in the c code of asterisk where this all application are defined. But it will take lot of time so i am giving it as second priority.

Please reply.

Jayesh Dhandha