Log in to your or sign up for a Vonage APIs account.
Go to Your applications, access an existing application or + Create a new application.
Under Capabilities section (click on [Edit] if you do not see this section):
Enable Voice
- Under Answer URL, leave HTTP GET, and enter https://<host>:<port>/answer (replace <host> and <port> with the public host name and if necessary public port of the server where this sample application is running)
- Under Event URL, select HTTP POST, and enter https://<host>:<port>/event (replace <host> and <port> with the public host name and if necessary public port of the server where this sample application is running)
Note: If you are using ngrok for this sample application, the answer URL and event URL look like:
https://yyyyyyyy.ngrok.io/answer
https://yyyyyyyy.ngrok.io/event - Click on [Generate public and private key] if you did not yet create or want new ones, save the private key file in this application folder as .private.key (leading dot in the file name).
IMPORTANT: Do not forget to click on [Save changes] at the bottom of the screen if you have created a new key set. - Link a phone number to this application if none has been linked to the application.
Please take note of your application ID and the linked phone number (as they are needed in the very next section).
For the next steps, you will need:
- Your Vonage API key (as
API_KEY) - Your Vonage API secret, not signature secret, (as
API_SECRET) - Your
application ID(asAPP_ID), - The
phone number linkedto your application (asSERVICE_PHONE_NUMBER) - The first PSTN number to be called (as
PSTN_CALLEE_NUMBER_1) - The second PSTN number to be called (as
PSTN_CALLEE_NUMBER_2) with AMD enabled
Copy or rename .env-example to .env
Update parameters in .env file
Have Node.js installed on your system, this application has been tested with Node.js version 22.16.0
Install node modules with the command:
npm installLaunch the application:
node second-call-amdDefault local (not public!) of this application server port is: 8000.
For testing purposes, you may trigger the corresponding call flow with the web address where this application is running https://<public_host_name>/startcall
for example: https://myserver.mycompany.com:32000/startcall or https://xxxx.ngrok.io/startcall