forked from 46elks/samples
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathex06_call_incoming.js
More file actions
executable file
·33 lines (28 loc) · 1.21 KB
/
ex06_call_incoming.js
File metadata and controls
executable file
·33 lines (28 loc) · 1.21 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
#!/usr/bin/env node
/* jshint node: true */
/*
* 46elks samples: Taking an incoming voice call
* ===
*
* This example introduces you with how to handle an incoming voice call by simply playing
* back a pre-recorded message to it. This can be useful for out-of-office notifications
* and similar setups when there is nobody around who can take the call. This idea can be
* worked upon to provide, say, a voicemail system.
*
* You can investigate the JSON examples provided in later examples in this samples
* repository to learn about how the `voice_start` value can be used to execute various
* actions. To easily test those configurations out in action, replace the `voice_start`
* value in the listener() function of this example.
*
* Setup
* ---
*
* Allocate phone numbers either via the web dashboard or by using the /Numbers API endpoint.
* For the allocated numbers you are going to use, set the `voice_start` value as the endpoint
* provided by this example (http://example.com/callback/newcall).
*/
var core = require(__dirname + '/_core.js');
core.listen('/callback/newcall', function listener(page) {
var voice_start = '{ "play": "http://example.com/message.wav" }';
page.write(voice_start);
});