Skip to content

Instantly share code, notes, and snippets.

@DanyF-github
Created September 3, 2021 14:41
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save DanyF-github/baa33eddd4dae1249b51d5d0e8c257ed to your computer and use it in GitHub Desktop.
Save DanyF-github/baa33eddd4dae1249b51d5d0e8c257ed to your computer and use it in GitHub Desktop.
// Get environment variables
const YOUR_VONAGE_NUMBER = process.env.YOUR_VONAGE_NUMBER;
const YOUR_PHONE_NUMBER = process.env.YOUR_PHONE_NUMBER;
exports.helloWorld = (req, res) => {
// Check if there's DTMF payload in the request body
if (req.body.dtmf) {
// (2.2) Connect call to the number in the DTMF payload
])
} else {
// Check if you're the caller
if (req.query.from === YOUR_PHONE_NUMBER) {
// (2.1) Capture destination number via DTMF input
} else {
// (1) Connect caller to your phone number
}
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment