drachtio / drachtio-srf

drachtio signaling resource framework
https://drachtio.org
MIT License
171 stars 60 forks source link

B2BUA: Getting the UAS' final remote SDPs for dialogs in 3PCC calls #182

Open danvirsen opened 1 month ago

danvirsen commented 1 month ago

Hi!

We need the final remote SDP for both sides after a B2BUA is created, but in a 3PCC call the remote SDP from the ACK is not added to the UAS Dialog, so the remote SDP is empty.

I created a repo with a simple test to illustrate the difference between a "regular" call and a 3PCC call: https://github.com/danvirsen/drachtio-srf-3pcc-sdp It's not pretty but hopefully it's not too unclear. The behaviour seems strange to me.

Any feedback would be much appreciated. Is this intended behaviour or is it a bug? If intended, what's the rationale behind it and does anyone have any ideas on how to reliably get the final remote SDP for all calls? To me it seems like the resulting dialogs from createB2BUA should be the same for both "regular" and 3PCC calls.

Another approach I tried was to register a listener on the dialog for the ACK event and get the body of the request from there. Strangely, that event doesn't seem to be emitted in 3PCC calls. It's emitted for calls where the INVITE contains an SDP, but not when it doesn't.

Thank you!

danvirsen commented 1 month ago

I added a simple log in my test application for the ACK event listener to illustrate that it's not triggered in the 3PCC call.

It also shows that the B2BUA is considered complete before the ACK to the 200 OK is received since the promise is resolved before then. This is fairly obvious (how else would I create a listener for it?), but I hadn't really considered it before. Should this be the case? Would it make sense to consider the B2BUA as complete only after the 200 OK is ACked?