mirror of
https://github.com/vector-im/hydrogen-web.git
synced 2024-12-23 19:45:05 +01:00
impl session id so EC does not ignore our messages
This commit is contained in:
parent
fe6e7b09b5
commit
6472800387
@ -50,11 +50,13 @@ export class CallHandler {
|
||||
// map of userId to set of conf_id's they are in
|
||||
private memberToCallIds: Map<string, Set<string>> = new Map();
|
||||
private groupCallOptions: GroupCallOptions;
|
||||
private sessionId = makeId("s");
|
||||
|
||||
constructor(private readonly options: Options) {
|
||||
this.groupCallOptions = Object.assign({}, this.options, {
|
||||
emitUpdate: (groupCall, params) => this._calls.update(groupCall.id, params),
|
||||
createTimeout: this.options.clock.createTimeout,
|
||||
sessionId: this.sessionId
|
||||
});
|
||||
}
|
||||
|
||||
|
@ -61,6 +61,7 @@ export class PeerCall implements IDisposable {
|
||||
private _state = CallState.Fledgling;
|
||||
private direction: CallDirection;
|
||||
private localMedia?: LocalMedia;
|
||||
private seq: number = 0;
|
||||
// A queue for candidates waiting to go out.
|
||||
// We try to amalgamate candidates into a single candidate message where
|
||||
// possible
|
||||
@ -258,6 +259,7 @@ 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) {
|
||||
@ -304,6 +306,7 @@ export class PeerCall implements IDisposable {
|
||||
offer,
|
||||
[SDPStreamMetadataKey]: this.localMedia!.getSDPMetadata(),
|
||||
version: 1,
|
||||
seq: this.seq++,
|
||||
lifetime: CALL_TIMEOUT_MS
|
||||
};
|
||||
if (this._state === CallState.CreateOffer) {
|
||||
@ -578,6 +581,7 @@ 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,
|
||||
@ -648,6 +652,7 @@ export class PeerCall implements IDisposable {
|
||||
content: {
|
||||
call_id: this.callId,
|
||||
version: 1,
|
||||
seq: this.seq++,
|
||||
candidates
|
||||
},
|
||||
}, log);
|
||||
|
@ -69,10 +69,15 @@ export interface CallReplacesTarget {
|
||||
export type MCallBase = {
|
||||
call_id: string;
|
||||
version: string | number;
|
||||
seq: number;
|
||||
}
|
||||
|
||||
export type MGroupCallBase = MCallBase & {
|
||||
conf_id: string;
|
||||
device_id: string;
|
||||
sender_session_id: string;
|
||||
dest_session_id: string;
|
||||
party_id: string; // Should not need this?
|
||||
}
|
||||
|
||||
export type MCallAnswer<Base extends MCallBase> = Base & {
|
||||
|
@ -33,6 +33,7 @@ export type Options = Omit<PeerCallOptions, "emitUpdate" | "sendSignallingMessag
|
||||
confId: string,
|
||||
ownUserId: string,
|
||||
ownDeviceId: string,
|
||||
sessionId: string,
|
||||
hsApi: HomeServerApi,
|
||||
encryptDeviceMessage: (userId: string, message: SignallingMessage<MGroupCallBase>, log: ILogItem) => Promise<EncryptedMessage>,
|
||||
emitUpdate: (participant: Member, params?: any) => void,
|
||||
@ -41,6 +42,7 @@ export type Options = Omit<PeerCallOptions, "emitUpdate" | "sendSignallingMessag
|
||||
export class Member {
|
||||
private peerCall?: PeerCall;
|
||||
private localMedia?: LocalMedia;
|
||||
private destSessionId?: string;
|
||||
|
||||
constructor(
|
||||
public readonly member: RoomMember,
|
||||
@ -140,7 +142,13 @@ export class Member {
|
||||
this.peerCall = this._createPeerCall(message.content.call_id);
|
||||
}
|
||||
if (this.peerCall) {
|
||||
const prevState = this.peerCall.state;
|
||||
this.peerCall.handleIncomingSignallingMessage(message, deviceId);
|
||||
//if (prevState !== this.peerCall.state) {
|
||||
if (!this.destSessionId) {
|
||||
this.destSessionId = message.content.sender_session_id;
|
||||
}
|
||||
//}
|
||||
} else {
|
||||
// TODO: need to buffer events until invite comes?
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user