-
Notifications
You must be signed in to change notification settings - Fork 7
/
exemple.js
53 lines (39 loc) · 1.25 KB
/
exemple.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
const express = require("express");
const app = express();
const { Yemot_router } = require("./");
const y = Yemot_router();
y.add_fn("/", async (call) => {
let massage = [{ type: "text", data: "היי, תקיש 10" }];
let r = await call.read(massage)
.catch(error => {
if (error.name === "Hangup_error")
console.log(error.call.phone, "hangup");
throw error;
});
massage = [{ type: "text", data: "שלום, אנא הקש את שמך המלא" }];
r = await call.read(massage, "tap", { play_ok_mode: "HebrewKeyboard" })
.catch(error => {
if (error.name === "Hangup_error")
console.log(error.call.phone, "hangup");
throw error;
});
console.log(r);
massage = [
{ type: "text", data: "שלום " + r },
{ type: "text", data: "אנא הקלט את הרחוב בו אתה גר" }
];
r = await call.read(massage, "record");
console.log(r);
massage = [{ type: "text", data: "אנא אמור את שם הרחוב בו אתה גר" }];
r = await call.read(massage, "stt");
console.log(r);
massage = [{ type: "text", data: "אמרת" }];
r = await call.id_list_message(massage, true);
console.log(r);
call.go_to_folder("/1");
});
app.use("/", y);
const port = 3000;
app.listen(port, () => {
console.log("listen in port", port);
});