move setting seq on outbound messages to member, is specific to_device

This commit is contained in:
Bruno Windels 2022-06-02 10:58:04 +02:00
parent a014740e72
commit a139571e20
3 changed files with 3 additions and 10 deletions

View File

@ -71,7 +71,6 @@ export class PeerCall implements IDisposable {
private localMedia?: LocalMedia;
private localMuteSettings?: MuteSettings;
// TODO: this should go in member
private seq: number = 0;
// A queue for candidates waiting to go out.
// We try to amalgamate candidates into a single candidate message where
// possible
@ -238,7 +237,6 @@ export class PeerCall implements IDisposable {
const content: MCallSDPStreamMetadataChanged<MCallBase> = {
call_id: this.callId,
version: 1,
seq: this.seq++,
[SDPStreamMetadataKey]: this.getSDPMetadata()
};
await this.sendSignallingMessage({type: EventType.SDPStreamMetadataChangedPrefix, content}, log);
@ -263,7 +261,6 @@ export class PeerCall implements IDisposable {
const content: MCallSDPStreamMetadataChanged<MCallBase> = {
call_id: this.callId,
version: 1,
seq: this.seq++,
[SDPStreamMetadataKey]: this.getSDPMetadata()
};
await this.sendSignallingMessage({type: EventType.SDPStreamMetadataChangedPrefix, content}, log);
@ -350,7 +347,6 @@ export class PeerCall implements IDisposable {
const content = {
call_id: callId,
version: 1,
seq: this.seq++,
};
// TODO: Don't send UserHangup reason to older clients
if (reason) {
@ -398,7 +394,6 @@ export class PeerCall implements IDisposable {
offer,
[SDPStreamMetadataKey]: this.getSDPMetadata(),
version: 1,
seq: this.seq++,
lifetime: CALL_TIMEOUT_MS
};
await this.sendSignallingMessage({type: EventType.Invite, content}, log);
@ -409,7 +404,6 @@ export class PeerCall implements IDisposable {
description: offer,
[SDPStreamMetadataKey]: this.getSDPMetadata(),
version: 1,
seq: this.seq++,
lifetime: CALL_TIMEOUT_MS
};
await this.sendSignallingMessage({type: EventType.Negotiate, content}, log);
@ -674,7 +668,6 @@ export class PeerCall implements IDisposable {
description: this.peerConnection.localDescription!,
[SDPStreamMetadataKey]: this.getSDPMetadata(),
version: 1,
seq: this.seq++,
lifetime: CALL_TIMEOUT_MS
};
await this.sendSignallingMessage({type: EventType.Negotiate, content}, log);
@ -689,7 +682,6 @@ export class PeerCall implements IDisposable {
const answerContent: MCallAnswer<MCallBase> = {
call_id: this.callId,
version: 1,
seq: this.seq++,
answer: {
sdp: localDescription.sdp,
type: localDescription.type,
@ -755,7 +747,6 @@ export class PeerCall implements IDisposable {
content: {
call_id: this.callId,
version: 1,
seq: this.seq++,
candidates
},
}, log);

View File

@ -65,7 +65,6 @@ export interface CallReplacesTarget {
export type MCallBase = {
call_id: string;
version: string | number;
seq: number;
}
export type MGroupCallBase = MCallBase & {
@ -74,6 +73,7 @@ export type MGroupCallBase = MCallBase & {
sender_session_id: string;
dest_session_id: string;
party_id: string; // Should not need this?
seq: number;
}
export type MCallAnswer<Base extends MCallBase> = Base & {

View File

@ -53,6 +53,7 @@ const errorCodesWithoutRetry = [
class MemberConnection {
public retryCount: number = 0;
public peerCall?: PeerCall;
public outboundSeqCounter: number = 0;
constructor(
public localMedia: LocalMedia,
@ -212,6 +213,7 @@ export class Member {
/** @internal */
sendSignallingMessage = async (message: SignallingMessage<MCallBase>, log: ILogItem): Promise<void> => {
const groupMessage = message as SignallingMessage<MGroupCallBase>;
groupMessage.content.seq = ++this.connection!.outboundSeqCounter;
groupMessage.content.conf_id = this.options.confId;
groupMessage.content.device_id = this.options.ownDeviceId;
groupMessage.content.party_id = this.options.ownDeviceId;