Skip to content

maximo/broadvoice_prototype

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

22 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

broadvoice Prototype

This is a prototype of a call controller using Broadvoice APIs in Python 3.7. There are 2 parts to it.

There's a web service to receive signaling events from Broadvoice (i.e. incoming call, DMTF input, etc). This web service is developed using the Flask framework. The web routes are defined in the app/routes.py file.

To send signaling commands to Broadvoice (i.e transfer call, place call on hold with Moh, start recording, etc), the call.py file builds these requests using Broadvoice's REST APIs. This cli is not integrated with the web service.

Install Requirements

To install the required modules, run the following command from a terminal.

pip install -r requirements.txt or alternatively pip3 install -r requirements.txt

This will install the following:

  • virtualenv pip install virtualenv or pip3 install virtualenv
  • ngrok npm install ngrok
  • Flask pip install Flask or pip3 install Flask
  • requests pip install requests or pip3 install requests

Install Direnv

If you don't already have direnv installed, run the following command:

pip install direnv or pip3 install direnv

Modify your shell profile (i.e. ~/.bash_profile) by adding the following:

eval "$(direnv hook bash)"

Restart your shell so the environment variables defined in .envrc are loaded when nagivating to this project from a terminal window.

Create Python Virtual Environment

Flask runs in a Python3 virtual environment. To create this virtual environment, run the following command:

python3 -m venv ve

This create a virtual environment named ve. You can change this name to your liking.

Configure Ngrok

To expose the flask web service externally, run ngrok passing the default port number used by the Flask web service. This would be 5000 from the URL http://127.0.0.1:5000. If the Flask web service uses a different port number, you'll need it instead of 5000.

ngrok/bin/ngrok http 5000

Run Web Service

Before starting the web service, activate the virtual environment (created in the previous section) by running the following command:

source ve/bin/activate

Next, modify the file, .envrc, to specify the ngrok URL in the environment variable NGROK_CALLBACK. Then run the following command:

direnv allow

To start the Flask web service, open a terminal window, navigate to this folder, and run the following command:

flask run

Configure callback URL

For Broadvoice to send signaling events to your Flask web service, it needs the URL to the Flask web service running locally exposed externally by ngrok. Use the following steps to configure this callback URL. The callback URL is called by Broadvoice when a signaling event occurs.

  1. Sign-in to the Broadvoice dashboard.
  2. Navigate to Settings -> Destinations -> Call Flow.
  3. click Edit on the Remote Call Flow entry.
  4. Modify the Response URL with the ngrok URL (see Configure Ngrok section) as shown in the below screenshot.

screenshot for where to configure the response URL to the Flask web service

Broadvoice Documentation

  1. https://github.com/xbpio/cpaas-docs/wiki
  2. http://developer.voipment.com/
  3. https://github.com/xbpio/cpaas-docs/wiki/REST-API

This project is under development

About

Prototyping a call controller using Broadvoice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages