Refactor code to use inbound_numbers if set

This commit is contained in:
Ken Tsang
2017-08-14 19:47:09 +01:00
parent e14fa2d87e
commit 667ee57a35
8 changed files with 103 additions and 7 deletions

View File

@@ -241,6 +241,12 @@ class Service(db.Model, Versioned):
return cls(**fields)
def get_inbound_number(self):
if self.inbound_number and self.inbound_number.active:
return self.inbound_number.number
else:
return self.sms_sender or current_app.config['FROM_NUMBER']
class InboundNumber(db.Model):
__tablename__ = "inbound_numbers"