Wednesday, May 20, 2009

Asterisk MRCP module

Once I decided to integrate MRCP with Asterisk, I considered the following approaches.

1. Use the default unimrcpclient. Save the wave file from asterisk, use unimrcpclient to send the wav file to the MRCP server and get the recognition done.
This had various problems.Scalability, ability to integrate with asterisk etc. Most importantly, barge in cannot be supported. So I decided to directly integrate with asterisk.
2. Implement the Speech API for asterisk. This would have been the best solution. But it would be applicable only to speech recognition. I wanted Asterisk integration with MRCP.
3. Implement an asterisk MRCP module. This was the approach I finalized on as it would allow me access to both Asterisk and Unimrcp libraries.

Building a module turned out to be harder than I thought :). I had to understand the code base of Asterisk and Unimrcp. But luckily, both were very well written pieces of code and I could understand their structure. Here I would like to mention the support given by Arsen of Unimrcp. Without his help it would not have been possible.

Finally I built an Asterisk module which could directly take the audio data from asterisk and send it to the ASR server and I was really surprised by the speed of the recognition. As soon as the user finished speaking the recognizer returned a result immediately. I was able to acieve barge in functionality too.

I tested this one with telisma speech server and it worked very well. There were one or two configuration issues. In unimrcpclient.xml I had to use "ASR" instead of "media" for the telisma server to work. Mainly, for any new MRCP server the following process works.

1. Try to setup demo unimrcpclient. If that works with the MRCP server, then the asterisk module should work.
2. Setup trial dial plan in Asterisk and load the module and do a trial call.

You can details of the implementation at http://www.voip-info.org/wiki/view/Asterisk+cmd+MRCPSpeech