Number recognition methods for Vonage or other telephony systems
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-28-2025 09:04 AM
I was asked to integrate Vonage Contact Center into our instance. I did everything as directed by the Vonage setup guide and it is working except for when a call comes in. An interaction record is pulled up and the information of the user is supposed to pull over from sys_user based on the incoming phone number. That number is stored in the phone field in sys_user. Vonage sends the number over as 7275701234 while we have it stored as (727) 570-1234. Any suggestions on how to get the interaction record to normalize the numbers and pull the data?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
03-30-2025 10:41 PM
Hello @Alan42
You need to modify the interaction record creation logic as shown below:
(function processIncomingCall(incomingPhone) {
function normalizePhoneNumber(phoneNumber) {
return phoneNumber ? phoneNumber.replace(/\D/g, '') : ''; // Remove all non-numeric characters and whitespace
}
var normalizedIncomingPhone = normalizePhoneNumber(incomingPhone);
var userGr = new GlideRecord('sys_user');
userGr.addNotNullQuery('phone'); // you can add active true here too
userGr.query();
while (userGr.next()) {
var storedPhone = normalizePhoneNumber(userGr.getValue('phone'));
if (storedPhone === normalizedIncomingPhone) {
gs.info("User found: " + userGr.getValue('name'));
// Create an interaction record and associate the user
var interaction = new GlideRecord('interaction');
interaction.initialize();
interaction.setValue('caller', userGr.getUniqueValue());
interaction.insert();
gs.info("Interaction record created for " + userGr.getValue('name'));
return; // Stop searching after finding a match
}
}
gs.info("No matching user found for phone number: " + incomingPhone);
})('7275701234'); // Replace with dynamic phone number input
Hope that helps!
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2025 06:41 AM
Hi @Alan42
Have you validated the solution proposed?
I'm having similar issue but with different source.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
08-06-2025 06:48 AM
It didn't work. I had to convert the field to e164 for anything to work properly. It was simpler than I thought it would be, using import sets and a transform map was quick, clean, and safe.