How to Protect Users' Private Information With Calls by Proxy

Facilitating voice or text communication between two parties by a proxy

Kevin Garabedian | Stack Engineer

Jun 05, 2020

Many of the apps we rely on daily cleverly link providers of services with consumers of those services - and sometimes there is a need for the two parties to communicate by voice or text, even though they don't want or need to know each others' phone numbers.

This is exactly where today's code snippet fits in.

It facilitates voice or text communication between two parties by a proxy in the middle that keeps the base identities of each party hidden - while allowing them to identify each other by convenient labels.

Getting Started

You will need a machine with Python installed, the SignalWire SDK, a provisioned SignalWire phone number, and optionally Docker if you decide to run it in a container.

For this demo we will be using Python, but more languages may become available soon.

Running Call/Text By Proxy - How It Works

Methods and Endpoints:

Endpoint: /lookup-session
Methods: GET OR POST
When this is called, it will lookup an active proxy session and bascially create a back to back phone call that is proxied, or a proxied text message.  LEG A <-> SIGNALWIRE PROXY <-> LEG B 

Setup Your Environment File
  1. Copy from example.env and fill in your values
  2. Save new file called .env

Your file should look something like this:

## This is the full name of your SignalWire Space. e.g.:
# Your Project ID - you can find it on the `API` page in your Dashboard.
# Your API token - you can generate one on the `API` page in your Dashboard
# The proxy 1 phone number you'll be using for this Snippets. Must include the `+1` , e$
# The proxy 2 phone number you'll be using for this Snippets. Must include the `+1` , e$

Modify Your Proxy Session File:

  1. Edit proxy_sessions.json
    "Session_Id": "Demo123",
    "Participant_A_Number": "+15551237654",
    "Participant_B_Number": "+15553883000",
    "Proxy_Number": "+15556611212"
    "Session_Id": "Demo234",
    "Participant_A_Number": "+15555181212",
    "Participant_B_Number": "+12347896543",
    "Proxy_Number": "+15556611212"

Build and Run on Docker
  • Use our pre-built image from Docker Hub
For Python:
docker pull signalwire/snippets-call-text-proxy:python
  • Or build your own image
docker build -t snippets-call-text-proxy .
  • Run your image
docker run --publish 5000:5000 --env-file .env snippets-call-text-proxy
  • The application will run on port 5000
  • Build and Run Natively For Python
1. Replace environment variables
2. From command line run, python3

More Documentation:

You can find more documentation on LaML, Relay, and all SignalWire APIs at:


If you have any issues or questions, please open an issue on this repo or join our fantastic Slack community and chat with others in the SignalWire community!

If you need assistance or support with your SignalWire services please file a support ticket from your Dashboard.