Skip to main content

python3-cyberfusion-pagerduty-voys-webhook

Webhook server to dynamically route Voys calls to on-call PagerDuty users.

This webhook server is intended to route phone calls (handled by VoIP provider Voys) to users that are on-call on PagerDuty - without having to keep both in sync manually.

When using the webhook offered by this program in your Voys dial plan (see instructions under 'Configure'), calls are routed to the phone number specified in the PagerDuty user's 'Notification Rules'.

If multiple PagerDuty users are on-call, calls are routed to a random user. If the chosen PagerDuty user has multiple phone numbers, a random one is chosen.

Install

PyPI

Run the following command to install the package from PyPI:

pip3 install python3-cyberfusion-pagerduty-voys-webhook

Debian

Run the following commands to build a Debian package:

mk-build-deps -i -t 'apt -o Debug::pkgProblemResolver=yes --no-install-recommends -y'
dpkg-buildpackage -us -uc

Configure

  • Place your PagerDuty API key in /etc/pagerduty-voys-webhook/api_key (regular text file). See instructions under 'Configure'.
  • Place a randomly generated secret key in /etc/pagerduty-voys-webhook/secret_key (regular text file). When calling the webhook, this key must be specified - as a security measure. For example, you can generate a random secret using openssl: openssl rand -hex 32
  • Place the escalation policy ID in /etc/pagerduty-voys-webhook/escalation_policy_id (regular text file). Users to route calls to are retrieved from this escalation policy. For example, if you have a group of Customer Liaisons to route calls to, you can create a dedicated escalation policy for them.

Usage

Run

The webhook server runs on :::5839.

Manually

Run the app using an ASGI server such as Uvicorn.

systemd

systemctl start pagerduty-voys-webhook-server.service

SSL

Use a proxy that terminates SSL. E.g. HAProxy.

Example HAProxy config

frontend fr_ssl
  bind :::5840 v4v6 ssl crt /etc/ssl/certs/example_com.pem alpn h2,http/1.1 curves secp384r1:secp224r1
  mode http
  use_backend bk_pagerduty_voys_webhook_server

backend bk_pagerduty_voys_webhook_server
  mode http
  balance source
  server localhost ::1:5839 check

Configure

Create PagerDuty API key

  • Log in to PagerDuty.
  • Navigate to Integrations -> API Access Keys.
  • Click 'Create New API Key'.
  • For 'Description', fill in a free-form description.
  • Tick 'Read-only API Key'.
  • Click 'Create Key'.

Add webhook in Voys Freedom

  • Log in to Voys Freedom.
  • Navigate to Admin -> Webhooks.
  • Click 'Add'.
  • For 'Name', fill in a free-form name.
  • For 'Caller id forwarding', select whichever option suits your use case. This option controls which phone number the person sees who the call is routed to.
  • Set 'URL template' to: the URL on which this program runs + /voys-webhook?secret_key= + secret key (from /etc/pagerduty-voys-webhook/secret_key). For example: https://voys-webhook.example.com/voys-webhook?secret_key=r6cZPVkZdqujY6dME5uqDytK

Use webhook in dial plan

  • Log in to Voys Freedom.
  • Navigate to your dial plan.
  • Click 'Edit dial plan'.
  • Click 'add step'.
  • Select your newly added webhook.
  • In the 'HTTP and IVR success' branch, click 'Edit' next to 'Unfilled step'.
  • Select 'Variable destination'.

Optionally, you can specify 'fallback' steps in the 'HTTP or IVR failed' branch. For example, if the specified secret key is invalid, or this program doesn't (properly) respond for any other reason.

For more information, see Voys' own documentation on https://help.voys.nl/integraties-koppelingen-webhooks/webhooks.

(Optional) IP-restrict webhook request

This program returns phone numbers, which might be considered confidential/sensitive.

Although this program requires a secret key for webhook calls, it's recommended to restrict requests to Voys' IP addresses.

Find Voys' outgoing IP addresses here: https://help.voys.nl/netwerk-trunk-videobellen-en-ata/firewall-instellen

Release files for python3-cyberfusion-pagerduty-voys-webhook 1.2

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for python3-cyberfusion-pagerduty-voys-webhook 1.2
File Size Uploaded
python3_cyberfusion_pagerduty_voys_webhook-1.2.tar.gz 5.1 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for python3-cyberfusion-pagerduty-voys-webhook 1.2
File Interpreter ABI Platform
python3_cyberfusion_pagerduty_voys_webhook-1.2-py3-none-any.whl Python 3 none any Details

Total release size: 11.2 kB

Release files / python3_cyberfusion_pagerduty_voys_webhook-1.2.tar.gz

Download URL python3_cyberfusion_pagerduty_voys_webhook-1.2.tar.gz
Size 5.1 kB
Tags Source
SHA-256 checksum
How to use checksums
442799e7d2f1bbb7b0288b015431aa2b0d8887eefb06b3a051128453f0406c2b
BLAKE2b-256 checksum
How to use checksums
610e8c95d48deb727ad6712e576ed3c33936651065cc15190026b2ce53abdb78
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release files / python3_cyberfusion_pagerduty_voys_webhook-1.2-py3-none-any.whl

Download URL python3_cyberfusion_pagerduty_voys_webhook-1.2-py3-none-any.whl
Size 6.1 kB
Tags Python 3
SHA-256 checksum
How to use checksums
e72eacdb5a61d53bf21b0922f05ab0430a2678d2bdef297a0464c7b9e2480476
BLAKE2b-256 checksum
How to use checksums
43ff13ed0955f4c8ac26d9b60df7f5fbadb524076ac81ce572048f2dcf3ea607
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.2.0 CPython/3.13.11

Release history Release notifications | RSS feed

This release

1.2 This release

2 release files

1.1.2

2 release files

1.1.1

2 release files

1.1

2 release files

1.0.1

2 release files

1.0

2 release files

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page