move setting seq on outbound messages to member, is specific to_device
This commit is contained in:
parent
a014740e72
commit
a139571e20
3 changed files with 3 additions and 10 deletions
|
@ -71,7 +71,6 @@ export class PeerCall implements IDisposable {
|
||||||
private localMedia?: LocalMedia;
|
private localMedia?: LocalMedia;
|
||||||
private localMuteSettings?: MuteSettings;
|
private localMuteSettings?: MuteSettings;
|
||||||
// TODO: this should go in member
|
// TODO: this should go in member
|
||||||
private seq: number = 0;
|
|
||||||
// A queue for candidates waiting to go out.
|
// A queue for candidates waiting to go out.
|
||||||
// We try to amalgamate candidates into a single candidate message where
|
// We try to amalgamate candidates into a single candidate message where
|
||||||
// possible
|
// possible
|
||||||
|
@ -238,7 +237,6 @@ export class PeerCall implements IDisposable {
|
||||||
const content: MCallSDPStreamMetadataChanged<MCallBase> = {
|
const content: MCallSDPStreamMetadataChanged<MCallBase> = {
|
||||||
call_id: this.callId,
|
call_id: this.callId,
|
||||||
version: 1,
|
version: 1,
|
||||||
seq: this.seq++,
|
|
||||||
[SDPStreamMetadataKey]: this.getSDPMetadata()
|
[SDPStreamMetadataKey]: this.getSDPMetadata()
|
||||||
};
|
};
|
||||||
await this.sendSignallingMessage({type: EventType.SDPStreamMetadataChangedPrefix, content}, log);
|
await this.sendSignallingMessage({type: EventType.SDPStreamMetadataChangedPrefix, content}, log);
|
||||||
|
@ -263,7 +261,6 @@ export class PeerCall implements IDisposable {
|
||||||
const content: MCallSDPStreamMetadataChanged<MCallBase> = {
|
const content: MCallSDPStreamMetadataChanged<MCallBase> = {
|
||||||
call_id: this.callId,
|
call_id: this.callId,
|
||||||
version: 1,
|
version: 1,
|
||||||
seq: this.seq++,
|
|
||||||
[SDPStreamMetadataKey]: this.getSDPMetadata()
|
[SDPStreamMetadataKey]: this.getSDPMetadata()
|
||||||
};
|
};
|
||||||
await this.sendSignallingMessage({type: EventType.SDPStreamMetadataChangedPrefix, content}, log);
|
await this.sendSignallingMessage({type: EventType.SDPStreamMetadataChangedPrefix, content}, log);
|
||||||
|
@ -350,7 +347,6 @@ export class PeerCall implements IDisposable {
|
||||||
const content = {
|
const content = {
|
||||||
call_id: callId,
|
call_id: callId,
|
||||||
version: 1,
|
version: 1,
|
||||||
seq: this.seq++,
|
|
||||||
};
|
};
|
||||||
// TODO: Don't send UserHangup reason to older clients
|
// TODO: Don't send UserHangup reason to older clients
|
||||||
if (reason) {
|
if (reason) {
|
||||||
|
@ -398,7 +394,6 @@ export class PeerCall implements IDisposable {
|
||||||
offer,
|
offer,
|
||||||
[SDPStreamMetadataKey]: this.getSDPMetadata(),
|
[SDPStreamMetadataKey]: this.getSDPMetadata(),
|
||||||
version: 1,
|
version: 1,
|
||||||
seq: this.seq++,
|
|
||||||
lifetime: CALL_TIMEOUT_MS
|
lifetime: CALL_TIMEOUT_MS
|
||||||
};
|
};
|
||||||
await this.sendSignallingMessage({type: EventType.Invite, content}, log);
|
await this.sendSignallingMessage({type: EventType.Invite, content}, log);
|
||||||
|
@ -409,7 +404,6 @@ export class PeerCall implements IDisposable {
|
||||||
description: offer,
|
description: offer,
|
||||||
[SDPStreamMetadataKey]: this.getSDPMetadata(),
|
[SDPStreamMetadataKey]: this.getSDPMetadata(),
|
||||||
version: 1,
|
version: 1,
|
||||||
seq: this.seq++,
|
|
||||||
lifetime: CALL_TIMEOUT_MS
|
lifetime: CALL_TIMEOUT_MS
|
||||||
};
|
};
|
||||||
await this.sendSignallingMessage({type: EventType.Negotiate, content}, log);
|
await this.sendSignallingMessage({type: EventType.Negotiate, content}, log);
|
||||||
|
@ -674,7 +668,6 @@ export class PeerCall implements IDisposable {
|
||||||
description: this.peerConnection.localDescription!,
|
description: this.peerConnection.localDescription!,
|
||||||
[SDPStreamMetadataKey]: this.getSDPMetadata(),
|
[SDPStreamMetadataKey]: this.getSDPMetadata(),
|
||||||
version: 1,
|
version: 1,
|
||||||
seq: this.seq++,
|
|
||||||
lifetime: CALL_TIMEOUT_MS
|
lifetime: CALL_TIMEOUT_MS
|
||||||
};
|
};
|
||||||
await this.sendSignallingMessage({type: EventType.Negotiate, content}, log);
|
await this.sendSignallingMessage({type: EventType.Negotiate, content}, log);
|
||||||
|
@ -689,7 +682,6 @@ export class PeerCall implements IDisposable {
|
||||||
const answerContent: MCallAnswer<MCallBase> = {
|
const answerContent: MCallAnswer<MCallBase> = {
|
||||||
call_id: this.callId,
|
call_id: this.callId,
|
||||||
version: 1,
|
version: 1,
|
||||||
seq: this.seq++,
|
|
||||||
answer: {
|
answer: {
|
||||||
sdp: localDescription.sdp,
|
sdp: localDescription.sdp,
|
||||||
type: localDescription.type,
|
type: localDescription.type,
|
||||||
|
@ -755,7 +747,6 @@ export class PeerCall implements IDisposable {
|
||||||
content: {
|
content: {
|
||||||
call_id: this.callId,
|
call_id: this.callId,
|
||||||
version: 1,
|
version: 1,
|
||||||
seq: this.seq++,
|
|
||||||
candidates
|
candidates
|
||||||
},
|
},
|
||||||
}, log);
|
}, log);
|
||||||
|
|
|
@ -65,7 +65,6 @@ export interface CallReplacesTarget {
|
||||||
export type MCallBase = {
|
export type MCallBase = {
|
||||||
call_id: string;
|
call_id: string;
|
||||||
version: string | number;
|
version: string | number;
|
||||||
seq: number;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MGroupCallBase = MCallBase & {
|
export type MGroupCallBase = MCallBase & {
|
||||||
|
@ -74,6 +73,7 @@ export type MGroupCallBase = MCallBase & {
|
||||||
sender_session_id: string;
|
sender_session_id: string;
|
||||||
dest_session_id: string;
|
dest_session_id: string;
|
||||||
party_id: string; // Should not need this?
|
party_id: string; // Should not need this?
|
||||||
|
seq: number;
|
||||||
}
|
}
|
||||||
|
|
||||||
export type MCallAnswer<Base extends MCallBase> = Base & {
|
export type MCallAnswer<Base extends MCallBase> = Base & {
|
||||||
|
|
|
@ -53,6 +53,7 @@ const errorCodesWithoutRetry = [
|
||||||
class MemberConnection {
|
class MemberConnection {
|
||||||
public retryCount: number = 0;
|
public retryCount: number = 0;
|
||||||
public peerCall?: PeerCall;
|
public peerCall?: PeerCall;
|
||||||
|
public outboundSeqCounter: number = 0;
|
||||||
|
|
||||||
constructor(
|
constructor(
|
||||||
public localMedia: LocalMedia,
|
public localMedia: LocalMedia,
|
||||||
|
@ -212,6 +213,7 @@ export class Member {
|
||||||
/** @internal */
|
/** @internal */
|
||||||
sendSignallingMessage = async (message: SignallingMessage<MCallBase>, log: ILogItem): Promise<void> => {
|
sendSignallingMessage = async (message: SignallingMessage<MCallBase>, log: ILogItem): Promise<void> => {
|
||||||
const groupMessage = message as SignallingMessage<MGroupCallBase>;
|
const groupMessage = message as SignallingMessage<MGroupCallBase>;
|
||||||
|
groupMessage.content.seq = ++this.connection!.outboundSeqCounter;
|
||||||
groupMessage.content.conf_id = this.options.confId;
|
groupMessage.content.conf_id = this.options.confId;
|
||||||
groupMessage.content.device_id = this.options.ownDeviceId;
|
groupMessage.content.device_id = this.options.ownDeviceId;
|
||||||
groupMessage.content.party_id = this.options.ownDeviceId;
|
groupMessage.content.party_id = this.options.ownDeviceId;
|
||||||
|
|
Reference in a new issue