Normalize outbound SMS number for job notifications

Replaces 0 with 44 in UK SMS sender number to make it possible to
respond to the SMS from an international number.
This commit is contained in:
Alexey Bezhan
2017-12-18 16:14:09 +00:00
parent 577fe623b0
commit 545ff7dda6
2 changed files with 21 additions and 1 deletions

View File

@@ -14,6 +14,7 @@ from sqlalchemy import UniqueConstraint, CheckConstraint
from notifications_utils.recipients import (
validate_email_address,
validate_phone_number,
try_validate_and_format_phone_number,
InvalidPhoneError,
InvalidEmailError
)
@@ -636,7 +637,7 @@ class TemplateBase(db.Model):
elif self.template_type == EMAIL_TYPE:
return self.service.get_default_reply_to_email_address()
elif self.template_type == SMS_TYPE:
return self.service.get_default_sms_sender()
return try_validate_and_format_phone_number(self.service.get_default_sms_sender())
else:
return None