restore international numbers

This commit is contained in:
Kenneth Kehl
2025-04-03 08:02:08 -07:00
parent 555b10d793
commit e9ea22ad6d
5 changed files with 89 additions and 84 deletions

View File

@@ -48,7 +48,9 @@ class AwsSnsClient(SmsClient):
def send_sms(self, to, content, reference, sender=None, international=False):
matched = False
for match in phonenumbers.PhoneNumberMatcher(to, "US"):
if "+" not in to:
to = f"+{to}"
for match in phonenumbers.PhoneNumberMatcher(to, None):
matched = True
to = phonenumbers.format_number(
match.number, phonenumbers.PhoneNumberFormat.E164