sip-lab 1.29.0 → 1.31.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/build_deps.sh +2 -1
- package/index.js +1 -0
- package/package.json +2 -2
- package/prebuilds/linux-x64/node.abi102.node +0 -0
- package/prebuilds/linux-x64/node.abi108.node +0 -0
- package/prebuilds/linux-x64/node.abi111.node +0 -0
- package/prebuilds/linux-x64/node.abi115.node +0 -0
- package/prebuilds/linux-x64/node.abi120.node +0 -0
- package/prebuilds/linux-x64/node.abi88.node +0 -0
- package/prebuilds/linux-x64/node.abi93.node +0 -0
- package/samples/custom_call_id.js +219 -0
- package/samples/custom_call_id_and_from_tag.js.future +224 -0
- package/samples/media_fields.js +190 -0
- package/samples/mrcp_and_audio.js +0 -12
- package/samples/send_and_receive_bfsk.js.future +171 -0
- package/samples/session_expires.update.js.future +268 -0
- package/samples/session_expires.update.with_sipjs-lab.js +312 -0
- package/samples_extra/ws_speech_server.bfsk.js +154 -0
- package/samples_extra/ws_speech_server.dtmf.js +5 -21
- package/samples_extra/ws_speech_server.google.js +8 -10
- package/samples_extra/ws_speech_server.send_bfsk.js +156 -0
- package/samples_extra/ws_speech_server.start_bfsk_detection.js.future +164 -0
- package/src/addon.cpp +35 -0
- package/src/pjmedia/include/pjmedia/bfsk_det.h +0 -2
- package/src/pjmedia/include/pjmedia/ws_speech_port.h +1 -0
- package/src/pjmedia/src/pjmedia/bfsk_det.c +153 -27
- package/src/pjmedia/src/pjmedia/ws_speech_port.cpp +8 -0
- package/src/sip.cpp +206 -82
- package/src/sip.cpp.old +9236 -0
- package/src/sip.hpp +2 -0
|
@@ -0,0 +1,312 @@
|
|
|
1
|
+
const sip = require ('../index.js')
|
|
2
|
+
const Zeq = require('@mayama/zeq')
|
|
3
|
+
const m = require('data-matching')
|
|
4
|
+
const sip_msg = require('sip-matching')
|
|
5
|
+
const uuid = require('uuid')
|
|
6
|
+
|
|
7
|
+
const sipjs = require('sipjs-lab')
|
|
8
|
+
const {endpoint, dialog} = require('sipjs-lab')
|
|
9
|
+
|
|
10
|
+
// here we create our Zeq instance
|
|
11
|
+
|
|
12
|
+
var z = new Zeq()
|
|
13
|
+
|
|
14
|
+
async function test() {
|
|
15
|
+
z.trap_events(sip.event_source, 'event', (evt) => {
|
|
16
|
+
var e = evt.args[0]
|
|
17
|
+
return e
|
|
18
|
+
})
|
|
19
|
+
|
|
20
|
+
z.trap_events(sipjs.event_source, 'event', (evt) => {
|
|
21
|
+
var e = evt.args[0]
|
|
22
|
+
return e
|
|
23
|
+
})
|
|
24
|
+
|
|
25
|
+
sip.set_codecs("pcmu/8000/1:128,pcma/8000/1:128,gsm/8000/1:128")
|
|
26
|
+
|
|
27
|
+
console.log(sip.start((data) => { console.log(data)} ))
|
|
28
|
+
|
|
29
|
+
const address = "127.0.0.1"
|
|
30
|
+
|
|
31
|
+
const t1 = sip.transport.create({address})
|
|
32
|
+
|
|
33
|
+
const e1_port = 7070
|
|
34
|
+
const e1 = endpoint.create({
|
|
35
|
+
address,
|
|
36
|
+
port: e1_port,
|
|
37
|
+
publicAddress: address
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
const sip_call_id = uuid.v4()
|
|
41
|
+
|
|
42
|
+
var oc = sip.call.create(t1.id, {
|
|
43
|
+
from_uri: 'sip:alice@test.com',
|
|
44
|
+
to_uri: `sip:bob@${address}:${e1_port}`,
|
|
45
|
+
headers: {
|
|
46
|
+
'Call-ID': sip_call_id,
|
|
47
|
+
'Supported': 'timer',
|
|
48
|
+
'Min-SE': '180',
|
|
49
|
+
'Session-Expires': '180',
|
|
50
|
+
},
|
|
51
|
+
})
|
|
52
|
+
|
|
53
|
+
await z.wait([
|
|
54
|
+
{
|
|
55
|
+
source: 'sip_endpoint',
|
|
56
|
+
req: m.collect('req', {
|
|
57
|
+
method: 'INVITE',
|
|
58
|
+
uri: `sip:bob@${address}:${e1_port}`,
|
|
59
|
+
headers: {
|
|
60
|
+
from: {
|
|
61
|
+
uri: 'sip:alice@test.com',
|
|
62
|
+
},
|
|
63
|
+
to: {
|
|
64
|
+
uri: `sip:bob@${address}`,
|
|
65
|
+
},
|
|
66
|
+
supported: 'timer',
|
|
67
|
+
'min-se': '180',
|
|
68
|
+
'session-expires': '180',
|
|
69
|
+
},
|
|
70
|
+
}),
|
|
71
|
+
event: 'dialog_offer',
|
|
72
|
+
dialog_id: m.collect('dialog_id'),
|
|
73
|
+
},
|
|
74
|
+
], 1000)
|
|
75
|
+
|
|
76
|
+
dialog.send_reply(
|
|
77
|
+
z.store.dialog_id,
|
|
78
|
+
z.store.req,
|
|
79
|
+
{
|
|
80
|
+
status: 422,
|
|
81
|
+
reason: 'Session Timer Too Small',
|
|
82
|
+
headers: {
|
|
83
|
+
'Min-SE': '300',
|
|
84
|
+
'Server': 'TBSIP',
|
|
85
|
+
},
|
|
86
|
+
}
|
|
87
|
+
)
|
|
88
|
+
|
|
89
|
+
await z.wait([
|
|
90
|
+
{
|
|
91
|
+
event: 'response',
|
|
92
|
+
call_id: oc.id,
|
|
93
|
+
method: 'INVITE',
|
|
94
|
+
msg: sip_msg({
|
|
95
|
+
$rs: '422',
|
|
96
|
+
$rr: 'Session Timer Too Small',
|
|
97
|
+
hdr_min_se: '300',
|
|
98
|
+
}),
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
event: 'call_ended',
|
|
102
|
+
call_id: oc.id,
|
|
103
|
+
}
|
|
104
|
+
], 1000)
|
|
105
|
+
|
|
106
|
+
dialog.destroy(z.store.dialog_id)
|
|
107
|
+
|
|
108
|
+
delete z.store.dialog_id
|
|
109
|
+
|
|
110
|
+
await z.sleep(1000)
|
|
111
|
+
|
|
112
|
+
oc = sip.call.create(t1.id, {
|
|
113
|
+
from_uri: 'sip:alice@test.com',
|
|
114
|
+
to_uri: `sip:bob@${address}:${e1_port}`,
|
|
115
|
+
headers: {
|
|
116
|
+
'Call-ID': sip_call_id,
|
|
117
|
+
'Supported': 'timer',
|
|
118
|
+
'Min-SE': '300',
|
|
119
|
+
'Session-Expires': '300',
|
|
120
|
+
},
|
|
121
|
+
})
|
|
122
|
+
|
|
123
|
+
delete z.store.req
|
|
124
|
+
|
|
125
|
+
await z.wait([
|
|
126
|
+
{
|
|
127
|
+
source: 'sip_endpoint',
|
|
128
|
+
req: m.collect('req', {
|
|
129
|
+
method: 'INVITE',
|
|
130
|
+
uri: `sip:bob@${address}:${e1_port}`,
|
|
131
|
+
headers: {
|
|
132
|
+
from: {
|
|
133
|
+
uri: 'sip:alice@test.com',
|
|
134
|
+
},
|
|
135
|
+
to: {
|
|
136
|
+
uri: `sip:bob@${address}`,
|
|
137
|
+
},
|
|
138
|
+
},
|
|
139
|
+
}),
|
|
140
|
+
event: 'dialog_offer',
|
|
141
|
+
dialog_id: m.collect('dialog_id'),
|
|
142
|
+
},
|
|
143
|
+
], 1000)
|
|
144
|
+
|
|
145
|
+
const sdp_answer =`v=0
|
|
146
|
+
o=- 3933986675 3933986676 IN IP4 0.0.0.0
|
|
147
|
+
s=-
|
|
148
|
+
c=IN IP4 ${address}
|
|
149
|
+
t=0 0
|
|
150
|
+
m=audio 20000 RTP/AVP 0 101
|
|
151
|
+
a=sendrecv
|
|
152
|
+
a=rtpmap:0 PCMU/8000
|
|
153
|
+
a=rtpmap:101 telephone-event/8000
|
|
154
|
+
a=fmtp:101 0-15
|
|
155
|
+
a=ptime:20`.replace(/\n/g, "\r\n")
|
|
156
|
+
|
|
157
|
+
dialog.send_reply(
|
|
158
|
+
z.store.dialog_id,
|
|
159
|
+
z.store.req,
|
|
160
|
+
{
|
|
161
|
+
status: 200,
|
|
162
|
+
reason: 'OK',
|
|
163
|
+
headers: {
|
|
164
|
+
'Supported': 'timer',
|
|
165
|
+
'Min-SE': '300',
|
|
166
|
+
'Session-Expires': '300;refresher=uac',
|
|
167
|
+
'content-type': 'application/sdp',
|
|
168
|
+
},
|
|
169
|
+
content: sdp_answer,
|
|
170
|
+
}
|
|
171
|
+
)
|
|
172
|
+
|
|
173
|
+
await z.wait([
|
|
174
|
+
{
|
|
175
|
+
event: 'response',
|
|
176
|
+
call_id: oc.id,
|
|
177
|
+
method: 'INVITE',
|
|
178
|
+
msg: sip_msg({
|
|
179
|
+
$rs: '200',
|
|
180
|
+
$rr: 'OK',
|
|
181
|
+
hdr_supported: 'timer',
|
|
182
|
+
hdr_min_se: '300',
|
|
183
|
+
hdr_session_expires: '300;refresher=uac',
|
|
184
|
+
}),
|
|
185
|
+
},
|
|
186
|
+
{
|
|
187
|
+
event: 'media_update',
|
|
188
|
+
call_id: oc.id,
|
|
189
|
+
status: 'ok',
|
|
190
|
+
},
|
|
191
|
+
{
|
|
192
|
+
source: 'sip_endpoint',
|
|
193
|
+
endpoint_id: z.store.endpoint_id,
|
|
194
|
+
req: {
|
|
195
|
+
method: 'ACK',
|
|
196
|
+
},
|
|
197
|
+
event: 'in_dialog_request',
|
|
198
|
+
dialog_id: z.store.dialog_id
|
|
199
|
+
},
|
|
200
|
+
], 1000)
|
|
201
|
+
|
|
202
|
+
|
|
203
|
+
for(var i=0 ; i<5 ; i++) {
|
|
204
|
+
|
|
205
|
+
sip.call.update(oc.id, {
|
|
206
|
+
headers: {
|
|
207
|
+
'Supported': 'timer',
|
|
208
|
+
'Min-SE': '300',
|
|
209
|
+
'Session-Expires': '300',
|
|
210
|
+
},
|
|
211
|
+
})
|
|
212
|
+
|
|
213
|
+
delete z.store.req
|
|
214
|
+
|
|
215
|
+
await z.wait([
|
|
216
|
+
{
|
|
217
|
+
source: 'sip_endpoint',
|
|
218
|
+
req: m.collect('req', {
|
|
219
|
+
method: 'UPDATE',
|
|
220
|
+
headers: {
|
|
221
|
+
'supported': 'timer',
|
|
222
|
+
'min-se': '300',
|
|
223
|
+
'session-expires': '300',
|
|
224
|
+
},
|
|
225
|
+
}),
|
|
226
|
+
event: 'in_dialog_request',
|
|
227
|
+
dialog_id: z.store.dialog_id
|
|
228
|
+
},
|
|
229
|
+
], 1000)
|
|
230
|
+
|
|
231
|
+
dialog.send_reply(
|
|
232
|
+
z.store.dialog_id,
|
|
233
|
+
z.store.req,
|
|
234
|
+
{
|
|
235
|
+
status: 200,
|
|
236
|
+
reason: 'OK',
|
|
237
|
+
headers: {
|
|
238
|
+
'Supported': 'timer',
|
|
239
|
+
'Min-SE': '300',
|
|
240
|
+
'Session-Expires': '300;refresher=uac',
|
|
241
|
+
},
|
|
242
|
+
}
|
|
243
|
+
)
|
|
244
|
+
|
|
245
|
+
await z.wait([
|
|
246
|
+
{
|
|
247
|
+
event: 'response',
|
|
248
|
+
call_id: oc.id,
|
|
249
|
+
method: 'UPDATE',
|
|
250
|
+
msg: sip_msg({
|
|
251
|
+
$rs: '200',
|
|
252
|
+
$rr: 'OK',
|
|
253
|
+
hdr_supported: 'timer',
|
|
254
|
+
hdr_min_se: '300',
|
|
255
|
+
hdr_session_expires: '300;refresher=uac',
|
|
256
|
+
}),
|
|
257
|
+
},
|
|
258
|
+
], 1000)
|
|
259
|
+
|
|
260
|
+
}
|
|
261
|
+
|
|
262
|
+
sip.call.terminate(oc.id)
|
|
263
|
+
|
|
264
|
+
delete z.store.req
|
|
265
|
+
|
|
266
|
+
await z.wait([
|
|
267
|
+
{
|
|
268
|
+
source: 'sip_endpoint',
|
|
269
|
+
req: m.collect('req', {
|
|
270
|
+
method: 'BYE',
|
|
271
|
+
}),
|
|
272
|
+
},
|
|
273
|
+
], 1000)
|
|
274
|
+
|
|
275
|
+
dialog.send_reply(
|
|
276
|
+
z.store.dialog_id,
|
|
277
|
+
z.store.req,
|
|
278
|
+
{
|
|
279
|
+
status: 200,
|
|
280
|
+
reason: 'OK',
|
|
281
|
+
}
|
|
282
|
+
)
|
|
283
|
+
|
|
284
|
+
await z.wait([
|
|
285
|
+
{
|
|
286
|
+
event: 'response',
|
|
287
|
+
call_id: oc.id,
|
|
288
|
+
method: 'BYE',
|
|
289
|
+
msg: sip_msg({
|
|
290
|
+
$rs: '200',
|
|
291
|
+
$rr: 'OK',
|
|
292
|
+
}),
|
|
293
|
+
},
|
|
294
|
+
{
|
|
295
|
+
event: 'call_ended',
|
|
296
|
+
call_id: oc.id,
|
|
297
|
+
},
|
|
298
|
+
], 1000)
|
|
299
|
+
|
|
300
|
+
await z.sleep(100) // wait for any unexpected events
|
|
301
|
+
|
|
302
|
+
console.log("Success")
|
|
303
|
+
|
|
304
|
+
sip.stop()
|
|
305
|
+
}
|
|
306
|
+
|
|
307
|
+
test()
|
|
308
|
+
.catch(e => {
|
|
309
|
+
console.error(e)
|
|
310
|
+
process.exit(1)
|
|
311
|
+
})
|
|
312
|
+
|
|
@@ -0,0 +1,154 @@
|
|
|
1
|
+
var sip = require ('../index.js')
|
|
2
|
+
var Zeq = require('@mayama/zeq')
|
|
3
|
+
var z = new Zeq()
|
|
4
|
+
var m = require('data-matching')
|
|
5
|
+
var sip_msg = require('sip-matching')
|
|
6
|
+
var sdp = require('sdp-matching')
|
|
7
|
+
|
|
8
|
+
async function test() {
|
|
9
|
+
//sip.set_log_level(6)
|
|
10
|
+
sip.dtmf_aggregation_on(500)
|
|
11
|
+
|
|
12
|
+
sip.set_codecs("PCMU/8000/1:128")
|
|
13
|
+
|
|
14
|
+
z.trap_events(sip.event_source, 'event', (evt) => {
|
|
15
|
+
var e = evt.args[0]
|
|
16
|
+
return e
|
|
17
|
+
})
|
|
18
|
+
|
|
19
|
+
console.log(sip.start((data) => { console.log(data)} ))
|
|
20
|
+
|
|
21
|
+
t1 = sip.transport.create({address: "127.0.0.1", type: 'tcp'})
|
|
22
|
+
t2 = sip.transport.create({address: "127.0.0.1", type: 'tcp'})
|
|
23
|
+
|
|
24
|
+
console.log("t1", t1)
|
|
25
|
+
console.log("t2", t2)
|
|
26
|
+
|
|
27
|
+
oc = sip.call.create(t1.id, {
|
|
28
|
+
from_uri: '"abc"<sip:alice@test.com>',
|
|
29
|
+
to_uri: `sip:bob@${t2.address}:${t2.port}`,
|
|
30
|
+
})
|
|
31
|
+
|
|
32
|
+
await z.wait([
|
|
33
|
+
{
|
|
34
|
+
event: "incoming_call",
|
|
35
|
+
call_id: m.collect("call_id"),
|
|
36
|
+
msg: sip_msg({
|
|
37
|
+
$rm: 'INVITE',
|
|
38
|
+
$fU: 'alice',
|
|
39
|
+
$fd: 'test.com',
|
|
40
|
+
$tU: 'bob',
|
|
41
|
+
}),
|
|
42
|
+
},
|
|
43
|
+
{
|
|
44
|
+
event: 'response',
|
|
45
|
+
call_id: oc.id,
|
|
46
|
+
method: 'INVITE',
|
|
47
|
+
msg: sip_msg({
|
|
48
|
+
$rs: '100',
|
|
49
|
+
$rr: 'Trying',
|
|
50
|
+
}),
|
|
51
|
+
},
|
|
52
|
+
], 1000)
|
|
53
|
+
|
|
54
|
+
ic = {
|
|
55
|
+
id: z.store.call_id,
|
|
56
|
+
sip_call_id: z.store.sip_call_id,
|
|
57
|
+
}
|
|
58
|
+
|
|
59
|
+
sip.call.respond(ic.id, {
|
|
60
|
+
code: 200,
|
|
61
|
+
reason:'OK',
|
|
62
|
+
})
|
|
63
|
+
|
|
64
|
+
await z.wait([
|
|
65
|
+
{
|
|
66
|
+
event: 'media_update',
|
|
67
|
+
call_id: oc.id,
|
|
68
|
+
status: 'ok',
|
|
69
|
+
},
|
|
70
|
+
{
|
|
71
|
+
event: 'media_update',
|
|
72
|
+
call_id: ic.id,
|
|
73
|
+
status: 'ok',
|
|
74
|
+
},
|
|
75
|
+
{
|
|
76
|
+
event: 'response',
|
|
77
|
+
call_id: oc.id,
|
|
78
|
+
method: 'INVITE',
|
|
79
|
+
msg: sip_msg({
|
|
80
|
+
$rs: '200',
|
|
81
|
+
$rr: 'OK',
|
|
82
|
+
}),
|
|
83
|
+
},
|
|
84
|
+
], 1000)
|
|
85
|
+
|
|
86
|
+
sip.call.start_record_wav(oc.id, {file: './oc.wav'})
|
|
87
|
+
sip.call.start_record_wav(ic.id, {file: './ic.wav'})
|
|
88
|
+
|
|
89
|
+
sip.call.start_speech_recog(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: 'bfsk-sr', language: '500:2000'})
|
|
90
|
+
sip.call.start_speech_recog(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: 'bfsk-sr', language: '500:2000'})
|
|
91
|
+
|
|
92
|
+
sip.call.start_speech_synth(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: 'bfsk-ss', voice: '5', language: '500:2000', text: 'abcdefgh', times: 1})
|
|
93
|
+
sip.call.start_speech_synth(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: 'bfsk-ss', voice: '5', language: '500:2000', text: 'hgfedcba', times: 1})
|
|
94
|
+
|
|
95
|
+
await z.wait([
|
|
96
|
+
{
|
|
97
|
+
event: 'speech_synth_complete',
|
|
98
|
+
call_id: ic.id,
|
|
99
|
+
},
|
|
100
|
+
{
|
|
101
|
+
event: 'speech_synth_complete',
|
|
102
|
+
call_id: oc.id,
|
|
103
|
+
},
|
|
104
|
+
{
|
|
105
|
+
event: 'speech',
|
|
106
|
+
call_id: oc.id,
|
|
107
|
+
transcript: 'hgfedcba'
|
|
108
|
+
},
|
|
109
|
+
{
|
|
110
|
+
event: 'speech',
|
|
111
|
+
call_id: ic.id,
|
|
112
|
+
transcript: 'abcdefgh'
|
|
113
|
+
}
|
|
114
|
+
], 3000)
|
|
115
|
+
|
|
116
|
+
sip.call.stop_record_wav(oc.id)
|
|
117
|
+
sip.call.stop_record_wav(ic.id)
|
|
118
|
+
|
|
119
|
+
sip.call.terminate(oc.id)
|
|
120
|
+
|
|
121
|
+
await z.wait([
|
|
122
|
+
{
|
|
123
|
+
event: 'call_ended',
|
|
124
|
+
call_id: oc.id,
|
|
125
|
+
},
|
|
126
|
+
{
|
|
127
|
+
event: 'call_ended',
|
|
128
|
+
call_id: ic.id,
|
|
129
|
+
},
|
|
130
|
+
{
|
|
131
|
+
event: 'response',
|
|
132
|
+
call_id: oc.id,
|
|
133
|
+
method: 'BYE',
|
|
134
|
+
msg: sip_msg({
|
|
135
|
+
$rs: '200',
|
|
136
|
+
$rr: 'OK',
|
|
137
|
+
}),
|
|
138
|
+
},
|
|
139
|
+
], 1000)
|
|
140
|
+
|
|
141
|
+
await z.sleep(50)
|
|
142
|
+
|
|
143
|
+
console.log("Success")
|
|
144
|
+
|
|
145
|
+
sip.stop()
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
|
|
149
|
+
test()
|
|
150
|
+
.catch(e => {
|
|
151
|
+
console.error(e)
|
|
152
|
+
process.exit(1)
|
|
153
|
+
})
|
|
154
|
+
|
|
@@ -86,11 +86,11 @@ async function test() {
|
|
|
86
86
|
sip.call.start_record_wav(oc.id, {file: './oc.wav'})
|
|
87
87
|
sip.call.start_record_wav(ic.id, {file: './ic.wav'})
|
|
88
88
|
|
|
89
|
-
sip.call.start_speech_recog(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: 'dtmf-
|
|
90
|
-
sip.call.start_speech_recog(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: 'dtmf-
|
|
89
|
+
sip.call.start_speech_recog(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: 'dtmf-sr', language: 'dtmf'})
|
|
90
|
+
sip.call.start_speech_recog(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: 'dtmf-sr', language: 'dtmf'})
|
|
91
91
|
|
|
92
|
-
sip.call.start_speech_synth(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: 'dtmf-
|
|
93
|
-
sip.call.start_speech_synth(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: 'dtmf-
|
|
92
|
+
sip.call.start_speech_synth(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: 'dtmf-ss', voice: 'dtmf', language: 'dtmf', text: 'abcd', times: 1})
|
|
93
|
+
sip.call.start_speech_synth(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: 'dtmf-ss', voice: 'dtmf', language: 'dtmf', text: 'dcba', times: 1})
|
|
94
94
|
|
|
95
95
|
await z.wait([
|
|
96
96
|
{
|
|
@@ -101,20 +101,6 @@ async function test() {
|
|
|
101
101
|
event: 'speech_synth_complete',
|
|
102
102
|
call_id: oc.id,
|
|
103
103
|
},
|
|
104
|
-
{
|
|
105
|
-
event: 'dtmf',
|
|
106
|
-
call_id: oc.id,
|
|
107
|
-
digits: 'dcba',
|
|
108
|
-
mode: 1,
|
|
109
|
-
media_id: 0
|
|
110
|
-
},
|
|
111
|
-
{
|
|
112
|
-
event: 'dtmf',
|
|
113
|
-
call_id: ic.id,
|
|
114
|
-
digits: 'abcd',
|
|
115
|
-
mode: 1,
|
|
116
|
-
media_id: 0
|
|
117
|
-
},
|
|
118
104
|
{
|
|
119
105
|
event: 'speech',
|
|
120
106
|
call_id: oc.id,
|
|
@@ -127,8 +113,6 @@ async function test() {
|
|
|
127
113
|
},
|
|
128
114
|
], 3000)
|
|
129
115
|
|
|
130
|
-
await z.sleep(1000)
|
|
131
|
-
|
|
132
116
|
sip.call.stop_record_wav(oc.id)
|
|
133
117
|
sip.call.stop_record_wav(ic.id)
|
|
134
118
|
|
|
@@ -154,7 +138,7 @@ async function test() {
|
|
|
154
138
|
},
|
|
155
139
|
], 1000)
|
|
156
140
|
|
|
157
|
-
await z.sleep(
|
|
141
|
+
await z.sleep(50)
|
|
158
142
|
|
|
159
143
|
console.log("Success")
|
|
160
144
|
|
|
@@ -83,16 +83,16 @@ async function test() {
|
|
|
83
83
|
},
|
|
84
84
|
], 1000)
|
|
85
85
|
|
|
86
|
-
await z.sleep(200)
|
|
87
|
-
|
|
88
86
|
sip.call.start_record_wav(oc.id, {file: './oc.wav'})
|
|
89
87
|
sip.call.start_record_wav(ic.id, {file: './ic.wav'})
|
|
90
88
|
|
|
91
|
-
sip.call.start_speech_recog(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: '
|
|
92
|
-
sip.call.start_speech_recog(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: '
|
|
89
|
+
sip.call.start_speech_recog(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: 'google-sr', language: 'en-US'})
|
|
90
|
+
sip.call.start_speech_recog(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: 'google-sr', language: 'en-US'})
|
|
91
|
+
|
|
92
|
+
await z.sleep(100)
|
|
93
93
|
|
|
94
|
-
sip.call.start_speech_synth(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: '
|
|
95
|
-
sip.call.start_speech_synth(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: '
|
|
94
|
+
sip.call.start_speech_synth(oc.id, {server_url: 'ws://0.0.0.0:8080', engine: 'google-ss', voice: 'en-US-Standard-E', language: 'en-US', text: 'hello world', times: 1})
|
|
95
|
+
sip.call.start_speech_synth(ic.id, {server_url: 'ws://0.0.0.0:8080', engine: 'google-ss', voice: 'en-US-Standard-F', language: 'en-US', text: '<speak>Good morning<break time="2s"/>Good Afternoon</speak>', times: 1})
|
|
96
96
|
|
|
97
97
|
await z.wait([
|
|
98
98
|
{
|
|
@@ -113,7 +113,7 @@ async function test() {
|
|
|
113
113
|
call_id: ic.id,
|
|
114
114
|
transcript: 'hello world',
|
|
115
115
|
},
|
|
116
|
-
],
|
|
116
|
+
], 8000)
|
|
117
117
|
|
|
118
118
|
await z.wait([
|
|
119
119
|
{
|
|
@@ -123,8 +123,6 @@ async function test() {
|
|
|
123
123
|
},
|
|
124
124
|
], 4000)
|
|
125
125
|
|
|
126
|
-
await z.sleep(1000)
|
|
127
|
-
|
|
128
126
|
sip.call.stop_record_wav(oc.id)
|
|
129
127
|
sip.call.stop_record_wav(ic.id)
|
|
130
128
|
|
|
@@ -150,7 +148,7 @@ async function test() {
|
|
|
150
148
|
},
|
|
151
149
|
], 1000)
|
|
152
150
|
|
|
153
|
-
await z.sleep(
|
|
151
|
+
await z.sleep(50)
|
|
154
152
|
|
|
155
153
|
console.log("Success")
|
|
156
154
|
|