PaCT ID is a Twilio-powered local-to-international calling bridge. It allows you to call and receive calls across borders using local Twilio numbers while preserving caller IDs β with a handy PWA frontend for mobile dialing.
What does PaCT ID stand for?
Probably Cheaper To Internationally Dial
Ironically, it's actually much cheaper. From 'research', Leo found that it costs like Β£0.025 per minute going from a UK -> US, and his data plan is like Β£0.13 a minute, so big savings.
Someone's probably going to reverse engineer my server and find all my numbers, so it'll end out to be more expensive when they f me with twilio bills.
-
Inbound Calls from Others
- If someone calls your US Twilio number, it's forwarded to your UK personal number via your UK Twilio number, showing the original US caller ID.
- If someone calls your UK Twilio number, it's forwarded to your US personal number via your US Twilio number, showing the original UK caller ID.
-
Outbound Calls from You
- If you call the UK Twilio number, you're prompted to enter a number (e.g., a US number) [then press hash], and it connects using your US Twilio number, showing your personal UK number as caller ID.
- If you call the US Twilio number, you're prompted to enter a number (e.g., a UK number) [then press hash], and it connects using your UK Twilio number, showing your personal US number as caller ID.
- Local-to-international call bridging
- Full preservation of original caller IDs
- Web-based PWA dialler interface - hosted seperately
- Secure Cloudflare Tunnel support
- Call normalisation (07 and +44 formats accepted)
- Configurable via environment variables
- A Linux VPS (e.g. Ubuntu 22.04 or later)
- Python 3.8+ installed
cloudflared
for secure tunnel to Twilio- Two Twilio phone numbers (1x US, 1x UK)
- Your personal phone number(s) in both regions
git clone https://github.com/leowilkin/pactid.git
cd pactid
python3 -m venv venv
source venv/bin/activate
pip install -r requirements.txt
nano .env
sudo nano /etc/systemd/system/twilio.service
In development
In that crispy new file, paste this weird ass code in, and apparently it makes it run automatically which is pretty neat.
Then hit it with an enable & start
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl enable twilio
sudo systemctl start twilio
In production
"Apparently" using Flask servers in prod isn't such a good idea, so when you're running it for realsies, use this systemd file
Then hit it with an refresh
sudo systemctl daemon-reexec
sudo systemctl daemon-reload
sudo systemctl refresh twilio
- Go to dash.cloudflare.com, and enter Zero Trust
- Networks > Tunnels
- Create a new tunnel > Cloudflared > name your tunnel
- Debian > 64-bit
- Copy and paste the install code into your terminal
- Once completed, copy and paste the activation code into your terminal
- Next > configure public hostname as twilio.yourdomain.com, and save
Important
You cannot be on a trial account, as you have to have two numbers.
Set the following webhook URLs for your Twilio numbers:
Number Type | Webhook URL |
---|---|
US Number | https://twilio.yourdomain.com/voice_us |
UK Number | https://twilio.yourdomain.com/voice_uk |
These should be set as the Voice & Fax > A Call Comes In handler (Webhook + TwiML).
Coolify just needs a Dockerfile, so point it at this repo and set the build context to the repository root. The image exposes port 8080
; Coolify will map it automatically as long as you set the Internal Port to 8080
in the service settings.
Populate the following environment variables in Coolify (or use secrets) so the container can talk to Twilio:
US_TWILIO_NUMBER
UK_TWILIO_NUMBER
PERSONAL_US
PERSONAL_UK
TWILIO_ACCOUNT_SID
TWILIO_AUTH_TOKEN
Optionally, override the defaults:
PORT
β defaults to8080
GUNICORN_WORKERS
β defaults to2
GUNICORN_THREADS
β defaults to4
Once the container is running, Twilio can reach it at https://<your-domain>/voice_us
, https://<your-domain>/voice_uk
, and https://<your-domain>/text
.
Head on over to leowilkin/pactid-pwa to find out more - currently a WIP.
To view the access logs for the service, on your terminal do:
journalctl -u twilio.service -f
https://thetestcall.blogspot.com/
Find a friend!
Set your MOTD to a custom Linux PaCT ID message so you can remember all those commands easily!
Simply:
nano /etc/motd
and paste:
π You're logged into $(hostname), your PaCT ID server!
Useful commands:
- systemctl stop twilio
- systemctl start twilio && journalctl -u twilio.service -f
- systemctl status twilio
- nano /opt/twilio/bridge.py
Fully reload & restart?
1. sudo systemctl daemon-reexec
2. sudo systemctl daemon-reload
3. sudo systemctl restart twilio.service
Want to re-enable the default MOTD? https://gist.github.com/leowilkin/483f3968681a78f4f8eabf11228209f0
simples π€