_______________________________________________So, I've had a deeper look at the docs and source of pjmedia confbridge, if I understand correctly the master port is a totally different thing that I don't need.
I started from here: what I need would be a pjmedia_port added in the confbridge which loops frames back. That is, its put_frame() stores in an internal buffer, from which its get_frame() extracts.
To do this, the closest thing I could find is the splitcomb with a reverse channel. If I create a splitcomb with 1 reverse channel, when I put_frame in the reverse channel, the frame gets stored in the channel internal buffer; then, I can retrieve it with a get_frame on the splitcomb. (I think I could also do the other way around, that is put_frame in the splitcomb and retreive it with a get_frame on the reverse channel.)
Of course, I don't what to do it manually, I want the pjsua confbridge to do it. So if every call is connected like this:
conf_connect(call, revchan)
conf_connect(splitcomb, call)
which in my mind is:
pjmedia_port_get_frame(call, &f)
pjmedia_port_put_frame(revchan, &f)
...then...
pjmedia_port_get_frame(splitcomb, &f)
pjmedia_port_put_frame(call, &f)
it should work (?)
The following is pseudo-code describing what I did:
// create splitcomb with 1 channel and a reverse channel
pjmedia_splitcomb_create(pool, ..., &splitcomb)
pjmedia_splitcomb_create_rev_channel(pool, splitcomb, 0, 0, &revchan)
// add the splitcomb port and the reverse channel port to the pjsua confbridge
pjsua_conf_add_port(revchan, &revchan_slot)
pjsua_conf_add_port(splitcomb, &splitcomb_slot)
// then, when I receive a call, in its onCallMediaState callback:
pjsua_conf_connect(call_port_slot, revchan_slot)
pjsua_conf_connect(splitcomb_slot, call_port_slot)
And it kinda works, but the audio quality is low. Is this the right approach? Or am I using the splitcomb/revchannel in a way it is not intended to?
Thank you,
MD
Da: Matteo Dell'Orefice
Inviato: venerdì 20 settembre 2019 23:28
A: pjsip@xxxxxxxxxxxxxxx
Oggetto: Bridging N calls togetherHello,
I'm developing a server like program using pjsua. This program will receive N calls, and bridge them together (everyone hears everything). There is no need of capture/playback devices. What is the best way to achive this? I think I should use the conference bridge of pjmedia. Calling pjmedia_conf_connect_port N*N times is not a good idea, so I thought maybe I can create a "mixing" pjmedia_port, add it to the confbridge, then connect all calls' ports to it, and vice versa, the mixing port to all calls' ports. Would it work?
If this is the right idea, what kind of port should I use as mixing port? A master port? In this case, could I just connect everything to port 0 of the bridge (while also disconnecting port 0 from the sound devices)?
Thank you very much,
any suggestion is appreciated.
MD
Visit our blog: http://blog.pjsip.org
pjsip mailing list
pjsip@xxxxxxxxxxxxxxx
http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org
_______________________________________________ Visit our blog: http://blog.pjsip.org pjsip mailing list pjsip@xxxxxxxxxxxxxxx http://lists.pjsip.org/mailman/listinfo/pjsip_lists.pjsip.org