There's presently no way (that I have found) through the high-level API to
specify that the loopback address should be included as a host candidate in
the ICE transport without modifying pjsua itself. I need this feature as
I'm working on a product which provides media streams from connected
devices to an in-browser application that may be run with no network
connection (e.g., in highly remote locations). In such cases the ICE
transport doesn't provide any candidates by default, as it has no active
network interfaces to include.
The documentation for on_create_media_transport suggests it's possible to
replace the existing media transport for a call with an entirely new one.
I'm attempting to do this with the ICE transport when provided with a
particular flag. However, while mentioned in the documentation, there
appear to be no examples of this being done anywhere I can find, and so I
am stuck throwing things against the wall to see if they stick.
I have attempted any number of approaches and received different errors
depending on the circumstances.
One approach was to replace the transport associated with the call_media
(call->media[media_idx].tp = new_tp) while returning NULL from the
on_create_media_function. This results in the call being terminated because
the media is "Temporarily Unavailable" (presumably).
The other approach, which I believe to be the correct one, is to detach the
current transport from the media stream and return the new one from the
on_create_media_transport function. Unfortunately, when I do this I get a
"SIP Failure Code" (406 Not Acceptable). I believe this is because I wind
up with repeated candidate lines (at least that is what appears to happen
when preparing the SDP response).
Attached you will find a copy of the log output from PJSIP, as well as my
on_create_media_transport function (which is mostly ripped from pjsua-lib's
pjsua_media.c's create_ice_media_transport function). I would appreciate
any help y'all could offer.