diff --git a/ts/services/calling.ts b/ts/services/calling.ts index 3b8a85696715..6c4e0038c6d1 100644 --- a/ts/services/calling.ts +++ b/ts/services/calling.ts @@ -6,7 +6,6 @@ import { ipcRenderer } from 'electron'; import type { AudioDevice, CallId, - CallMessageUrgency, DeviceId, PeekInfo, UserId, @@ -18,6 +17,7 @@ import { BusyMessage, Call, CallingMessage, + CallMessageUrgency, CallLogLevel, CallState, CanvasVideoRenderer, @@ -1146,6 +1146,7 @@ export class CallingClass { }); } + // Used specifically to send updates about in-progress group calls, nothing else private async sendGroupCallUpdateMessage( conversationId: string, eraId: string @@ -1188,7 +1189,7 @@ export class CallingClass { sendOptions, sendTarget: conversation.toSenderKeyTarget(), sendType: 'callingMessage', - urgent: false, + urgent: true, }) ), sendType: 'callingMessage', @@ -1822,6 +1823,7 @@ export class CallingClass { return this.handleOutgoingSignaling(userId, message, urgency); } + // Used to send a variety of group call messages, including the initial call message private async handleSendCallMessageToGroup( groupIdBytes: Buffer, data: Buffer, @@ -1845,6 +1847,10 @@ export class CallingClass { urgency ); + // If this message isn't droppable, we'll wake up recipient devices. The important one + // is the first message to start the call. + const urgent = urgency === CallMessageUrgency.HandleImmediately; + // We "fire and forget" because sending this message is non-essential. // We also don't sync this message. const { ContentHint } = Proto.UnidentifiedSenderMessage.Message; @@ -1860,7 +1866,7 @@ export class CallingClass { sendTarget: conversation.toSenderKeyTarget(), sendType: 'callingMessage', timestamp, - urgent: false, + urgent, }), { messageIds: [], sendType: 'callingMessage' } ) @@ -1966,6 +1972,7 @@ export class CallingClass { } } + // Used for all 1:1 call messages, including the initial message to start the call private async handleOutgoingSignaling( remoteUserId: UserId, message: CallingMessage, @@ -1981,12 +1988,18 @@ export class CallingClass { return false; } + // We want 1:1 call initiate messages to wake up recipient devices, but not others + const urgent = + urgency === CallMessageUrgency.HandleImmediately || + Boolean(message.offer); + try { assertDev(isAciString(remoteUserId), 'remoteUserId is not a aci'); const result = await handleMessageSend( window.textsecure.messaging.sendCallingMessage( remoteUserId, callingMessageToProto(message, urgency), + urgent, sendOptions ), { messageIds: [], sendType: 'callingMessage' } diff --git a/ts/textsecure/SendMessage.ts b/ts/textsecure/SendMessage.ts index 27f40b4bea9d..b57d79bcac54 100644 --- a/ts/textsecure/SendMessage.ts +++ b/ts/textsecure/SendMessage.ts @@ -1702,6 +1702,7 @@ export default class MessageSender { async sendCallingMessage( serviceId: ServiceIdString, callingMessage: Readonly, + urgent: boolean, options?: Readonly ): Promise { const recipients = [serviceId]; @@ -1727,7 +1728,7 @@ export default class MessageSender { contentHint: ContentHint.DEFAULT, groupId: undefined, options, - urgent: true, + urgent, }); }