How to parse or format phone numbers in a CFA.
Example of grabbing the last 10 characters of the ANI. Sometimes the ANI includes the leading “+” and other times it doesn’t. By parsing the last 10, you don’t have to worry if the ANI contains the plus or not. For example, if the ANI is “+14802654733”, the following will format is as “4802654733”:
Example of parsing out the area code, city code and extension into call attributes from a phone number that contains parentheses, spaces and hyphens. For example, if the phone number attribute is “+1 (480) 265-4733”, the following set phnAreaCode = “480”, phnCityCode = “265” and phnExtension = “4733”:
Example of parsing out any parentheses, spaces and hyphens from a US phone number. For example, if the phone number attribute is “+1 (480) 265-4733”, the following will format is as “14802654733”:
Example of grabbing the first 3 digits from the ANI, excluding the leading “+” if there is one. Useful if you want to parse out the country code from international phone numbers. For example, if the ANI is “+447123456789”, the following will format is as “447”:
Example of adding a wild card characters (useful for Data Exchange lookups that allow wild cards). For example, if the ANI is “+14802654733”, the following will format is as “*480*265*4733”: