Twilio Phone Number Formatting

We purchased the Twilio module (from Kymera, but the IA one looks similar) and are running into some problems with improperly formatted phone numbers for SMS and Voice. We are using AD authentication and pulling contact information in from that source. We are figuring out how to manage the on-call roster better (other than the webpage), but cannot figure out the best way to get the phone numbers formatted exactly as Twilio expects it (+12345678901). I know we can edit the contact information for each user added, but that is so tedious and time consuming. Our AD system has so many variations, and having IT format to this standard for 100k+ entries would be quite the ask (not to mention the data is hand entered and could be incorrectly formatted in the future). I would think some sort of code to handle this would be straightforward, but nothing has been done yet.

Is anyone else faced with this problem? What have you done to resolve it?

This seems like a problem best solved in the IA and/or Kymera module by normalizing/formatting the phone numbers before passing them to the Twilio library, if possible.

Maybe someone else has a better suggestion though…

You could use a ‘Calculated Roster’ and normalize the phone numbers in a script. There is a python library for this purpose that should work in Ignition.

1 Like

Hello Herbie,
I will talk with out developers and see what we can do to help normalize the numbers. Will have someone respond to your email.

Also, using libphonenumber in Java or python-phonenumbers could be used.

@Kyle_Chase, thanks for looking into this. @chi, I was looking into into the Calculated Roster, but I’m not sure how to access the existing list to “condition” the numbers. Is the existing roster passed in on the event or builder objects?

I really don’t want to build the list in a Calculated Roster (which is kind of what this looks to be doing, but I could be wrong.) I must be missing something here.

In the script you can use system.alarm.getRosters() to get your defined rosters. From there you have to get a list of users in the specific roster.
Then iterate over that list and call system.user.getUser and user.getContactInfo() to get the user and its contact information.

Hi Nicholas,
Are you able to get me a list of phone numbers so we can validate the parser vs those numbers? Email them to please.