-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsc_dtmf.js
72 lines (66 loc) · 904 Bytes
/
sc_dtmf.js
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
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
var {Routines} = require("steam-controller-player");
function getDTMF(number) {
var freq1 = 0;
var freq2 = 0;
switch (number) {
case 1:
case 2:
case 3:
case 'A':
freq1 = 697;
break;
case 4:
case 5:
case 6:
case 'B':
freq1 = 770;
break;
case 7:
case 8:
case 9:
case 'C':
freq1 = 852;
break;
case '*':
case 0:
case '#':
case 'D':
freq1 = 941;
break;
}
switch (number) {
case 1:
case 4:
case 7:
case '*':
freq2 = 1209;
break;
case 2:
case 5:
case 8:
case 0:
freq2 = 1336;
break;
case 3:
case 6:
case 9:
case '#':
freq2 = 1477;
break;
case 'A':
case 'B':
case 'C':
case 'D':
freq2 = 1633;
break;
}
return [freq1, freq2];
}
function getDialTone() {
// TODO : Change this for a routine factory?
return [350, 440]
}
module.exports = {
getDTMF: getDTMF,
getDialTone: playDialTone,
}