Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion tutorials/voice_api-node-outbound/.astro/data-store.json

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,6 @@ Copy this code into `make-call.js`

```js
const { Vonage } = require('@vonage/server-sdk');
const { SMS } = require('@vonage/messages');

const TO_NUMBER = ''
const VONAGE_NUMBER = process.env.VONAGE_NUMBER;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,18 +6,17 @@ This code will make the call. Copy into the bottom of `make-call.js`:

```js
vonage.voice.createOutboundCall({
to: [
{
type: 'phone',
number: TO_NUMBER,
},
],
from: {
type: 'phone',
number: VONAGE_NUMBER,
}})
.then((resp) => console.log(resp))
.catch((error) => console.error(error));
to: [{ type: 'phone', number: TO_NUMBER }],
from: { type: 'phone', number: VONAGE_NUMBER },
ncco: [
{
action: 'talk',
text: 'Hello, this is an outbound call from the Vonage Voice API'
}
]
})
.then((resp) => console.log(resp))
.catch((error) => console.error(error));
```

This uses the Vonage Node.js SDK to make an outbound call. If successful the response, containing the call UUID will be printed out to the console. Otherwise the error message will be printed out.
Original file line number Diff line number Diff line change
@@ -0,0 +1,34 @@
---
title: Enable Voice
---

To make a call, you need to enable the voice capability on your Vonage application. Copy this code into the `enable-voice.js` file:

```js
const { Vonage } = require('@vonage/server-sdk');

const vonage = new Vonage({
apiKey: process.env.VONAGE_API_KEY,
apiSecret: process.env.VONAGE_API_SECRET,
applicationId: process.env.VONAGE_APPLICATION_ID,
privateKey: process.env.VONAGE_PRIVATE_KEY,
});

vonage.applications.getApplication(process.env.VONAGE_APPLICATION_ID)
.then((app) => {
app.capabilities = {
voice: {}
}
vonage.applications.updateApplication(app)
.then(() => console.log("App Updated"))
.catch((error) => console.dir(error));
})
.catch((error) => console.error(error));
```

Then run this command in the Terminal:

```sh
node enable-voice.js
```

5 changes: 3 additions & 2 deletions tutorials/voice_api-node-outbound/tutorial-config.json
Original file line number Diff line number Diff line change
@@ -1,9 +1,10 @@
{
"files": [
"make-call.js"
"make-call.js",
"enable-voice.js"
],
"panels": [
"terminal"
],
"version": "0.1.0"
"version": "0.2.0"
}
Loading