@@ -194,12 +194,6 @@ export class MatrixRTCSession extends TypedEventEmitter<
194
194
private joinConfig ?: SessionConfig ;
195
195
private logger : Logger ;
196
196
197
- /**
198
- * Whether we're trying to join the session but still waiting for room state
199
- * to reflect our own membership.
200
- */
201
- private joining = false ;
202
-
203
197
/**
204
198
* This timeout is responsible to track any expiration. We need to know when we have to start
205
199
* to ignore other call members. There is no callback for this. This timeout will always be configured to
@@ -465,9 +459,6 @@ export class MatrixRTCSession extends TypedEventEmitter<
465
459
}
466
460
467
461
this . joinConfig = joinConfig ;
468
- const userId = this . client . getUserId ( ) ! ;
469
- const deviceId = this . client . getDeviceId ( ) ! ;
470
- this . joining = ! this . memberships . some ( ( m ) => isMyMembership ( m , userId , deviceId ) ) ;
471
462
472
463
// Join!
473
464
this . membershipManager ! . join ( fociPreferred , fociActive , ( e ) => {
@@ -498,7 +489,6 @@ export class MatrixRTCSession extends TypedEventEmitter<
498
489
499
490
this . logger . info ( `Leaving call session in room ${ this . roomSubset . roomId } ` ) ;
500
491
501
- this . joining = false ;
502
492
this . encryptionManager ! . leave ( ) ;
503
493
const leavePromise = this . membershipManager ! . leave ( timeout ) ;
504
494
@@ -625,14 +615,15 @@ export class MatrixRTCSession extends TypedEventEmitter<
625
615
} ) ;
626
616
627
617
void this . membershipManager ?. onRTCSessionMemberUpdate ( this . memberships ) ;
628
-
629
- const userId = this . client . getUserId ( ) ! ;
630
- const deviceId = this . client . getDeviceId ( ) ! ;
631
- if ( this . joining && this . memberships . some ( ( m ) => isMyMembership ( m , userId , deviceId ) ) ) {
632
- this . joining = false ;
618
+ const ownMembership = this . membershipManager ?. ownMembership ;
619
+ if ( ownMembership && oldMemberships . length === 0 ) {
633
620
// If we're the first member in the call, we're responsible for
634
621
// sending the notification event
635
- if ( oldMemberships . length === 0 ) this . sendCallNotify ( ) ;
622
+ if ( ownMembership . eventId ) {
623
+ this . sendCallNotify ( ownMembership . eventId ) ;
624
+ } else {
625
+ this . logger . warn ( "Own membership eventId is undefined, cannot send call notification" ) ;
626
+ }
636
627
}
637
628
}
638
629
// This also needs to be done if `changed` = false
0 commit comments