Senior Escalations EngineerShane Harrell
Creating an AI Pollster with an Auto Dialer and AMD
SignalWire AI Agent is a powerful low-code tool that allows you to program a voice assistant in a drag-and-drop interface. However, you can use a little bit of extra code to build something more complex. The example below provides everything you need for a simple user interface, including all of the code necessary to add questions and participants into the poll, and the ability to review the poll results.
After all participants and questions have been added, an automated dialer will systematically call each contact and connect them with the AI pollster agent if the call is answered. With the help of AMD, if the call is answered by voicemail, the pollster will simply leave a message.
The AI then retrieves poll questions from the database, and is instructed to only ask questions that are provided to it. For the purposes of this example, the AI agent has been configured to only allow responses on a scale of 1 to 10.
How to set up the AI pollster
Setting up the pollster agent can be broken down into three simple steps:
Clone the following github, which contains all of the necessary code, including a simple configuration UI and a Dockerfile to easily create the environment for the application.
git clone https://github.com/shane-signalwire/sw_dialer_agent_docker
Change into the directory, and then build the Docker container using the following commands:
NOTE: You will need your NGROK API token for this step.
cd sw_dialer_agent_docker # Build the docker image docker build -t ai_dailer_agent –build-arg “NGROK_AUTHTOKEN_ARG=<NGROK AUTH TOKEN>” . # Run the container docker run -p 8000:5000 ai_dialer_agent
Now that the container is running, use a web browser to navigate to the UI to complete configuration of the dialer, poll targets, and poll questions.
In a web browser, navigate to
In the UI shown below, fill out the information for your SignalWire Space URL, SignalWire Project ID, SignalWire API Token, and Caller ID Number.
The Caller ID number must be a SignalWire number, and will also be the number used for connecting to the AI Agent.
Save the dialer configuration. Then you can add poll participants and questions.
Add the list of participants to be called by the dialer. Include first name, last name, and phone number for each contact.
Save each entry into the database before moving on to poll questions.
Add questions for the participant to answer. For this example, these should be questions that can be answered on a scale of 1-10, with 10 being the most positive value.
When all participants and questions have been added, click on START POLL to start the dialer.
Behind the scenes
How do all of the pieces fit together? There are many separate SignalWire offerings working cohesively on the backend to make this whole application work.
The main web application is written in python using the flask module as a front end web server. The application serves both the frontend user interface, and handles the webhooks from SignalWire.
A separate backend process controls the outbound dialer. This script uses the SignalWire RELAY SDK to create a websocket connection and generate the individual calls. When a call is answered, AMD is used to determine whether a human user has answered, or if the call went to voicemail.