Proper call requests for callee
This commit is contained in:
parent
e9957ac12f
commit
333dc17c0a
6 changed files with 54 additions and 93 deletions
|
@ -2517,7 +2517,7 @@
|
||||||
"description": "Shown in reaction viewer as the title for the 'all' category"
|
"description": "Shown in reaction viewer as the title for the 'all' category"
|
||||||
},
|
},
|
||||||
"MessageRequests--message-direct": {
|
"MessageRequests--message-direct": {
|
||||||
"message": "Let $name$ message you and share your name and photo with them? They won’t know you’ve seen their messages until you accept.",
|
"message": "Let $name$ message you, call you, and share your name and photo with them? They won’t know you’ve seen their messages until you accept.",
|
||||||
"description": "Shown as the message for a message request in a direct message",
|
"description": "Shown as the message for a message request in a direct message",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"name": {
|
"name": {
|
||||||
|
@ -2527,7 +2527,7 @@
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"MessageRequests--message-direct-blocked": {
|
"MessageRequests--message-direct-blocked": {
|
||||||
"message": "Let $name$ message you and share your name and photo with them? You won't receive any messages until you unblock them.",
|
"message": "Let $name$ message you, call you, and share your name and photo with them? You won't receive any messages until you unblock them.",
|
||||||
"description": "Shown as the message for a message request in a direct message with a blocked account",
|
"description": "Shown as the message for a message request in a direct message with a blocked account",
|
||||||
"placeholders": {
|
"placeholders": {
|
||||||
"name": {
|
"name": {
|
||||||
|
|
|
@ -131,7 +131,7 @@
|
||||||
"redux-ts-utils": "3.2.2",
|
"redux-ts-utils": "3.2.2",
|
||||||
"reselect": "4.0.0",
|
"reselect": "4.0.0",
|
||||||
"rimraf": "2.6.2",
|
"rimraf": "2.6.2",
|
||||||
"ringrtc": "https://github.com/signalapp/signal-ringrtc-node.git#7563474ee920d4535535ae01476ced3e8dc668d1",
|
"ringrtc": "https://github.com/signalapp/signal-ringrtc-node.git#bfa94f2749324029ed4b4c51dfaf3e27bafe3eed",
|
||||||
"sanitize-filename": "1.6.3",
|
"sanitize-filename": "1.6.3",
|
||||||
"sanitize.css": "11.0.0",
|
"sanitize.css": "11.0.0",
|
||||||
"semver": "5.4.1",
|
"semver": "5.4.1",
|
||||||
|
|
|
@ -4,12 +4,16 @@ import {
|
||||||
Call,
|
Call,
|
||||||
CallEndedReason,
|
CallEndedReason,
|
||||||
CallId,
|
CallId,
|
||||||
|
CallingMessage,
|
||||||
CallLogLevel,
|
CallLogLevel,
|
||||||
CallSettings,
|
CallSettings,
|
||||||
CallState,
|
CallState,
|
||||||
CanvasVideoRenderer,
|
CanvasVideoRenderer,
|
||||||
DeviceId,
|
DeviceId,
|
||||||
GumVideoCapturer,
|
GumVideoCapturer,
|
||||||
|
HangupMessage,
|
||||||
|
HangupType,
|
||||||
|
OfferType,
|
||||||
RingRTC,
|
RingRTC,
|
||||||
UserId,
|
UserId,
|
||||||
} from 'ringrtc';
|
} from 'ringrtc';
|
||||||
|
@ -21,7 +25,7 @@ import {
|
||||||
ActionsType as UxActionsType,
|
ActionsType as UxActionsType,
|
||||||
CallDetailsType,
|
CallDetailsType,
|
||||||
} from '../state/ducks/calling';
|
} from '../state/ducks/calling';
|
||||||
import { CallingMessageClass, EnvelopeClass } from '../textsecure.d';
|
import { EnvelopeClass } from '../textsecure.d';
|
||||||
import {
|
import {
|
||||||
AudioDevice,
|
AudioDevice,
|
||||||
CallHistoryDetailsType,
|
CallHistoryDetailsType,
|
||||||
|
@ -398,7 +402,7 @@ export class CallingClass {
|
||||||
|
|
||||||
async handleCallingMessage(
|
async handleCallingMessage(
|
||||||
envelope: EnvelopeClass,
|
envelope: EnvelopeClass,
|
||||||
callingMessage: CallingMessageClass
|
callingMessage: CallingMessage
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
window.log.info('CallingClass.handleCallingMessage()');
|
window.log.info('CallingClass.handleCallingMessage()');
|
||||||
|
|
||||||
|
@ -439,6 +443,35 @@ export class CallingClass {
|
||||||
}
|
}
|
||||||
const receiverIdentityKey = receiverIdentityRecord.publicKey.slice(1); // Ignore the type header, it is not used.
|
const receiverIdentityKey = receiverIdentityRecord.publicKey.slice(1); // Ignore the type header, it is not used.
|
||||||
|
|
||||||
|
const conversation = window.ConversationController.get(remoteUserId);
|
||||||
|
if (!conversation) {
|
||||||
|
window.log.error('Missing conversation; ignoring call message.');
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
if (callingMessage.offer && !conversation.getAccepted()) {
|
||||||
|
window.log.info(
|
||||||
|
'Conversation was not approved by user; rejecting call message.'
|
||||||
|
);
|
||||||
|
|
||||||
|
const hangup = new HangupMessage();
|
||||||
|
hangup.callId = callingMessage.offer.callId;
|
||||||
|
hangup.deviceId = remoteDeviceId;
|
||||||
|
hangup.type = HangupType.NeedPermission;
|
||||||
|
|
||||||
|
const message = new CallingMessage();
|
||||||
|
message.legacyHangup = hangup;
|
||||||
|
|
||||||
|
await this.handleOutgoingSignaling(remoteUserId, message);
|
||||||
|
|
||||||
|
this.addCallHistoryForFailedIncomingCall(
|
||||||
|
conversation,
|
||||||
|
callingMessage.offer.type === OfferType.VideoCall
|
||||||
|
);
|
||||||
|
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
const messageAgeSec = envelope.messageAgeSec ? envelope.messageAgeSec : 0;
|
const messageAgeSec = envelope.messageAgeSec ? envelope.messageAgeSec : 0;
|
||||||
|
|
||||||
window.log.info('CallingClass.handleCallingMessage(): Handling in RingRTC');
|
window.log.info('CallingClass.handleCallingMessage(): Handling in RingRTC');
|
||||||
|
@ -525,7 +558,7 @@ export class CallingClass {
|
||||||
|
|
||||||
private async handleOutgoingSignaling(
|
private async handleOutgoingSignaling(
|
||||||
remoteUserId: UserId,
|
remoteUserId: UserId,
|
||||||
message: CallingMessageClass
|
message: CallingMessage
|
||||||
): Promise<boolean> {
|
): Promise<boolean> {
|
||||||
const conversation = window.ConversationController.get(remoteUserId);
|
const conversation = window.ConversationController.get(remoteUserId);
|
||||||
const sendOptions = conversation
|
const sendOptions = conversation
|
||||||
|
@ -585,17 +618,10 @@ export class CallingClass {
|
||||||
window.log.info(
|
window.log.info(
|
||||||
`Peer is not trusted, ignoring incoming call for conversation: ${conversation.idForLogging()}`
|
`Peer is not trusted, ignoring incoming call for conversation: ${conversation.idForLogging()}`
|
||||||
);
|
);
|
||||||
this.addCallHistoryForFailedIncomingCall(conversation, call);
|
this.addCallHistoryForFailedIncomingCall(
|
||||||
return null;
|
conversation,
|
||||||
}
|
call.isVideoCall
|
||||||
|
|
||||||
// Simple Call Requests: Ensure that the conversation is accepted.
|
|
||||||
// If not, do not allow the call.
|
|
||||||
if (!conversation.getAccepted()) {
|
|
||||||
window.log.info(
|
|
||||||
`Messaging is not accepted, ignoring incoming call for conversation: ${conversation.idForLogging()}`
|
|
||||||
);
|
);
|
||||||
this.addCallHistoryForFailedIncomingCall(conversation, call);
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -610,7 +636,7 @@ export class CallingClass {
|
||||||
return await this.getCallSettings(conversation);
|
return await this.getCallSettings(conversation);
|
||||||
} catch (err) {
|
} catch (err) {
|
||||||
window.log.error(`Ignoring incoming call: ${err.stack}`);
|
window.log.error(`Ignoring incoming call: ${err.stack}`);
|
||||||
this.addCallHistoryForFailedIncomingCall(conversation, call);
|
this.addCallHistoryForFailedIncomingCall(conversation, call.isVideoCall);
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -774,11 +800,11 @@ export class CallingClass {
|
||||||
|
|
||||||
private addCallHistoryForFailedIncomingCall(
|
private addCallHistoryForFailedIncomingCall(
|
||||||
conversation: ConversationModel,
|
conversation: ConversationModel,
|
||||||
call: Call
|
wasVideoCall: boolean
|
||||||
) {
|
) {
|
||||||
const callHistoryDetails: CallHistoryDetailsType = {
|
const callHistoryDetails: CallHistoryDetailsType = {
|
||||||
wasIncoming: true,
|
wasIncoming: true,
|
||||||
wasVideoCall: call.isVideoCall,
|
wasVideoCall,
|
||||||
// Since the user didn't decline, make sure it shows up as a missed call instead
|
// Since the user didn't decline, make sure it shows up as a missed call instead
|
||||||
wasDeclined: false,
|
wasDeclined: false,
|
||||||
acceptedTime: undefined,
|
acceptedTime: undefined,
|
||||||
|
|
64
ts/textsecure.d.ts
vendored
64
ts/textsecure.d.ts
vendored
|
@ -12,6 +12,7 @@ import { ByteBufferClass } from './window.d';
|
||||||
import SendMessage, { SendOptionsType } from './textsecure/SendMessage';
|
import SendMessage, { SendOptionsType } from './textsecure/SendMessage';
|
||||||
import { WebAPIType } from './textsecure/WebAPI';
|
import { WebAPIType } from './textsecure/WebAPI';
|
||||||
import utils from './textsecure/Helpers';
|
import utils from './textsecure/Helpers';
|
||||||
|
import { CallingMessage as CallingMessageClass } from 'ringrtc';
|
||||||
|
|
||||||
type AttachmentType = any;
|
type AttachmentType = any;
|
||||||
|
|
||||||
|
@ -1214,65 +1215,4 @@ export declare class WebSocketResponseMessageClass {
|
||||||
body?: ProtoBinaryType;
|
body?: ProtoBinaryType;
|
||||||
}
|
}
|
||||||
|
|
||||||
// Everything from here down to HangupType (everything related to calling)
|
export { CallingMessageClass };
|
||||||
// must be kept in sync with RingRTC (ringrtc-node).
|
|
||||||
// Whenever you change this, make sure you change RingRTC as well.
|
|
||||||
|
|
||||||
type ProtobufArrayBuffer = ArrayBuffer | { toArrayBuffer: () => ArrayBuffer };
|
|
||||||
|
|
||||||
export type DeviceId = number;
|
|
||||||
|
|
||||||
export type CallId = any;
|
|
||||||
|
|
||||||
export class CallingMessageClass {
|
|
||||||
offer?: OfferMessageClass;
|
|
||||||
answer?: AnswerMessageClass;
|
|
||||||
iceCandidates?: Array<IceCandidateMessageClass>;
|
|
||||||
legacyHangup?: HangupMessageClass;
|
|
||||||
busy?: BusyMessageClass;
|
|
||||||
hangup?: HangupMessageClass;
|
|
||||||
supportsMultiRing?: boolean;
|
|
||||||
destinationDeviceId?: DeviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class OfferMessageClass {
|
|
||||||
callId?: CallId;
|
|
||||||
type?: OfferType;
|
|
||||||
sdp?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum OfferType {
|
|
||||||
AudioCall = 0,
|
|
||||||
VideoCall = 1,
|
|
||||||
}
|
|
||||||
|
|
||||||
export class AnswerMessageClass {
|
|
||||||
callId?: CallId;
|
|
||||||
sdp?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class IceCandidateMessageClass {
|
|
||||||
callId?: CallId;
|
|
||||||
mid?: string;
|
|
||||||
line?: number;
|
|
||||||
opaque?: ProtobufArrayBuffer;
|
|
||||||
sdp?: string;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class BusyMessageClass {
|
|
||||||
callId?: CallId;
|
|
||||||
}
|
|
||||||
|
|
||||||
export class HangupMessageClass {
|
|
||||||
callId?: CallId;
|
|
||||||
type?: HangupType;
|
|
||||||
deviceId?: DeviceId;
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum HangupType {
|
|
||||||
Normal = 0,
|
|
||||||
Accepted = 1,
|
|
||||||
Declined = 2,
|
|
||||||
Busy = 3,
|
|
||||||
NeedPermission = 4,
|
|
||||||
}
|
|
||||||
|
|
|
@ -1,3 +1,5 @@
|
||||||
|
import { CallState } from 'ringrtc';
|
||||||
|
|
||||||
// Must be kept in sync with RingRTC.AudioDevice
|
// Must be kept in sync with RingRTC.AudioDevice
|
||||||
export interface AudioDevice {
|
export interface AudioDevice {
|
||||||
// Device name.
|
// Device name.
|
||||||
|
@ -10,15 +12,6 @@ export interface AudioDevice {
|
||||||
i18nKey?: string;
|
i18nKey?: string;
|
||||||
}
|
}
|
||||||
|
|
||||||
// This must be kept in sync with RingRTC.CallState.
|
|
||||||
export enum CallState {
|
|
||||||
Prering = 'init',
|
|
||||||
Ringing = 'ringing',
|
|
||||||
Accepted = 'connected',
|
|
||||||
Reconnecting = 'connecting',
|
|
||||||
Ended = 'ended',
|
|
||||||
}
|
|
||||||
|
|
||||||
export enum CallingDeviceType {
|
export enum CallingDeviceType {
|
||||||
CAMERA,
|
CAMERA,
|
||||||
MICROPHONE,
|
MICROPHONE,
|
||||||
|
@ -46,3 +39,5 @@ export type ChangeIODevicePayloadType =
|
||||||
| { type: CallingDeviceType.CAMERA; selectedDevice: string }
|
| { type: CallingDeviceType.CAMERA; selectedDevice: string }
|
||||||
| { type: CallingDeviceType.MICROPHONE; selectedDevice: AudioDevice }
|
| { type: CallingDeviceType.MICROPHONE; selectedDevice: AudioDevice }
|
||||||
| { type: CallingDeviceType.SPEAKER; selectedDevice: AudioDevice };
|
| { type: CallingDeviceType.SPEAKER; selectedDevice: AudioDevice };
|
||||||
|
|
||||||
|
export { CallState };
|
||||||
|
|
|
@ -14075,9 +14075,9 @@ rimraf@~2.4.0:
|
||||||
dependencies:
|
dependencies:
|
||||||
glob "^6.0.1"
|
glob "^6.0.1"
|
||||||
|
|
||||||
"ringrtc@https://github.com/signalapp/signal-ringrtc-node.git#7563474ee920d4535535ae01476ced3e8dc668d1":
|
"ringrtc@https://github.com/signalapp/signal-ringrtc-node.git#bfa94f2749324029ed4b4c51dfaf3e27bafe3eed":
|
||||||
version "2.7.1"
|
version "2.7.2"
|
||||||
resolved "https://github.com/signalapp/signal-ringrtc-node.git#7563474ee920d4535535ae01476ced3e8dc668d1"
|
resolved "https://github.com/signalapp/signal-ringrtc-node.git#bfa94f2749324029ed4b4c51dfaf3e27bafe3eed"
|
||||||
|
|
||||||
ripemd160@^2.0.0, ripemd160@^2.0.1:
|
ripemd160@^2.0.0, ripemd160@^2.0.1:
|
||||||
version "2.0.1"
|
version "2.0.1"
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue