Voice Proxy example in Node.JS using the Nexmo Voice API
Latest commit 220b00d Jan 10, 2017 @leggetter leggetter committed on GitHub Merge pull request #7 from Nexmo/config-ex
Adding configuration details
Failed to load latest commit information.


Voice Proxy using the Nexmo Voice API


Getting Started

Create a Nexmo App

Create an application and take a note of the application UUID:

nexmo app:create voice-proxy https://example.com/proxy-call https://example.com/event

Note 1: You may also want to save the private key file that is returned. You won't be able to get this again.

If you don't know the URLs for your proxy-call and event webhooks yet you can update them later e.g.

nexmo app:update APP_ID voice-proxy https://example.com/proxy-call https://example.com/event


Copy the example.env to .env and update the content as appropriate:

cp example.env .env

Configuration is as follows:

Environment Variable Required? Description
NEXMO_API_KEY Yes Your Nexmo API key (Get from the Nexmo Dashboard)
NEXMO_API_SECRET Yes Your Nexmo API secret (Get from the Nexmo Dashboard)
NEXMO_APP_ID Yes The id generated when you created your Nexmo application.
NEXMO_DEBUG No Determines if interactions with the Nexmo API should be logged to the console. A non-falsy value will result in debug being on
PROVISIONED_NUMBERS No If supplied it should be in the format [{"country":"GB","msisdn":"NUMBER_1"},{"country":"GB","msisdn":"NUMBER_2"}]

Run the App

Start the application:

npm start


To indicate that a conversation between two users should be allowed navigate to the following replacing FROM_NUMBER and TO_NUMBER with e.164 formatting international numbers (e.g. 14155550123):


In a real system this conversation would be set up by an automated process.

To check the existing ongoing conversations navigate to:


You should see a response such as the following:


This tells us there are two participants and gives us the details of their real number and their assigned virtual number.

  • If you make a call from a UserA's real number to UserB's virtual number the call will be proxied to UserB's real number and the from number will be show as UserA's virtual number.
  • If you make a call from a UserB's real number to UserA's virtual number the call will be proxied to UserA's real number and the from number will be show as UserB's virtual number.