Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

add zvonok integration #2339

Merged
merged 20 commits into from
Jul 5, 2023
Merged

add zvonok integration #2339

merged 20 commits into from
Jul 5, 2023

Conversation

sreway
Copy link
Contributor

@sreway sreway commented Jun 26, 2023

Added integration with zvonok.com service.

Features:

  • Phone number validation
  • Test calls
  • Selection of pre-recorded audio
  • Making calls
  • Processing call status
  • Acknowledgment alert group (optional)

To process the call status, it is required to add a postback with the GET method on the side of the zvonok.com service with the following format (more info here):

${ONCALL_BASE_URL}/zvonok/call_status_events?campaign_id={ct_campaign_id}&call_id={ct_call_id}&status={ct_status}&user_choice={ct_user_choice}

The names of the transmitted parameters can be redefined through environment variables.

@sreway sreway requested a review from a team June 26, 2023 11:27
Copy link
Contributor

@joeyorlando joeyorlando left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thanks for the contribution! 😄

do you mind adding trailing newlines to the new files + adding back the trailing newlines to modified files. thank you!

Comment on lines 76 to 78



Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

extra newlines here

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

thank you 🙏 do you mind adding trailing newlines to the new files + adding back the trailing newlines to modified files?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done

Copy link
Member

@Konstantinov-Innokentii Konstantinov-Innokentii left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM, great work. Left some comments.

Besides that comments it is needed to:

  1. Remove links to non-english docs
  2. Add paragraph about this phone provider to https://grafana.com/docs/oncall/latest/open-source/#twilio-setup. It's in the docs folder.


class ZvonokPhoneCall(ProviderPhoneCall, models.Model):
class Meta:
db_table = "zvonok_phonecall"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There is no need to specify db_table here. It was specified for PhoneCallRecord only for migration purposes.

from django.urls import path
from .views import CallStatusCallback, HealthCheck

app_name = "zvonok"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How app_name is used? Could it be removed?



class HealthCheck(APIView):
def get(self, request):

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is this view required by zvonok? If not, let's remove it

}
PHONE_PROVIDER = os.environ.get("PHONE_PROVIDER", default="twilio")

if PHONE_PROVIDER == "zvonok":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I believe we don't need this check, because currently we have no way to make it work as expected.

PHONE_PROVIDER value can be changed via UI, but at this point it still will be twilio, since value is changed through live_settings mechanism and db, not via env.
So, it makes no sense to check value of settings.PHONE_PROVIDER, but live_settings.PHONE_PROVIDER should be checked. However it's impossible, since django checks settings files before apps are loaded. You can try and will receive:
django.core.exceptions.AppRegistryNotReady: Apps aren't loaded yet. Exception.

Also, I think that force-disabling GRAFANA_CLOUD_NOTIFICATIONS_ENABLED is not good idea, since someone might want to switch to cloud notifications after zvonok is configured.

@@ -233,6 +233,7 @@ class DatabaseTypes:
"fcm_django",
"django_dbconn_retry",
"apps.phone_notifications",
"apps.zvonok"

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could you please move enabling of zvonok app to line 685, where we plug-in apps required only for oss?

@@ -67,6 +67,11 @@
path("api/internal/v1/", include("apps.oss_installation.urls", namespace="oss_installation")),
]

if settings.PHONE_PROVIDER == "zvonok":

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It is needed to check live_settings.PHONE_PROVIDER here. If it won't work ( I'm not remember if apps are loaded before urls, you can simply enable zvonok urls if settings.IS_OPEN_SOURCE (line 65)

@sreway
Copy link
Contributor Author

sreway commented Jul 1, 2023

LGTM, great work. Left some comments.

Besides that comments it is needed to:

  1. Remove links to non-english docs
  2. Add paragraph about this phone provider to https://grafana.com/docs/oncall/latest/open-source/#twilio-setup. It's in the docs folder.

Fixed

@Konstantinov-Innokentii Konstantinov-Innokentii added this pull request to the merge queue Jul 5, 2023
Merged via the queue into grafana:dev with commit aeb3500 Jul 5, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants