/node-call-tracker

A Call Tracking example using the Nexmo Voice API written in Node

Primary LanguageJavaScriptMIT LicenseMIT

Calling Tracking Demo using Node and the Nexmo Voice API

This app used the Nexmo Voice API to demonstrate how a call tracking application could be built.

  • The call is tracked
  • Incoming calls are proxied to a destination number

You can read the detailed tutorial on Nexmo's Developer Portal about call tracking; this repo is the sample code to accompany that tutorial.

Prerequisites

You will need:

  • At least one Nexmo Virtual Number (Phone Number)
  • The Nexmo CLI installed
  • Somewhere to host this web app, Heroku or Your Local Machine with ngrok both work well

Installation

git clone https://github.com/nexmo/node-call-tracker.git
cd node-call-tracker
npm install

Setup

Rename the config file:

cp example.env .env

Fill in the values in .env as appropriate.

Edit the following command to use the URL of where your application is hosted. Then run the Nexmo CLI command below and take note of the application universally unique identifier (UUID) it returns:

nexmo app:create demo-app --keyfile private.key http://your-url-here/track-call http://your-url-here/event

Buy numbers for calls that you would like to track. The following example buys the first available number in a given country by country code.

nexmo number:buy --country_code [YOUR_COUNTRY_CODE]

Link each number to the application by running a command like this with the application UUID and the number to link.

nexmo link:app [NUMBER] [app-id]

Running the App

npm start

The application should be available on http://localhost:5000.

Using the App

Call one of the virtual numbers that you rented. The call will be tracked and forwarded to the desired destination number.

You can see a list of tracked calls by accessing http://localhost:5000/tracked-calls.