Hi Zoho Corporation,
Yes, this is expected behavior.
When retrieving the agent's phone number using:
CallAgent``.TeamsCallAgentImpl.getUserProperties().phoneNumber
The SDK may return the number without the '+' prefix, such as 1925XXXXXXX
. This is because the SDK does not enforce E.164 formatting on the agent's own number in this context. The format returned depends on how the number was provisioned or stored in the ACS resource.
In contrast, for incoming PSTN calls, the caller's number is returned in E.164 format (e.g., +1925XXXXXXX) via:
TeamsIncomingCallImp.callerInfo.identifier.phoneNumber
This is consistent with telephony standards, where incoming numbers are expected to be in E.164 format for interoperability and identification.
Normalize Agent's Number to E.164 Format
To ensure consistency across your application, you can normalize the agent’s number manually. simple JavaScript utility:
function normalizeToE164(phoneNumber, countryCode = '+1') {
if (!phoneNumber.startsWith('+')) {
return `${countryCode}${phoneNumber}`;
}
return phoneNumber;
}
// Example usage
const rawNumber = callAgent.getUserProperties().phoneNumber;
const normalizedNumber = normalizeToE164(rawNumber);
Let me know, if you need further assistance.