Call Tracking Example for Bandwidth Voice and Messaging APIs
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.

README.md

Bandwidth Call Tracking C# Example

Build Status

A Call Tracking app for Bandwidth Voice and Messaging APIs.

Deploy Deploy to Azure

Table of Contents

What this Example Does

Landing Page

The call tracking application lets you create trackable phone numbers for all your marketing needs. Create a new number by specifying the area code you'd like and the phone number you want the call to forward to.

Then for each incoming call you'll get a CNAM (caller id) lookup. As well as the duration of the state of any on-going calls.

This app will:

Prerequisites

Accounts and Machine Setup

Env Variables

  • BANDWIDTH_USER_ID - Something like u-asdf
  • BANDWIDTH_API_TOKEN - Something like t-asf234
  • BANDWIDTH_API_SECRET - Something like asdf123asdf

Deploying Locally with ngrok

Ngrok is an awesome tool that lets you open up local ports to the internet.

Ngrok how

Once you have ngrok installed, open a new terminal tab and navigate to it's location on the file system and run:

./ngrok http 8080

You'll see the terminal show you information

ngrok terminal

Installing and running

Once ngrok is up and running. Open a new tab and clone the repo:

git clone https://github.com/BandwidthExamples/csharp-call-tracking.git
cd csharp-call-tracking

Directly

export BANDWIDTH_USER_ID=<YOUR-USER-ID>
export BANDWIDTH_API_TOKEN=<YOUR-API-TOKEN>
export BANDWIDTH_API_SECRET=<YOUR-API-SECRET>
dotnet restore # to install dependencies
dotnet run

Via Docker

cd CallTracking

# to prepare image
docker build -t my-web-app-dev -f Dockerfile.Development .

# to run the app (it will listen port 8080)
docker run -i -t --rm -p 8080:5000 -e BANDWIDTH_USER_ID=<YOUR-USER-ID> -e BANDWIDTH_API_TOKEN=<YOUR-API-TOKEN> -e BANDWIDTH_API_SECRET=<YOUR-API-SECRET> my-web-app-dev 

Open the app using the ngrok url

When the app runs for the first time, it setups the Bandwidth voice and messaging callbacks for the application for you. It sets the callback urls based on the url visited!

Copy the http://8a543f5f.ngrok.io link and paste it into your browser.

On first run, the application will create the Bandwidth callbacks and voice/messaging application for you. Be sure you visit the ngrok url and not localhost. Bandwidth needs to be able to send callbacks.

Landing Page