in packages/calling-stateful-client/src/Converter.ts [131:211]
export function convertSdkCallToDeclarativeCall(call: CallCommon): CallState {
const declarativeRemoteParticipants: { [key: string]: DeclarativeRemoteParticipant } = {};
call.remoteParticipants.forEach((participant: SdkRemoteParticipant) => {
declarativeRemoteParticipants[toFlatCommunicationIdentifier(participant.identifier)] =
convertSdkParticipantToDeclarativeParticipant(participant);
});
let hideAttendeeNames = false;
if (
call.feature(Features.Capabilities).capabilities &&
call.feature(Features.Capabilities).capabilities.viewAttendeeNames
) {
const viewAttendeeNames = call.feature(Features.Capabilities).capabilities.viewAttendeeNames;
if (!viewAttendeeNames.isPresent && viewAttendeeNames.reason === 'MeetingRestricted') {
hideAttendeeNames = true;
}
}
let callInfo: TeamsCallInfo | undefined | /* @conditional-compile-remove(calling-beta-sdk) */ CallInfo;
if ('info' in call) {
callInfo = call.info as TeamsCallInfo | undefined | /* @conditional-compile-remove(calling-beta-sdk) */ CallInfo;
}
return {
id: call.id,
kind: _isACSCall(call) ? ('Call' as CallKind) : ('TeamsCall' as CallKind),
callerInfo: call.callerInfo,
state: call.state,
callEndReason: call.callEndReason,
diagnostics: {
network: {
latest: {}
},
media: {
latest: {}
}
},
direction: call.direction,
isMuted: call.isMuted,
isScreenSharingOn: call.isScreenSharingOn,
localVideoStreams: call.localVideoStreams.map(convertSdkLocalStreamToDeclarativeLocalStream),
remoteParticipants: declarativeRemoteParticipants,
remoteParticipantsEnded: {},
recording: { isRecordingActive: false },
/* @conditional-compile-remove(local-recording-notification) */
localRecording: { isLocalRecordingActive: false },
pptLive: { isActive: false },
raiseHand: { raisedHands: [] },
/* @conditional-compile-remove(together-mode) */
togetherMode: { isActive: false, streams: {}, seatingPositions: {} },
localParticipantReaction: undefined,
transcription: { isTranscriptionActive: false },
screenShareRemoteParticipant: undefined,
startTime: new Date(),
endTime: undefined,
role: call.role,
captionsFeature: {
captions: [],
supportedSpokenLanguages: [],
supportedCaptionLanguages: [],
currentCaptionLanguage: '',
currentSpokenLanguage: '',
isCaptionsFeatureActive: false,
startCaptionsInProgress: false,
captionsKind: _isTeamsCall(call) ? 'TeamsCaptions' : 'Captions'
},
realTimeTextFeature: {
realTimeTexts: {},
isRealTimeTextFeatureActive: false
},
transfer: {
acceptedTransfers: {}
},
optimalVideoCount: {
maxRemoteVideoStreams: call.feature(Features.OptimalVideoCount).optimalVideoCount
},
hideAttendeeNames,
info: callInfo,
meetingConference: { conferencePhones: [] }
};
}