send hangup when leaving the call

but not when somebody else leaves the call through a member event
This commit is contained in:
Bruno Windels 2022-04-14 13:45:21 +02:00
parent ff856d843c
commit 021b8cdcdc
2 changed files with 8 additions and 4 deletions

View file

@ -269,7 +269,7 @@ export class GroupCall extends EventEmitter<{change: never}> {
if (this._state === GroupCallState.Joined) {
log.set("leave_own", true);
for (const [,member] of this._members) {
member.disconnect();
member.disconnect(true);
}
this._localMedia?.dispose();
this._localMedia = undefined;
@ -286,7 +286,7 @@ export class GroupCall extends EventEmitter<{change: never}> {
if (member) {
log.set("leave", true);
this._members.remove(memberKey);
member.disconnect();
member.disconnect(false);
}
this.emitChange();
});

View file

@ -99,9 +99,13 @@ export class Member {
}
/** @internal */
disconnect() {
disconnect(hangup: boolean) {
this.logItem.wrap("disconnect", log => {
if (hangup) {
this.peerCall?.hangup(CallErrorCode.UserHangup);
} else {
this.peerCall?.close(undefined, log);
}
this.peerCall?.dispose();
this.peerCall = undefined;
this.localMedia?.dispose();