### Start and Add Participant with Custom Context Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Demonstrates how to set and use custom SIP and VoIP headers, as well as user-to-user information, when starting a new call or adding a participant to an existing call. ```javascript // Setting custom context. // Any combination of only sipHeaders or voipHeaders or both is allowed. const callOptions = { customContext: { voipHeaders: [ {key: 'voip-key-1', value: 'voip-value-1'}, {key: 'voip-key-2', value: 'voip-value-2'} ], sipHeaders: [ {key: 'sip-key-1', value: 'sip-value-1'}, {key: 'sip-key-2', value: 'sip-value-2'} ], userToUser: 'userToUserHeader', }, }; // Starting a call with custom context. callAgent.startCall("USER_ID", callOptions); // adding participant to existing call or transfer with custom context. call.addParticipant("USER_ID", callOptions); // Parsing custom context on the receiver side let info = ''; callAgent.on("incomingCall", (args) => { const incomingCall = args.incomingCall; if (incomingCall.customContext) { if (incomingCall.customContext.userToUser) { info += `userToUser: '${incomingCall.customContext.userToUser}'\n`; } if (incomingCall.customContext.sipHeaders) { incomingCall.customContext.sipHeaders.forEach(header => info += `sip: ${header.key}: '${header.value}'\n`); } if (incomingCall.customContext.voipHeaders) { incomingCall.customContext.voipHeaders.forEach(header => info += `voip: ${header.key}: '${header.value}'\n`); } } }); ``` -------------------------------- ### Access DeviceManager Before CallAgent Initialization Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Shows how to get a DeviceManager instance from CallClient before initializing a CallAgent. This allows for device management and camera previews prior to user authentication or call setup. ```javascript const callClient = new CallClient(); const deviceManager = await callClient.getDeviceManager(); await deviceManager.getCamears(); ``` -------------------------------- ### Install Latest Communication Common Package Source: https://github.com/azure/communication/blob/master/releasenotes/2021-January-26.md Use this command to update the @azure/communication-common package to the latest version. ```bash npm install @azure/communication-common@latest ``` -------------------------------- ### Initialize CallAgent with Display Name Source: https://github.com/azure/communication/blob/master/releasenotes/acs-calling-android-sdk-release-notes.md Example of initializing the CallAgent with a custom display name. This sets the name that will be shown to other participants in a call. ```java CommunicationUserCredential communicationUserCredential = new CommunicationUserCredential(); CallClient callClient = new CallClient(); CallAgentOptions callAgentOptions = new CallAgentOptions(); callAgentOptions.setDisplayName("Alice display name"); Context appContext = this.getApplicationContext(); // From within an Activity class CallAgent callAgent = callClient.createCallAgent(appContext, communicationUserCredential, callAgentOptions) ``` -------------------------------- ### Join a Teams Meeting using TeamsMeetingLinkLocator Source: https://github.com/azure/communication/blob/master/releasenotes/acs-calling-android-sdk-release-notes.md Example of joining a Teams meeting using a meeting link with `TeamsMeetingLinkLocator`. Requires a `CallAgent` and `CommunicationTokenCredential`. ```java CallAgentOptions callAgentOptions = new CallAgentOptions(); callAgentOptions.setDisplayName("My Custom Display name"); CommunicationTokenCredential tokenCredential = new CommunicationTokenCredential(""); CallAgent callAgent = callClient.createCallAgent(tokenCredential, callAgentOptions); android.content.context appContext = this.getApplicationContext(); // From within an activity or fragment string meetingLink = ; TeamsMeetingLinkLocator teamsMeetingLinkLocator = new TeamsMeetingLinkLocator(meetingLink); Call call = callClient.join(appContext, teamsMeetingLinkLocator, joinCallOptions); ``` -------------------------------- ### Get Call Recording API Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Demonstrates how to obtain the call recording feature API object from the core Call API. ```javascript const callRecordingApi = call.api(Features.Recording); ``` -------------------------------- ### Join a Group Call using GroupCallLocator Source: https://github.com/azure/communication/blob/master/releasenotes/acs-calling-android-sdk-release-notes.md Example of joining a group call using the `GroupCallLocator`. Ensure you have a valid `CallAgent` and `CommunicationTokenCredential`. ```java CallAgentOptions callAgentOptions = new CallAgentOptions(); callAgentOptions.setDisplayName("My Custom Display name"); CommunicationTokenCredential tokenCredential = new CommunicationTokenCredential(""); CallAgent callAgent = callClient.createCallAgent(tokenCredential, callAgentOptions); android.content.context appContext = this.getApplicationContext(); // From within an activity or fragment java.util.UUID groupCallId = java.util.UUID.fromString(); GroupCallLocator groupCallLocaltor = new GroupCallLocator(groupCallId); Call call = callClient.join(appContext, groupCallLocaltor, joinCallOptions); ``` -------------------------------- ### Get Environment Info - JavaScript Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Retrieve environment details to check if the current operating system and browser combination is supported by Azure Communication Services. ```javascript const environmentInfo = await callClient.getEnvironmentInfo(); environmentInfo.isSupportedBrowser // browser is supported. ``` -------------------------------- ### Join Teams Meeting with TeamsMeetingCoordinatesLocator Source: https://github.com/azure/communication/blob/master/releasenotes/acs-calling-android-sdk-release-notes.md Example of joining a Teams meeting using the TeamsMeetingCoordinatesLocator. Ensure you have the necessary context and meeting details. ```java CallAgentOptions callAgentOptions = new CallAgentOptions(); callAgentOptions.setDisplayName("My Custom Display name"); CommunicationTokenCredential tokenCredential = new CommunicationTokenCredential(""); CallAgent callAgent = callClient.createCallAgent(tokenCredential, callAgentOptions); android.content.context appContext = this.getApplicationContext(); // From within an activity or fragment string threadId = ; java.util.UUID organizerId = java.util.UUID.fromString(); java.util.UUID tenantId = java.util.UUID.fromString(); string messageId = ; TeamsMeetingCoordinatesLocator teamsMeetingCoordinatesLinkLocator = new TeamsMeetingCoordinatesLocator(meetingLink); Call call = callClient.join(appContext, teamsMeetingCoordinatesLinkLocator, joinCallOptions); ``` -------------------------------- ### Subscribe to Recording Active Changes Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Provides an example of subscribing to the 'isRecordingActiveChanged' event to be notified when the recording status of a call changes. ```javascript const isRecordingActiveChangedHandler = () => { console.log(callRecordingApi.isRecordingActive); }; callRecordingApi.on('isRecordingActiveChanged', isRecordingActiveChangedHandler); ``` -------------------------------- ### Join a group call using GroupLocator Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Example of joining a group call using a group locator. Ensure the correct group ID is provided. ```typescript const groupLocator = { groupId: ''}; callAgent.join(groupLocaltor, {}); ``` -------------------------------- ### Use Features like Transfer in Teams Calls Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Access and utilize features such as call transfer for Teams calls. This example shows how to initiate a transfer to a target participant. ```js const teamsUser = { microsoftTeamsUserId: '' }; const transfer = teamsCall.feature(SDK.Features.Transfer).transfer({ targetParticipant: IDENTIFIER }); ``` -------------------------------- ### Join a Teams meeting using MeetingLinkLocator Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Example of joining a Teams meeting using a meeting link. The meetingLink property should contain a valid Teams meeting URL. ```typescript const teamsMeetingLinkLocator = { meetingLink: ''}; callAgent.join(teamsMeetingLinkLocator, {}); ``` -------------------------------- ### Get Environment Information in Calling SDK Source: https://github.com/azure/communication/blob/master/releasenotes/2022-05-31.md Retrieve environment details from the Azure Communication Services Calling SDK to check browser and OS compatibility. The 'isSupportedBrowser' property indicates if the current environment is supported. ```javascript const environmentInfo = await callClient.getEnvironmentInfo(); environmentInfo.isSupportedBrowser // browser is supported. ``` -------------------------------- ### Start a 1:1 PSTN Call Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Initiate a one-to-one Voice over IP call to a Public Switched Telephone Network (PSTN) number. The phone number must be in E.164 format. ```js const phoneCallee = { phoneNumber: '' } const oneToOneCall = teamsCallAgent.startCall(phoneCallee ); ``` -------------------------------- ### Handle Incoming Calls with Accept and Reject Source: https://github.com/azure/communication/blob/master/releasenotes/acs-calling-android-sdk-release-notes.md Demonstrates how to listen for incoming calls and accept them with specific call options, including setting a desired camera. Requires an existing CallAgent instance. ```java callAgent.addOnIncomingCallListener(new IncomingCallListener() { void onIncomingCall(IncomingCall inboundCall) { // Look for incoming call incomingCall = inboundCall; AcceptCallOptions acceptCallOptions = new AcceptCallOptions(); VideoDeviceInfo desiredCamera = callClient.getDeviceManager().get().getCameraList().get(0); acceptCallOptions.setVideoOptions(new VideoOptions(new LocalVideoStream(desiredCamera, appContext))); Call call = incomingCall.accept(context, acceptCallOptions).get(); } }); ``` -------------------------------- ### Fluent API for StartCallOptions Source: https://github.com/azure/communication/blob/master/releasenotes/acs-calling-android-sdk-release-notes.md Demonstrates the fluent API syntax for configuring call options, allowing chaining of setter methods. ```java StartCallOptions startCallOptions = new StartCallOptions() .setVideoOptions(new VideoOptions(new LocalVideoStream(getCameraToUse(), this.getApplicationContext()))) .setAudioOptions(new AudioOptions().setMuted(false)); ``` -------------------------------- ### Instantiate Multiple CallClient Instances Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Demonstrates how to create multiple CallClient instances, each capable of managing a separate CallAgent for different users. This is useful for applications supporting multiple authenticated users concurrently. ```javascript const callClientUser1 = new CallClient(); const callAgentUser1 = await callClientUser1.createCallAgent(communicationTokenCredentialForUser1, {displayName: 'User1'}); const callClientUser2 = new CallClient(); const callAgentUser2 = await callClientUser2.createCallAgent(communicationTokenCredentialForUser2, {displayName: 'User2'}); ``` -------------------------------- ### Create a Teams Call Agent Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Initialize the `CallClient` and create a `teamsCallAgent` using a user token credential. This is the entry point for making Teams calls. ```js const userToken = ''; callClient = new CallClient(); const tokenCredential = new AzureCommunicationTokenCredential(userToken); const teamsCallAgent = await callClient.createTeamsCallAgent(tokenCredential); ``` -------------------------------- ### Get Call Transfer API Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Demonstrates how to obtain the call transfer feature API object from the core Call API. ```javascript const callTransferApi = call.api(Features.Transfer); ``` -------------------------------- ### Get Transfer State and Error Information Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Retrieves the current state of a call transfer and any associated error information if the transfer failed. ```js // transfer state const transferState = transfer.state; // None | Transferring | Transferred | Failed // to check the transfer failure reason const transferError = transfer.error; // transfer error code that describes the failure if transfer request failed ``` -------------------------------- ### Join a Room Call Source: https://github.com/azure/communication/blob/master/releasenotes/acs-calling-android-sdk-release-notes.md Demonstrates how to join a call within a room using the RoomCallLocator. Ensure you have the necessary context and call agent initialized. ```java val roomCallLocator = RoomCallLocator(roomId) call = callAgent.join(applicationContext, roomCallLocator, joinCallOptions) ``` -------------------------------- ### Define CallInfo Interface Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Defines the CallInfo interface for Call and IncomingCall, including methods to get conversation URL and properties for group ID. ```typescript export interface CallInfo { getConversationUrl(): Promise; // needed for ACS Server calling API readonly groupId: string | undefined; // used in join group scenario } ``` -------------------------------- ### Configure Logger Verbosity Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Demonstrates how to set the log level for the Azure Communication Services Calling library using the setLogLevel function from @azure/logger. ```javascript import { setLogLevel } from '@azure/logger'; // configure log level setLogLevel('verbose'); const callClient = new CallClient(); ``` -------------------------------- ### Subscribe to Participants and Stream Updates Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md This snippet shows how to subscribe to participants currently in a call and handle updates for their video and screensharing streams. It also demonstrates subscribing to new participants joining and unsubscribing from those who leave. ```javascript // Subscribe to participants currently in a Call call.remoteParticipants.forEach(p => { subscribeToRemoteParticipant(p); }) call.on('remoteParticipantsUpdated', e => { // Subscribe to new participants in the call e.added.forEach( p=> { subscribeToRemoteParticipant(p) }) e.removed.forEach( p => { unsubscribeToRemoteParticipant(p) }) }); function subscribeToParticipant(p) { // Subscribe to participant's current video/screensharing streams p.videoStreams.forEach(v => { handleRemoteStream(v) }); // Subscribe to particiapnt's new video/screensharing streams p.on('videoStreamsUpdated', e => { e.added.forEach(v => { handleRemoteStream(v) }) }) } ``` -------------------------------- ### Get Dominant Speakers List Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Retrieve the current list of dominant speakers in a call. The list is ranked, with the most recent active speaker first. Requires the `callDominantSpeakersApi` object. ```typescript let dominantSpeakers: DominantSpeakersInfo = callDominantSpeakersApi.dominantSpeakers; ``` -------------------------------- ### Obtain Call Transcription Feature API Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Illustrates how to get the transcription feature API object from a call instance. This is the first step to managing or monitoring call transcription. ```javascript const callTranscriptionFeature = call.api(Features.Transcription); ``` -------------------------------- ### Start a 1:1 VoIP Call with Teams Identity Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Initiate a one-to-one Voice over IP call to a Microsoft Teams user. Requires the Teams user's ID. ```js const userCallee = { microsoftTeamsUserId: '' }; const oneToOneCall = teamsCallAgent.startCall(userCallee); ``` -------------------------------- ### Accept Incoming Call with Microphone Muted Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Demonstrates how to accept an incoming call while ensuring the microphone is muted upon joining. This is useful for scenarios where users prefer to join a call silently. ```typescript incomingCall.accept({audioOptions: { muted: true}}) ``` -------------------------------- ### Get Call Dominant Speakers API Object Source: https://github.com/azure/communication/blob/master/releasenotes/acs-javascript-calling-library-release-notes.md Obtain the API object for managing dominant speakers in a call. This is a prerequisite for accessing dominant speaker information or events. ```javascript const callDominantSpeakersApi = call.api(Features.CallDominantSpeakers); ```