Skip to content

Commit 0adcacb

Browse files
authored
Avoid setup change upon DTLS reinvite (#4639)
1 parent 5daf06c commit 0adcacb

File tree

1 file changed

+9
-6
lines changed

1 file changed

+9
-6
lines changed

pjmedia/src/pjmedia/transport_srtp_dtls.c

Lines changed: 9 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1048,13 +1048,16 @@ static pj_status_t parse_setup_finger_attr(dtls_srtp *ds,
10481048
if (!a)
10491049
return PJMEDIA_SRTP_ESDPAMBIGUEANS;
10501050

1051-
if (pj_stristr(&a->value, &ID_PASSIVE) ||
1052-
(rem_as_offerer && pj_stristr(&a->value, &ID_ACTPASS)))
1053-
{
1054-
/* Remote offers/answers 'passive' (or offers 'actpass'), so we are
1055-
* the client.
1056-
*/
1051+
if (pj_stristr(&a->value, &ID_PASSIVE)) {
1052+
/* Remote offers/answers 'passive' so we are the client. */
10571053
ds->setup = DTLS_SETUP_ACTIVE;
1054+
} else if (rem_as_offerer && pj_stristr(&a->value, &ID_ACTPASS)) {
1055+
/* If remote offers 'actpass' and our setup is unknown,
1056+
* we choose the role as the client, otherwise we maintain
1057+
* the current setup to avoid establishing new DTLS connection.
1058+
*/
1059+
if (ds->setup == DTLS_SETUP_UNKNOWN)
1060+
ds->setup = DTLS_SETUP_ACTIVE;
10581061
} else if (pj_stristr(&a->value, &ID_ACTIVE)) {
10591062
/* Remote offers/answers 'active' so we are the server. */
10601063
ds->setup = DTLS_SETUP_PASSIVE;

0 commit comments

Comments
 (0)