I am trying to obtain an audio stream from call audio media to be able to send it to Speech-to-Text engine (to transcribe audio from streaming input). Any idea on how to achieve this?
Version info: pjlib 2.8-svn for POSIX
Thank you in advance.
I am trying to obtain an audio stream from call audio media to be able to send it to Speech-to-Text engine (to transcribe audio from streaming input). Any idea on how to achieve this?
Version info: pjlib 2.8-svn for POSIX
Thank you in advance.
I found a suggestion from the pjsip FAQ: https://trac.pjsip.org/repos/wiki/FAQ#audio-man
You can get real-time audio media by creating a new port, and find helpful information in mem_capture.c
and wav_writer.c
:
For sink only media ports, samples include:
mem_capture.c
from pjmedia (media port to save audio to a buffer).wav_writer.c
from pjmedia (media port to save audio to a WAVE file).using getAudioMedia() in onCallMediaState of Call class, we can get the AudioMedia of call, something like that(simple method in C++):
void SipCall::onCallMediaState(OnCallMediaStateParam &prm) {
this->callInfo = getInfo();
unsigned media_size = this->callInfo.media.size();
for (unsigned i = 0; i < media_size; i++) { // ci.media.size()
AudioMedia audioMedia = getAudioMedia(i);
// do somthing with audio Media
// example send to audio device:
// AudDevManager& manager = Endpoint::instance().audDevManager();
// audioMedia.startTransmit(manager.getPlaybackDevMedia());
// do something....
}
}
Sorry, but i hope it can help something.