services/calling: Make logging consistent in startCall functions
Co-authored-by: Scott Nonnenberg <scott@signal.org>
This commit is contained in:
parent
4172abf4d3
commit
024f30aa3a
2 changed files with 35 additions and 19 deletions
|
@ -881,20 +881,23 @@ export class CallingClass {
|
||||||
hasLocalAudio: boolean,
|
hasLocalAudio: boolean,
|
||||||
hasLocalVideo: boolean
|
hasLocalVideo: boolean
|
||||||
): Promise<void> {
|
): Promise<void> {
|
||||||
const logId = 'CallingClass.startOutgoingDirectCall';
|
const conversation = window.ConversationController.get(conversationId);
|
||||||
|
if (!conversation) {
|
||||||
|
log.error(
|
||||||
|
`startOutgoingCall: Could not find conversation ${conversationId}, cannot start call`
|
||||||
|
);
|
||||||
|
this.stopCallingLobby();
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
const idForLogging = getConversationIdForLogging(conversation.attributes);
|
||||||
|
const logId = `startOutgoingDirectCall(${idForLogging}`;
|
||||||
log.info(logId);
|
log.info(logId);
|
||||||
|
|
||||||
if (!this.reduxInterface) {
|
if (!this.reduxInterface) {
|
||||||
throw new Error(`${logId}: Redux actions not available`);
|
throw new Error(`${logId}: Redux actions not available`);
|
||||||
}
|
}
|
||||||
|
|
||||||
const conversation = window.ConversationController.get(conversationId);
|
|
||||||
if (!conversation) {
|
|
||||||
log.error(`${logId}: Could not find conversation, cannot start call`);
|
|
||||||
this.stopCallingLobby();
|
|
||||||
return;
|
|
||||||
}
|
|
||||||
|
|
||||||
const remoteUserId = this.getRemoteUserIdFromConversation(conversation);
|
const remoteUserId = this.getRemoteUserIdFromConversation(conversation);
|
||||||
if (!remoteUserId || !this.localDeviceId) {
|
if (!remoteUserId || !this.localDeviceId) {
|
||||||
log.error(`${logId}: Missing identifier, new call not allowed.`);
|
log.error(`${logId}: Missing identifier, new call not allowed.`);
|
||||||
|
@ -1226,21 +1229,25 @@ export class CallingClass {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
const logId = `joinGroupCall(${getConversationIdForLogging(conversation)})`;
|
||||||
|
log.info(logId);
|
||||||
|
|
||||||
if (
|
if (
|
||||||
!conversation.groupId ||
|
!conversation.groupId ||
|
||||||
!conversation.publicParams ||
|
!conversation.publicParams ||
|
||||||
!conversation.secretParams
|
!conversation.secretParams
|
||||||
) {
|
) {
|
||||||
log.error(
|
log.error(
|
||||||
'Conversation is missing required parameters. Cannot join group call'
|
`${logId}: Conversation is missing required parameters. Cannot join group call`
|
||||||
);
|
);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
||||||
const logId = `joinGroupCall(${getConversationIdForLogging(conversation)})`;
|
|
||||||
const haveMediaPermissions = await this.requestPermissions(hasLocalVideo);
|
const haveMediaPermissions = await this.requestPermissions(hasLocalVideo);
|
||||||
if (!haveMediaPermissions) {
|
if (!haveMediaPermissions) {
|
||||||
log.info('Permissions were denied, but allow joining group call');
|
log.info(
|
||||||
|
`${logId}: Permissions were denied, but allow joining group call`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.startDeviceReselectionTimer();
|
await this.startDeviceReselectionTimer();
|
||||||
|
@ -1259,6 +1266,7 @@ export class CallingClass {
|
||||||
groupCall.ringAll();
|
groupCall.ringAll();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
log.info(`${logId}: Joining in RingRTC`);
|
||||||
groupCall.join();
|
groupCall.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -1553,9 +1561,14 @@ export class CallingClass {
|
||||||
hasLocalAudio: boolean;
|
hasLocalAudio: boolean;
|
||||||
hasLocalVideo: boolean;
|
hasLocalVideo: boolean;
|
||||||
}): Promise<void> {
|
}): Promise<void> {
|
||||||
|
const logId = `joinCallLinkCall(${roomId})`;
|
||||||
|
log.info(logId);
|
||||||
|
|
||||||
const haveMediaPermissions = await this.requestPermissions(hasLocalVideo);
|
const haveMediaPermissions = await this.requestPermissions(hasLocalVideo);
|
||||||
if (!haveMediaPermissions) {
|
if (!haveMediaPermissions) {
|
||||||
log.info('Permissions were denied, but allow joining call link call');
|
log.info(
|
||||||
|
`${logId}: Permissions were denied, but allow joining call link call`
|
||||||
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
await this.startDeviceReselectionTimer();
|
await this.startDeviceReselectionTimer();
|
||||||
|
@ -1577,6 +1590,7 @@ export class CallingClass {
|
||||||
groupCall.setOutgoingVideoMuted(!hasLocalVideo);
|
groupCall.setOutgoingVideoMuted(!hasLocalVideo);
|
||||||
drop(this.enableCaptureAndSend(groupCall));
|
drop(this.enableCaptureAndSend(groupCall));
|
||||||
|
|
||||||
|
log.info(`${logId}: Joining in RingRTC`);
|
||||||
groupCall.join();
|
groupCall.join();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -2342,8 +2342,14 @@ function startCall(
|
||||||
payload: StartCallType
|
payload: StartCallType
|
||||||
): ThunkAction<void, RootStateType, unknown, StartDirectCallActionType> {
|
): ThunkAction<void, RootStateType, unknown, StartDirectCallActionType> {
|
||||||
return async (dispatch, getState) => {
|
return async (dispatch, getState) => {
|
||||||
const { conversationId, hasLocalAudio, hasLocalVideo } = payload;
|
const { callMode, conversationId, hasLocalAudio, hasLocalVideo } = payload;
|
||||||
switch (payload.callMode) {
|
|
||||||
|
const state = getState();
|
||||||
|
const { activeCallState } = state.calling;
|
||||||
|
|
||||||
|
log.info(`startCall for conversation ${conversationId}, mode ${callMode}`);
|
||||||
|
|
||||||
|
switch (callMode) {
|
||||||
case CallMode.Direct:
|
case CallMode.Direct:
|
||||||
await calling.startOutgoingDirectCall(
|
await calling.startOutgoingDirectCall(
|
||||||
conversationId,
|
conversationId,
|
||||||
|
@ -2358,8 +2364,6 @@ function startCall(
|
||||||
case CallMode.Group: {
|
case CallMode.Group: {
|
||||||
let outgoingRing: boolean;
|
let outgoingRing: boolean;
|
||||||
|
|
||||||
const state = getState();
|
|
||||||
const { activeCallState } = state.calling;
|
|
||||||
if (activeCallState?.outgoingRing) {
|
if (activeCallState?.outgoingRing) {
|
||||||
const conversation = getOwn(
|
const conversation = getOwn(
|
||||||
state.conversations.conversationLookup,
|
state.conversations.conversationLookup,
|
||||||
|
@ -2383,8 +2387,6 @@ function startCall(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case CallMode.Adhoc: {
|
case CallMode.Adhoc: {
|
||||||
const state = getState();
|
|
||||||
|
|
||||||
const callLink = getOwn(state.calling.callLinks, conversationId);
|
const callLink = getOwn(state.calling.callLinks, conversationId);
|
||||||
if (!callLink) {
|
if (!callLink) {
|
||||||
log.error(
|
log.error(
|
||||||
|
@ -2406,7 +2408,7 @@ function startCall(
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
default:
|
default:
|
||||||
throw missingCaseError(payload.callMode);
|
throw missingCaseError(callMode);
|
||||||
}
|
}
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue