Skip to content
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Bugfix",
"comment": "Introduce blocking error when giving wrong kind of identifier to createAzureCommunicationCallAdapter",
"packageName": "@azure/communication-react",
"email": "94866715+dmceachernmsft@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
{
"type": "patch",
"area": "fix",
"workstream": "Bugfix",
"comment": "Introduce blocking error when giving wrong kind of identifier to createAzureCommunicationCallAdapter",
"packageName": "@azure/communication-react",
"email": "94866715+dmceachernmsft@users.noreply.github.com",
"dependentChangeType": "patch"
}
Original file line number Diff line number Diff line change
Expand Up @@ -98,14 +98,13 @@ import {
CommunicationTokenCredential,
CommunicationUserIdentifier,
CommunicationIdentifier,
MicrosoftTeamsUserIdentifier
MicrosoftTeamsUserIdentifier,
isMicrosoftTeamsUserIdentifier
} from '@azure/communication-common';
/* @conditional-compile-remove(teams-identity-support) */ /* @conditional-compile-remove(PSTN-calls) */
import { isCommunicationUserIdentifier } from '@azure/communication-common';
/* @conditional-compile-remove(PSTN-calls) */
import {
isCommunicationUserIdentifier,
isPhoneNumberIdentifier,
PhoneNumberIdentifier
} from '@azure/communication-common';
import { isPhoneNumberIdentifier, PhoneNumberIdentifier } from '@azure/communication-common';
import { ParticipantSubscriber } from './ParticipantSubcriber';
import { AdapterError } from '../../common/adapters';
import { DiagnosticsForwarder } from './DiagnosticsForwarder';
Expand Down Expand Up @@ -1452,6 +1451,11 @@ export const createAzureCommunicationCallAdapter = async ({
/* @conditional-compile-remove(PSTN-calls) */ alternateCallerId,
/* @conditional-compile-remove(video-background-effects) */ options
}: AzureCommunicationCallAdapterArgs): Promise<CallAdapter> => {
if (isMicrosoftTeamsUserIdentifier(userId)) {
throw new Error(
'Microsoft Teams user identifier is not supported by AzureCommunicationCallAdapter. Instead use TeamsCallAdapter.'
);
}
return _createAzureCommunicationCallAdapterInner({
userId,
displayName,
Expand Down Expand Up @@ -1521,6 +1525,11 @@ export const createTeamsCallAdapter = async ({
locator,
options
}: TeamsCallAdapterArgs): Promise<TeamsCallAdapter> => {
if (isCommunicationUserIdentifier(userId)) {
throw new Error(
'Communication User identifier is not supported by TeamsCallAdapter, please use our AzureCommunicationCallAdapter.'
);
}
const callClient = _createStatefulCallClientInner(
{
userId
Expand Down