diff --git a/sdk/communication/communication-calling-server/review/communication-calling-server.api.md b/sdk/communication/communication-calling-server/review/communication-calling-server.api.md index 96c36f8dd990..2b8fbf68cfe8 100644 --- a/sdk/communication/communication-calling-server/review/communication-calling-server.api.md +++ b/sdk/communication/communication-calling-server/review/communication-calling-server.api.md @@ -16,7 +16,7 @@ import { TransferProgressEvent } from '@azure/core-http'; // @public export interface AddParticipantOptions extends OperationOptions { - alternateCallerId?: string; + alternateCallerId?: PhoneNumberIdentifier; operationContext?: string; } @@ -395,7 +395,7 @@ export interface TransferToCallOptions extends OperationOptions { // @public export interface TransferToParticipantOptions extends OperationOptions { - alternateCallerId?: string; + alternateCallerId?: PhoneNumberIdentifier; operationContext?: string; userToUserInformation?: string; } diff --git a/sdk/communication/communication-calling-server/src/callConnection.ts b/sdk/communication/communication-calling-server/src/callConnection.ts index 82d1367c5061..c86643ac4d78 100644 --- a/sdk/communication/communication-calling-server/src/callConnection.ts +++ b/sdk/communication/communication-calling-server/src/callConnection.ts @@ -462,10 +462,11 @@ export class CallConnectionImpl implements CallConnection { operationOptions ); const alternateCallerId = - typeof restOptions?.alternateCallerId === "undefined" - ? restOptions?.alternateCallerId - : serializeCommunicationIdentifier({ phoneNumber: restOptions.alternateCallerId }) - .phoneNumber; + restOptions.alternateCallerId == null + ? undefined + : serializeCommunicationIdentifier({ + phoneNumber: restOptions.alternateCallerId.phoneNumber + }).phoneNumber; const request: AddParticipantRequest = { participant: serializeCommunicationIdentifier(participant), @@ -762,10 +763,11 @@ export class CallConnectionImpl implements CallConnection { ); const alternateCallerId = - typeof restOptions?.alternateCallerId === "undefined" - ? restOptions?.alternateCallerId - : serializeCommunicationIdentifier({ phoneNumber: restOptions.alternateCallerId }) - .phoneNumber; + restOptions.alternateCallerId == null + ? undefined + : serializeCommunicationIdentifier({ + phoneNumber: restOptions.alternateCallerId.phoneNumber + }).phoneNumber; const request: TransferToParticipantRequest = { targetParticipant: serializeCommunicationIdentifier(targetParticipant), diff --git a/sdk/communication/communication-calling-server/src/callingServerClient.ts b/sdk/communication/communication-calling-server/src/callingServerClient.ts index 92f14d7e58af..accc87001649 100644 --- a/sdk/communication/communication-calling-server/src/callingServerClient.ts +++ b/sdk/communication/communication-calling-server/src/callingServerClient.ts @@ -192,17 +192,20 @@ export class CallingServerClient { operationOptions ); + const alternateCallerId = + restOptions.alternateCallerId == null + ? undefined + : serializeCommunicationIdentifier({ + phoneNumber: restOptions.alternateCallerId.phoneNumber + }).phoneNumber; + const request: CreateCallRequest = { source: serializeCommunicationIdentifier(source), targets: targets.map((m) => serializeCommunicationIdentifier(m)), callbackUri: restOptions.callbackUrl, requestedMediaTypes: restOptions.requestedMediaTypes, requestedCallEvents: restOptions.requestedCallEvents, - alternateCallerId: - restOptions.alternateCallerId == null - ? undefined - : { value: restOptions.alternateCallerId.phoneNumber }, - subject: restOptions.subject + alternateCallerId: alternateCallerId }; try { @@ -379,16 +382,17 @@ export class CallingServerClient { "ServerCallRestClient-AddParticipant", operationOptions ); - const alternate_caller_id = - typeof restOptions?.alternateCallerId === "undefined" - ? restOptions?.alternateCallerId - : serializeCommunicationIdentifier({ phoneNumber: restOptions.alternateCallerId }) - .phoneNumber; + const alternateCallerId = + restOptions.alternateCallerId == null + ? undefined + : serializeCommunicationIdentifier({ + phoneNumber: restOptions.alternateCallerId.phoneNumber + }).phoneNumber; const request: AddParticipantWithCallLocatorRequest = { callLocator: callLocator, participant: serializeCommunicationIdentifier(participant), - alternateCallerId: alternate_caller_id, + alternateCallerId: alternateCallerId, operationContext: restOptions?.operationContext, callbackUri: callbackUrl }; diff --git a/sdk/communication/communication-calling-server/src/models.ts b/sdk/communication/communication-calling-server/src/models.ts index 8cbaec2662b5..1a424bdacf0c 100644 --- a/sdk/communication/communication-calling-server/src/models.ts +++ b/sdk/communication/communication-calling-server/src/models.ts @@ -86,7 +86,7 @@ export interface PlayAudioOptions extends OperationOptions { */ export interface TransferToParticipantOptions extends OperationOptions { /** The alternate identity of the source of the call if dialing out to a pstn number */ - alternateCallerId?: string; + alternateCallerId?: PhoneNumberIdentifier; /** The user to user information. */ userToUserInformation?: string; /** The value to identify context of the operation. */ @@ -112,8 +112,8 @@ export type PlayAudioToParticipantOptions = PlayAudioOptions; * Options to add participant to the call. */ export interface AddParticipantOptions extends OperationOptions { - /** The phone number to use when adding a pstn participant. */ - alternateCallerId?: string; + /** The phone number identity to use when adding a pstn participant. */ + alternateCallerId?: PhoneNumberIdentifier; /** The operation context. */ operationContext?: string; }