Subject: [rtcweb] JSEP-03: O/A state machine and trickle ICE with forking

From: Christer Holmberg <[email-masked]>
Date: Wed, 27 Feb 2013 20:23:16 +0000

Hi,

A could of questions on jsep-03, related to the O/A state machine, and the usage of trickle ICE with forking:

Q_OA_1: As I have commented earlier, the state machine does not support setting of remote offer when a remote pranswer has been set. A JS SIP app may e.g. receive an SDP answer in a reliable 18x response, call setPranswer, and then receive an UPDATE on the same leg with a new offer.

Q_OA_2: The text in section 4.2.3 says:

   "A description used as a "pranswer" may be applied as a response to an "offer", or an update to a previously sent "answer"."

I don't understand the "update to a previously sent answer" part. As the previously sent "answer" has freed any resources that are no longer needed, is a subsequent "preanswer" supposed to un-free those? Also, the state machine doesn't seem to support it, and there is text saying that once "answer" has been set, no more "answer"/"pranswer" can be set for that O/A transaction.

Q_TI_1:

Assume the JS APP receives an SDP answer from remote entity A, and provides it to the browser as a pranswer. Then the JS APP receives an SDP answer from remote entity B, and provides it to the browser as a pranswer.

Then, the JS APP receives trickle ICE candidates from both entities A and B. What will happen to the trickle ICE candidates from remote entity A? The same question applies if the browser receives peer reflexive candidates from A. 

The draft says that trickle ICE candidates will be provided to the ICE Agent, that will then perform connectivity checks etc. But, does that mean that the ICE Agent will perform connectivity checks with both A and B.

This could of course be handled by always creating separate PeerConnections (and hence separate ICE agents) for A and B, even in the case of serial forking.

But, in any case I think the draft also needs to describe the ICE impacts of forking, because currently I don't think there is any text.

Regards,

Christer

---

From: Justin Uberti <[email-masked]>
Date: Wed, 27 Feb 2013 16:33:49 -0800

On Wed, Feb 27, 2013 at 12:23 PM, Christer Holmberg <
[email-masked]> wrote:

> Q_OA_1: As I have commented earlier, the state machine does not support
> setting of remote offer when a remote pranswer has been set. A JS SIP app
> may e.g. receive an SDP answer in a reliable 18x response, call
> setPranswer, and then receive an UPDATE on the same leg with a new offer.
>

Section 3.5.2, paragraph 2, attempts to provide a workaround for this
issue.

>    "A description used as a "pranswer" may be applied as a response to an
> "offer", or an update to a previously sent "answer"."
>
> I don't understand the "update to a previously sent answer" part. As the
> previously sent "answer" has freed any resources that are no longer needed,
> is a subsequent "preanswer" supposed to un-free those? Also, the state
> machine doesn't seem to support it, and there is text saying that once
> "answer" has been set, no more "answer"/"pranswer" can be set for that O/A
> transaction.
>

This should have said "previously sent "pranswer"", like the paragraph that
follows it.

>
>
> Q_TI_1:
>
> Assume the JS APP receives an SDP answer from remote entity A, and
> provides it to the browser as a pranswer. Then the JS APP receives an SDP
> answer from remote entity B, and provides it to the browser as a pranswer.
>
> Then, the JS APP receives trickle ICE candidates from both entities A and
> B. What will happen to the trickle ICE candidates from remote entity A? The
> same question applies if the browser receives peer reflexive candidates
> from A.
>

> The draft says that trickle ICE candidates will be provided to the ICE
> Agent, that will then perform connectivity checks etc. But, does that mean
> that the ICE Agent will perform connectivity checks with both A and B.
>
> This could of course be handled by always creating separate
> PeerConnections (and hence separate ICE agents) for A and B, even in the
> case of serial forking.
>
> But, in any case I think the draft also needs to describe the ICE impacts
> of forking, because currently I don't think there is any text.
>

Thanks for pointing this out. I discussed this at the IETF 83.5 interim,
but forgot to put this into the draft. The answer is that when B's pranswer
is applied, and the received ICE credentials are different than the
previous answer (as they would be in this case), the existing candidates
are discarded.

>
> Regards,
>
> Christer
> _______________________________________________
> rtcweb mailing list
> [email-masked]
> https://www.ietf.org/mailman/listinfo/rtcweb
>

---

From: Christer Holmberg <[email-masked]>
Date: Thu, 28 Feb 2013 06:57:45 +0000

Hi Justin,

Thanks for your response!

Comments inline, with an additional state machine question (Q_OA_3).

------------------

>> Q_OA_1: As I have commented earlier, the state machine does not support setting of remote offer when a 
>> remote pranswer has been set. A JS SIP app may e.g. receive an SDP answer in a reliable 18x response, 
>> call setPranswer, and then receive an UPDATE on the same leg with a new offer.
>
> Section 3.5.2, paragraph 2, attempts to provide a workaround for this issue.  

Section 3.5.2 talks about parallel forking, and how it can be solved by creating a new PC, and then send an UPDATE to provide the new PC information to the remote entity.

But, my issues is when the remote entity sends an UPDATE, with a new offer. It's not even related to forking. See my example below:

