How/where should I convert a 8khz incoming audio to 16khz audio for MRCP plugin in Asterisk/UniMRCP setup?

What I am trying to do:

I am trying to connect Asterisk to a custom unimrcp plugin for doing ASR. The ASR service can accept only 16khz data and cannot be changed.

Where I am as of now:

In asterisk-> pjsip.conf, if I configure a 16khz codec (like G722), then my Plugin, ASR service etc. receive the data correctly and I’ve been able to get it working end to end via Zoiper(Desktop app).

However, I am not able to get it working for an 8khz codec like ulaw or alaw.

What I want to understand?

If I want to support 8khz audio, where should the conversion to 16khz audio happen?

  • Option A : Is it possible to convert the data from a 8khz codec to 16khz codec within asterisk itself so that UniMRCP plugin always receives data in 16khz format?
  • Option B : Should it be done in the UniMRCP plugin that I am writing so that my plugin supports both 16khz and 8khz data?

Also, for whichever option you suggest, can you please share some references on how to get started with it? I’ve tried implementing Option B using ffmpeg to convert the MRCP data stream to the required format, but couldn’t understand much to get a sample working.

You can do it either way. I have no reference, but Asterisk provides a translation path system to do transcoding of Asterisk frames[1].

[1] https://github.com/asterisk/asterisk/blob/master/include/asterisk/translate.h

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.