ladendirekt / pjsip4net

A wrapper library exposing the pjsip library to the .NET world in a OO-friendly way.
71 stars 42 forks source link

How to get the audio stream during a real-time conversation? #109

Open 298029lkk opened 4 years ago

298029lkk commented 4 years ago

I want to get the voice of the other party in a stream. Is there any good advice?

siniypin commented 4 years ago

Hello,

you can do so by plugging your own sound port implementation to the conference bridge, more info here:

https://github.com/siniypin/pjsip4net/issues/77

P.S. If you end up developing one it would be really great if you could share it with everyone.

298029lkk commented 4 years ago

@siniypin Thank you for your reply. According to your suggestion, is it necessary to modify the source code of pjsip?

siniypin commented 4 years ago

No, you don't need to modify pjsip, but you certainly need to plug into pjsip audio pipeline using the above mentioned tricks.

siniypin commented 4 years ago

One hack I can think of that wouldn't require pjsip integration is to stream audio to a file while simultaneously reading from the very same file. Never tried it, not even sure it is going to work for you.

298029lkk commented 4 years ago

Thank you for your support. I want to get the other party's audio in real time after the phone is dialed in, then intelligently recognize and get the answer, and then send it to the user. Instead of a person speaking at the end of the phone. This is what I want to achieve now. The key point is that I can't handle the acquisition and sending of audio.

siniypin commented 4 years ago

Well, you've got these two options. You can route an audio stream to a file with pjsip4net using a DSL builder method

298029lkk commented 4 years ago

Ok, thank you very much. But I think the second way can't achieve my purpose. Because I want a real-time conversation and a real-time answer. Instead of processing the recording file after the conversation is completed. So should I use the first way? Where should the first way handle? Also, if I have an audio stream answer now, how do I send it to the other party?

siniypin commented 4 years ago

I don't get what you aim for. It all sounds like you want to establish a common bi-directional call. pjsip4net does exactly that out of the box.