JavaScript
Modify the sample code
Download the application from Github in order to get started. You will need to have Git installed on your machine. If you are new to git or need to install git, please visit this documentation from Github.
In terminal, insert the following:
git clone https://github.com/nexmo-community/smart-number-smart-ivr-fallback-demo.git cd smart-number-smart-ivr-fallback-demoNext, install the dependencies:
npm installNavigate into the cloned repository and create a new file called
.env.In the
.envfile, add the followingCALLER_ID='' DEST_TYPE='' DEST_NUMBER='' DEST_EXT='' DEST_SIP='' FALLBACK_TYPE='' FALLBACK_NUMBER='' FALLBACK_EXT='' FALLBACK_SIP='' VOICE_NAME='' PORT=''Enter the appropriate value for each environment variable:
Key Description CALLER_IDThe caller ID used for outbound connections. DEST_TYPEThe type of connection to which the hotline should connect. DEST_NUMBERThe PSTN number to connect. This is used when DEST_TYPEis set tophone.DEST_EXTThe Vonage Business Communications extension number to connect. This is used when DEST_TYPEis set tovbc.DEST_SIPThe SIP URI to connect. This is used when DEST_TYPEis set tosip.FALLBACK_TYPEThe type of connection to which the hotline should connect. FALLBACK_NUMBERThe PSTN number to connect. This is used when FALLBACK_TYPEis set tophone.FALLBACK_EXTThe Vonage Business Communications extension number to connect. This is used when FALLBACK_TYPEis set tovbc.FALLBACK_SIPThe SIP URI to connect. This is used when FALLBACK_TYPEis set tosip.VOICE_NAMEThe Nexmo voice to use for text-to-speech. PORTThe port on which the application should listen. In this example, the application will dial a PSTN number when there is a call to the Smart Number.
In the
.env, update the following:CALLER_ID={a valid PSTN number} DEST_TYPE="phone" DEST_NUMBER={phone number to dial} FALLBACK_TYPE="phone" FALLBACK_NUMBER={phone number to dial} PORT=3000
Smart Numbers IVR
Redirect calls from your Smart Number to another number
Available on:
Steps
1
Introduction to this task2
Prerequisites3
Modifiy the sample code4
Run Application5
What's next?