x

SignalWire Work is here. A complete office, school, or event venue right in your browser. Sign up for a 30-DAY FREE TRIAL or Learn more.

Snippet: Dial By Voice Directory

This snippet will show you how to implement a dial by voice directory - to lookup a contact in your datasource and dial them by voice. This example can be expanded to use LDAP or any datasource.

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.

  • Python
  • SignalWire SDK
  • SignalWire Phone Number
  • Docker (Optional)
Methods and Endpoints
Endpoint: /dial-prompt
Methods: GET OR POST
Handles incoming LaML requests for provisioned phone number, and prompts user to say a name, and performs lookup against a directory, and asks them if the wish to dial the contact. Speech Input: (Yes or No)  If contact is not found, it will prompt again.

Endpoint: /dial-verify
Methods: GET OR POST
Dials the number, after a successful Yes. is detected and verified from the user.  If the user does not say Yes. they get a goodbye message.
Configure Your Directory
[
  {
    "Id": "1",
    "First_Name": "Kevin",
    "Last_Name": "Garabedian",
    "Address": "+15554327812"
  },
  {
    "Id": "2",
    "First_Name": "John",
    "Last_Name": "Smith",
    "Address": "+15551234567"
  },
  {
    "Id": "3",
    "First_Name": "Mr",
    "Last_Name": "Magoo",
    "Address": "+15551234567"
  }
]


Build and Run on Docker

Let's get started!

  • Use our pre-built image from Docker Hub:
For Python:
docker pull signalwire/snippets-dial-by-voice-directory:python
  • Or build your own image:
docker build -t snippets-dial-by-voice-directory .
  • Run your image:
docker run --publish 5000:5000 snippets-dial-by-voice-directory
  • The application will run on port 5000
Build and Run Natively

For Python:

1. Replace environment variables
2. 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.