BROWSER                         JS APP                                    REMOTE ENITTY

    ------ create offer ----------
                                             -------- SDP Offer 1----------------->
                                            <------- SDP Answer 1 ----------------
    ------ set pranswer ---------
                                            <------- SDP Offer 2 -------------------
    ------ ??? ----------------------

------------------

>> I don't understand the "update to a previously sent answer" part. As the previously sent "answer" has freed any resources 
>> that are no longer needed, is a subsequent "preanswer" supposed to un-free those? Also, the state machine doesn't seem to 
>> support it, and there is text saying that once "answer" has been set, no more "answer"/"pranswer" can be set for that O/A transaction.
>
> This should have said "previously sent "pranswer"", like the paragraph that follows it.  

Ok.

------------------

Q_OA_3: When a pranswer has been set, the state machine does not allow creating a new local offer.

So, if the JS APP needs to send a new offer, e.g. because of BUNDLE, it would have to set answer first. But, that would again more or less prevent serial forking (at least on the same PeerConnection).

------------------

>Thanks for pointing this out. I discussed this at the IETF 83.5 interim, but forgot to put this into the draft. The answer is that when B's pranswer is applied, 
>and the received ICE credentials are different than the previous answer (as they would be in this case), the existing candidates are discarded.

But, A doesn't know that, so it may keep sending STUN requests, trickle ICE candidates etc.

But, assume that the JS APP discards whatever comes from A. Then, if the session will eventually be established with A (i.e. the SDP answer from A is provided to the browser as "answer"), A needs to be informed to re-send all trickle ICE candidates etc again,  because the previously sent ones were discarded (since the JS APP provided the SDP answer from B to the browser)...

------------------

I actually think that PeerConnection cloning would solve *ALL* of the issues above: there would be no need for pranswer, which means that the JSEP O/A procedures would be fully aligned with RFC 3264. And, ICE procedures could take place with multiple remote entities simultaneously.

Regards,

Christer

---

From: Justin Uberti <[email-masked]>
Date: Thu, 28 Feb 2013 14:37:14 -0800

On Wed, Feb 27, 2013 at 10:57 PM, Christer Holmberg <
[email-masked]> wrote:

> setting of remote offer when a
> Section 3.5.2 talks about parallel forking, and how it can be solved by
> creating a new PC, and then send an UPDATE to provide the new PC
> information to the remote entity.
>
> But, my issues is when the remote entity sends an UPDATE, with a new
> offer. It's not even related to forking. See my example below:
>
>
> BROWSER                         JS APP
>  REMOTE ENITTY
>

Right. This is clearly a problem, but the reason it is a problem is because
the two sides don't agree on the state of the negotiation. In a forking
case, it would be handled via the mechanism I mentioned above. In a
non-forking case, this is not solvable even with cloning, because the two
sides are out of sync. The browser has to handle this case by rejecting SDP
Offer 2.

> >> I don't understand the "update to a previously sent answer" part. As
> the previously sent "answer" has freed any resources
> >> that are no longer needed, is a subsequent "preanswer" supposed to
> un-free those? Also, the state machine doesn't seem to
> >> support it, and there is text saying that once "answer" has been set,
> no more "answer"/"pranswer" can be set for that O/A transaction.
> >
> So, if the JS APP needs to send a new offer, e.g. because of BUNDLE, it
> would have to set answer first. But, that would again more or less prevent
> serial forking (at least on the same PeerConnection).
>

Can you explain the BUNDLE case you have in mind? The BUNDLE renegotiation
to a single port can't happen at this point in the negotiation, because the
caller may receive another answer that doesn't want to use BUNDLE.

> is applied,
> >and the received ICE credentials are different than the previous answer
> (as they would be in this case), the existing candidates are discarded.
>

The app should send a termination message to A when it accepts the pranswer
from B. Even if it didn'tm the STUN requests would be ignored by the impl,
and the ICE candidates would be ignored by the app, so I don't think there
is a problem.

> But, assume that the JS APP discards whatever comes from A. Then, if the
> session will eventually be established with A (i.e. the SDP answer from A
> is provided to the browser as "answer"), A needs to be informed to re-send
> all trickle ICE candidates etc again,  because the previously sent ones
> were discarded (since the JS APP provided the SDP answer from B to the
> browser)...
>

The app can't keep the session alive simultaneously with both A and B. It
needs to pick one or the other. The last time this was discussed, this was
felt to be a reasonable solution. Perhaps this needs to be codified in the
JSEP draft.

>
> ------------------
>
> I actually think that PeerConnection cloning would solve *ALL* of the
> issues above: there would be no need for pranswer, which means that the
> JSEP O/A procedures would be fully aligned with RFC 3264. And, ICE
> procedures could take place with multiple remote entities simultaneously.
>

I considered that in the past, but PRANSWER is not just for forking; it's
also useful in the non-forking case  to get media flowing as fast as
possible in a single O/A sequence.

The overall opinion of the WG was that PRANSWER solves the problem above
and provides a fairly good treatment of forking without introducing
significant complexity. Adding cloning would allow a more comprehensive
treatment of forking, but at the cost of significant additional complexity.
Also, I have yet to have any application builder ask me for cloning support.