Contact Sales

All fields are required

Snippet: Call and Text by Proxy | SignalWire

Snippet: Call and Text by Proxy

This snippet will show you how to create a bi-directional mask for those wishing to hide their phone number for voice and text messages.

If you ever had a situation where you wanted to keep your personal phone number private between two parties, this example will help you out. Services like Lyft, and Uber use technology like this every day to protect passengers and drivers personal phone numbers. There are many use cases for this and we hope you find it helpful.

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

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

  • Python
  • SignalWire SDK
  • SignalWire Phone Number
  • Docker (Optional)


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.: example.signalwire.com
SIGNALWIRE_SPACE=
# Your Project ID - you can find it on the `API` page in your Dashboard.
SIGNALWIRE_PROJECT=
# Your API token - you can generate one on the `API` page in your Dashboard
SIGNALWIRE_TOKEN=
# The proxy 1 phone number you'll be using for this Snippets. Must include the `+1` , e$
SIGNALWIRE_NUMBER_1=+14346613376
# The proxy 2 phone number you'll be using for this Snippets. Must include the `+1` , e$
SIGNALWIRE_NUMBER_2=+14346613377

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

Let's get started!

  • 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. Modify proxy session file
3. From command line run, python3 app.py
More Documentation

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


Support

If you have any issues or want to engage further about this snippet, 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.