oncall-engine/engine/apps
Innokentii Konstantinov 1f786e8d2a
Phone provider refactoring (#1713)
# What this PR does
This PR moves phone notification logic into separate object PhoneBackend
and introduces PhoneProvider interface to hide actual implementation of
external phone services provider. It should allow add new phone
providers just by implementing one class (See SimplePhoneProvider for
example).
# Why 
[Asterisk PR](https://github.com/grafana/oncall/pull/1282) showed that
our phone notification system is not flexible. However this is one of
the most frequent community questions - how to add "X" phone provider.
Also, this refactoring move us one step closer to unifying all
notification backends, since with PhoneBackend all phone notification
logic is collected in one place and independent from concrete
realisation.
# Highligts
1. PhoneBackend object - contains all phone notifications business
logic.
2. PhoneProvider - interface to  external phone services provider.
3. TwilioPhoneProvider and SimplePhoneProvider - two examples of
PhoneProvider implementation.
4. PhoneCallRecord and SMSRecord models. I introduced these models to
keep phone notification limits logic decoupled from external providers.
Existing TwilioPhoneCall and TwilioSMS objects will be migrated to the
new table to not to reset limits counter. To be able to receive status
callbacks and gather from Twilio TwilioPhoneCall and TwilioSMS still
exists, but they are linked to PhoneCallRecord and SMSRecord via fk, to
not to leat twilio logic into core code.

---------

Co-authored-by: Yulia Shanyrova <yulia.shanyrova@grafana.com>
2023-05-24 06:27:48 +00:00
..
alerts Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
api Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
api_for_grafana_incident Include alert details in Grafana Incident alert-group endpoint (#1280) 2023-02-03 13:43:21 +00:00
auth_token Improve plugin authentication (#1995) 2023-05-23 16:13:25 +00:00
base Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
email Fix inbound email bug when attaching files (#1970) 2023-05-18 17:35:36 +00:00
grafana_plugin Improve plugin authentication (#1995) 2023-05-23 16:13:25 +00:00
heartbeat Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
integrations Add docs & logo for AppDynamics integration (#1916) 2023-05-11 16:41:51 +00:00
mobile_app Test mobile push (#1933) 2023-05-18 15:52:42 +08:00
oss_installation Add database migrations linter (#1020) 2023-02-06 16:01:37 +08:00
phone_notifications Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
public_api Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
schedules Refactor upcoming shifts to use cached final schedule data (#1891) 2023-05-08 19:01:24 +00:00
slack Slack: use user_profile_changed event instead of user_change (#1938) 2023-05-15 16:32:06 +00:00
social_auth Fix insight_logs exceptions (#1757) 2023-04-17 07:16:18 +00:00
telegram Fix SQLite permission issue (#1984) 2023-05-22 19:16:31 +00:00
twilioapp Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
user_management Phone provider refactoring (#1713) 2023-05-24 06:27:48 +00:00
webhooks Webhook response check content length instead of header for length limit (#1900) 2023-05-09 13:55:05 +00:00
__init__.py World, meet OnCall! 2022-06-03 08:09:47 -06:00