Hi Dylan Olney,
Thank you for reaching out to Microsoft Q&A.
Azure Communication Services (ACS) does not automatically select the alternateCallerId
based on the recipient’s country code. Instead, you must explicitly specify which caller ID to use when initiating the call.
Since you have two numbers—one for Ireland (+353) and one for Chicago (+1)—you should implement logic in your React app to select the appropriate number before making a call.
const startCall = async () => {
if (!callAgent) {
console.error("Call Agent is not initialized.");
return;
}
const numbersToCall = recipientNumbers.split(",").map((num) => num.trim());
if (numbersToCall.length === 0 || numbersToCall[0] === "") {
console.error("Please enter at least one phone number.");
return;
}
const selectedCallerId = numbersToCall.some(num => num.startsWith("+353"))
? "+353XXXXXXX"
: "+1XXXXXXXXXX";
try {
const currentCall = callAgent.startCall(
numbersToCall.map(num => ({ phoneNumber: num })),
{ alternateCallerId: { phoneNumber: selectedCallerId } }
);
setCall(currentCall);
console.log("Call started using caller ID:", selectedCallerId);
} catch (error) {
console.error("Error starting call:", error);
}
};
Refer this MSDOC and Link for more configuration with react acs.
Modify Your React App for Multiple Calling Numbers So that you can update your React application to handle multiple recipient phone numbers and either allow users to manually select or automatically assign the correct alternateCallerId
based on the recipient's country code.
For more details on configuring ACS with React, refer to the following resources:
Hope this helps.
If the answer is helpful, please click Accept Answer and kindly upvote it. If you have any further questions about this answer, please click Comment.