sip-lab 1.30.0 → 1.32.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/index.js +5 -5
- 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/100_calls.js +1 -0
- package/samples/16_audio_streams.js +1 -0
- package/samples/183_session_progress.js +1 -0
- package/samples/custom_call_id.js +220 -0
- package/samples/custom_call_id_and_from_tag.js.future +224 -0
- package/samples/delayed_media.js +1 -0
- package/samples/four_audio_streams_two_refused.js +1 -0
- package/samples/g729.js +1 -0
- package/samples/media_fields.js +191 -0
- package/samples/mrcp_and_audio.js +1 -12
- package/samples/mrcp_and_audio.simplified_media.js +1 -0
- package/samples/multiple_audio_streams.js +1 -0
- package/samples/options.js +1 -0
- package/samples/pcma.js +1 -0
- package/samples/play_wav_and_speech_recog.bad_transcript.pcmu8000.js +1 -0
- package/samples/refer.js +1 -0
- package/samples/refuse_telephone_event.js +1 -0
- package/samples/register_no_expires.js +1 -0
- package/samples/register_subscribe.js +1 -0
- package/samples/reinvite_and_dtmf.js +1 -0
- package/samples/reinvite_audio_audio.js +1 -0
- package/samples/reinvite_with_hold_unhold.js +1 -0
- package/samples/rtp_and_srtp.js +1 -0
- package/samples/rtp_and_srtp.rtp_refused.js +1 -0
- package/samples/rtp_and_srtp.unbalanced_sdp_answer.js.future +1 -0
- package/samples/send_and_receive_bfsk.js.future +1 -0
- package/samples/send_and_receive_fax.js +1 -0
- package/samples/session_expires.update.js.future +269 -0
- package/samples/session_expires.update.with_sipjs-lab.js +329 -0
- package/samples/simple.js +1 -0
- package/samples/sip_cancel.js +1 -0
- package/samples/speech_synth_and_recog.speex16000.js +1 -0
- package/samples/srtp.js +1 -0
- package/samples/start_play_wav_with_end_of_file_event.js +1 -0
- package/samples/start_play_wav_with_no_loop.js +1 -0
- package/samples/stop_with_cleanup.js +127 -0
- package/samples/tcp.js +1 -0
- package/samples/text_to_speech.js +1 -0
- package/samples/tls.js +1 -0
- package/samples/two_audio_streams.js +1 -0
- package/samples/two_audio_streams.port_zero.js +1 -0
- package/samples_extra/ws_speech_server.bfsk.js +1 -0
- package/samples_extra/ws_speech_server.dtmf.js +1 -0
- package/samples_extra/ws_speech_server.google.js +1 -0
- package/samples_extra/ws_speech_server.send_bfsk.js +1 -0
- package/samples_extra/ws_speech_server.start_bfsk_detection.js.future +1 -0
- package/src/addon.cpp +44 -1
- package/src/idmanager.cpp +4 -0
- package/src/idmanager.hpp +1 -0
- package/src/sip.cpp +253 -141
- package/src/sip.hpp +3 -1
package/index.js
CHANGED
|
@@ -6,8 +6,8 @@ var eventEmitter = new events.EventEmitter();
|
|
|
6
6
|
|
|
7
7
|
process.on('SIGINT', function() {
|
|
8
8
|
console.log("SIGINT");
|
|
9
|
-
var res = addon.shutdown()
|
|
10
|
-
process.exit(
|
|
9
|
+
var res = addon.shutdown(1)
|
|
10
|
+
process.exit(1)
|
|
11
11
|
});
|
|
12
12
|
|
|
13
13
|
addon.event_source = eventEmitter
|
|
@@ -32,10 +32,9 @@ var timerId = setInterval(() => {
|
|
|
32
32
|
}
|
|
33
33
|
}, 50)
|
|
34
34
|
|
|
35
|
-
addon.stop = () => {
|
|
35
|
+
addon.stop = (clean_up = false) => {
|
|
36
36
|
clearInterval(timerId)
|
|
37
|
-
var res = addon.shutdown()
|
|
38
|
-
process.exit(0)
|
|
37
|
+
var res = addon.shutdown(clean_up ? 1 : 0)
|
|
39
38
|
}
|
|
40
39
|
|
|
41
40
|
addon.transport = {
|
|
@@ -60,6 +59,7 @@ addon.call = {
|
|
|
60
59
|
send_dtmf: (c_id, params) => { return addon.call_send_dtmf(c_id, JSON.stringify(params)) },
|
|
61
60
|
send_bfsk: (c_id, params) => { return addon.call_send_bfsk(c_id, JSON.stringify(params)) },
|
|
62
61
|
reinvite: (c_id, params) => { return addon.call_reinvite(c_id, JSON.stringify(params ? params : {})) },
|
|
62
|
+
update: (c_id, params) => { return addon.call_update(c_id, JSON.stringify(params ? params : {})) },
|
|
63
63
|
send_request: (c_id, params) => { return addon.call_send_request(c_id, JSON.stringify(params)) },
|
|
64
64
|
start_record_wav: (c_id, params) => { return addon.call_start_record_wav(c_id, JSON.stringify(params)) },
|
|
65
65
|
start_play_wav: (c_id, params) => { return addon.call_start_play_wav(c_id, JSON.stringify(params)) },
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sip-lab",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.32.0",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -29,7 +29,7 @@
|
|
|
29
29
|
"node-gyp-build": "^4.5.0",
|
|
30
30
|
"sdp-matching": "^1.3.2",
|
|
31
31
|
"sip-matching": "^1.3.14",
|
|
32
|
-
"sipjs-lab": "^1.
|
|
32
|
+
"sipjs-lab": "^1.3.13"
|
|
33
33
|
},
|
|
34
34
|
"devDependencies": {
|
|
35
35
|
"prebuildify": "^5.0.1",
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
package/samples/100_calls.js
CHANGED
|
@@ -0,0 +1,220 @@
|
|
|
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
|
+
// here we create our Zeq instance
|
|
8
|
+
var z = new Zeq()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
async function test() {
|
|
12
|
+
z.trap_events(sip.event_source, 'event', (evt) => {
|
|
13
|
+
var e = evt.args[0]
|
|
14
|
+
return e
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
sip.set_codecs("pcmu/8000/1:128,pcma/8000/1:128,gsm/8000/1:128")
|
|
18
|
+
|
|
19
|
+
console.log(sip.start((data) => { console.log(data)} ))
|
|
20
|
+
|
|
21
|
+
const t1 = sip.transport.create({address: "127.0.0.1"})
|
|
22
|
+
const t2 = sip.transport.create({address: "127.0.0.1"})
|
|
23
|
+
|
|
24
|
+
console.log("t1", t1)
|
|
25
|
+
console.log("t2", t2)
|
|
26
|
+
|
|
27
|
+
const call_id = uuid.v4()
|
|
28
|
+
|
|
29
|
+
var oc = sip.call.create(t1.id, {
|
|
30
|
+
from_uri: 'sip:alice@test.com',
|
|
31
|
+
to_uri: `sip:bob@${t2.address}:${t2.port}`,
|
|
32
|
+
headers: {
|
|
33
|
+
'Call-ID': call_id,
|
|
34
|
+
'Supported': 'timer',
|
|
35
|
+
'Min-SE': '180',
|
|
36
|
+
'Session-Expires': '180',
|
|
37
|
+
},
|
|
38
|
+
})
|
|
39
|
+
|
|
40
|
+
await z.wait([
|
|
41
|
+
{
|
|
42
|
+
event: "incoming_call",
|
|
43
|
+
call_id: m.collect("call_id"),
|
|
44
|
+
transport_id: t2.id,
|
|
45
|
+
msg: sip_msg({
|
|
46
|
+
$rU: 'bob',
|
|
47
|
+
$fU: 'alice',
|
|
48
|
+
$tU: 'bob',
|
|
49
|
+
$fd: 'test.com',
|
|
50
|
+
hdr_supported: 'timer',
|
|
51
|
+
hdr_min_se: '180',
|
|
52
|
+
hdr_session_expires: '180',
|
|
53
|
+
$ci: call_id,
|
|
54
|
+
})
|
|
55
|
+
},
|
|
56
|
+
{
|
|
57
|
+
event: 'response',
|
|
58
|
+
call_id: oc.id,
|
|
59
|
+
method: 'INVITE',
|
|
60
|
+
msg: sip_msg({
|
|
61
|
+
$rs: '100',
|
|
62
|
+
$rr: 'Trying',
|
|
63
|
+
}),
|
|
64
|
+
},
|
|
65
|
+
], 1000)
|
|
66
|
+
|
|
67
|
+
|
|
68
|
+
var ic = {
|
|
69
|
+
id: z.store.call_id,
|
|
70
|
+
sip_call_id: z.store.sip_call_id,
|
|
71
|
+
}
|
|
72
|
+
|
|
73
|
+
sip.call.respond(ic.id, {
|
|
74
|
+
code: 422,
|
|
75
|
+
reason: 'Session Timer Too Small',
|
|
76
|
+
headers: {
|
|
77
|
+
'Supported': 'timer',
|
|
78
|
+
'Min-SE': '300',
|
|
79
|
+
'Session-Expires': '300;refresher=uac',
|
|
80
|
+
},
|
|
81
|
+
})
|
|
82
|
+
|
|
83
|
+
await z.wait([
|
|
84
|
+
{
|
|
85
|
+
event: 'call_ended',
|
|
86
|
+
call_id: ic.id,
|
|
87
|
+
},
|
|
88
|
+
{
|
|
89
|
+
event: 'call_ended',
|
|
90
|
+
call_id: oc.id,
|
|
91
|
+
},
|
|
92
|
+
{
|
|
93
|
+
event: 'response',
|
|
94
|
+
call_id: 0,
|
|
95
|
+
method: 'INVITE',
|
|
96
|
+
msg: sip_msg({
|
|
97
|
+
$rs: '422',
|
|
98
|
+
$rr: 'Session Timer Too Small',
|
|
99
|
+
}),
|
|
100
|
+
},
|
|
101
|
+
], 1000)
|
|
102
|
+
|
|
103
|
+
oc = sip.call.create(t1.id, {
|
|
104
|
+
from_uri: 'sip:alice@test.com;tag=1c619456422',
|
|
105
|
+
to_uri: `sip:bob@${t2.address}:${t2.port}`,
|
|
106
|
+
headers: {
|
|
107
|
+
'Call-ID': call_id,
|
|
108
|
+
'Supported': 'timer',
|
|
109
|
+
'Min-SE': '300',
|
|
110
|
+
'Session-Expires': '300',
|
|
111
|
+
},
|
|
112
|
+
})
|
|
113
|
+
|
|
114
|
+
delete z.store.call_id
|
|
115
|
+
|
|
116
|
+
await z.wait([
|
|
117
|
+
{
|
|
118
|
+
event: "incoming_call",
|
|
119
|
+
call_id: m.collect("call_id"),
|
|
120
|
+
transport_id: t2.id,
|
|
121
|
+
msg: sip_msg({
|
|
122
|
+
$rU: 'bob',
|
|
123
|
+
$fU: 'alice',
|
|
124
|
+
$tU: 'bob',
|
|
125
|
+
$fd: 'test.com',
|
|
126
|
+
hdr_supported: 'timer',
|
|
127
|
+
hdr_min_se: '300',
|
|
128
|
+
hdr_session_expires: '300',
|
|
129
|
+
$ci: call_id,
|
|
130
|
+
})
|
|
131
|
+
},
|
|
132
|
+
{
|
|
133
|
+
event: 'response',
|
|
134
|
+
call_id: oc.id,
|
|
135
|
+
method: 'INVITE',
|
|
136
|
+
msg: sip_msg({
|
|
137
|
+
$rs: '100',
|
|
138
|
+
$rr: 'Trying',
|
|
139
|
+
}),
|
|
140
|
+
},
|
|
141
|
+
], 1000)
|
|
142
|
+
|
|
143
|
+
ic = {
|
|
144
|
+
id: z.store.call_id,
|
|
145
|
+
sip_call_id: z.store.sip_call_id,
|
|
146
|
+
}
|
|
147
|
+
|
|
148
|
+
sip.call.respond(ic.id, {
|
|
149
|
+
code: 200,
|
|
150
|
+
reason: 'OK',
|
|
151
|
+
headers: {
|
|
152
|
+
'Supported': 'timer',
|
|
153
|
+
'Min-SE': '300',
|
|
154
|
+
'Session-Expires': '300;refresher=uac',
|
|
155
|
+
},
|
|
156
|
+
})
|
|
157
|
+
|
|
158
|
+
await z.wait([
|
|
159
|
+
{
|
|
160
|
+
event: 'response',
|
|
161
|
+
call_id: oc.id,
|
|
162
|
+
method: 'INVITE',
|
|
163
|
+
msg: sip_msg({
|
|
164
|
+
$rs: '200',
|
|
165
|
+
$rr: 'OK',
|
|
166
|
+
hdr_supported: 'timer',
|
|
167
|
+
hdr_min_se: '300',
|
|
168
|
+
hdr_session_expires: '300;refresher=uac',
|
|
169
|
+
}),
|
|
170
|
+
},
|
|
171
|
+
{
|
|
172
|
+
event: 'media_update',
|
|
173
|
+
call_id: oc.id,
|
|
174
|
+
status: 'ok',
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
event: 'media_update',
|
|
178
|
+
call_id: ic.id,
|
|
179
|
+
status: 'ok',
|
|
180
|
+
},
|
|
181
|
+
], 1000)
|
|
182
|
+
|
|
183
|
+
await z.sleep(5000)
|
|
184
|
+
|
|
185
|
+
sip.call.terminate(oc.id)
|
|
186
|
+
|
|
187
|
+
// and wait for termination events
|
|
188
|
+
await z.wait([
|
|
189
|
+
{
|
|
190
|
+
event: 'response',
|
|
191
|
+
call_id: oc.id,
|
|
192
|
+
method: 'BYE',
|
|
193
|
+
msg: sip_msg({
|
|
194
|
+
$rs: '200',
|
|
195
|
+
$rr: 'OK',
|
|
196
|
+
}),
|
|
197
|
+
},
|
|
198
|
+
{
|
|
199
|
+
event: 'call_ended',
|
|
200
|
+
call_id: oc.id,
|
|
201
|
+
},
|
|
202
|
+
{
|
|
203
|
+
event: 'call_ended',
|
|
204
|
+
call_id: ic.id,
|
|
205
|
+
},
|
|
206
|
+
], 1000)
|
|
207
|
+
|
|
208
|
+
console.log("Success")
|
|
209
|
+
|
|
210
|
+
sip.stop()
|
|
211
|
+
process.exit(0)
|
|
212
|
+
}
|
|
213
|
+
|
|
214
|
+
|
|
215
|
+
test()
|
|
216
|
+
.catch(e => {
|
|
217
|
+
console.error(e)
|
|
218
|
+
process.exit(1)
|
|
219
|
+
})
|
|
220
|
+
|
|
@@ -0,0 +1,224 @@
|
|
|
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
|
+
// here we create our Zeq instance
|
|
8
|
+
var z = new Zeq()
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
async function test() {
|
|
12
|
+
z.trap_events(sip.event_source, 'event', (evt) => {
|
|
13
|
+
var e = evt.args[0]
|
|
14
|
+
return e
|
|
15
|
+
})
|
|
16
|
+
|
|
17
|
+
sip.set_codecs("pcmu/8000/1:128,pcma/8000/1:128,gsm/8000/1:128")
|
|
18
|
+
|
|
19
|
+
console.log(sip.start((data) => { console.log(data)} ))
|
|
20
|
+
|
|
21
|
+
const t1 = sip.transport.create({address: "127.0.0.1"})
|
|
22
|
+
const t2 = sip.transport.create({address: "127.0.0.1"})
|
|
23
|
+
|
|
24
|
+
console.log("t1", t1)
|
|
25
|
+
console.log("t2", t2)
|
|
26
|
+
|
|
27
|
+
const call_id = uuid.v4()
|
|
28
|
+
const from_tag = "my_fake_from_tag"
|
|
29
|
+
|
|
30
|
+
var oc = sip.call.create(t1.id, {
|
|
31
|
+
from_uri: 'sip:alice@test.com',
|
|
32
|
+
from_tag,
|
|
33
|
+
to_uri: `sip:bob@${t2.address}:${t2.port}`,
|
|
34
|
+
headers: {
|
|
35
|
+
'Call-ID': call_id,
|
|
36
|
+
'Supported': 'timer',
|
|
37
|
+
'Min-SE': '180',
|
|
38
|
+
'Session-Expires': '180',
|
|
39
|
+
},
|
|
40
|
+
})
|
|
41
|
+
|
|
42
|
+
await z.wait([
|
|
43
|
+
{
|
|
44
|
+
event: "incoming_call",
|
|
45
|
+
call_id: m.collect("call_id"),
|
|
46
|
+
transport_id: t2.id,
|
|
47
|
+
msg: sip_msg({
|
|
48
|
+
$rU: 'bob',
|
|
49
|
+
$fU: 'alice',
|
|
50
|
+
// $ft: from_tag, -- not working. bug in sip-parsing
|
|
51
|
+
$tU: 'bob',
|
|
52
|
+
$fd: 'test.com',
|
|
53
|
+
hdr_supported: 'timer',
|
|
54
|
+
hdr_min_se: '180',
|
|
55
|
+
hdr_session_expires: '180',
|
|
56
|
+
$ci: call_id,
|
|
57
|
+
})
|
|
58
|
+
},
|
|
59
|
+
{
|
|
60
|
+
event: 'response',
|
|
61
|
+
call_id: oc.id,
|
|
62
|
+
method: 'INVITE',
|
|
63
|
+
msg: sip_msg({
|
|
64
|
+
$rs: '100',
|
|
65
|
+
$rr: 'Trying',
|
|
66
|
+
}),
|
|
67
|
+
},
|
|
68
|
+
], 1000)
|
|
69
|
+
|
|
70
|
+
|
|
71
|
+
var ic = {
|
|
72
|
+
id: z.store.call_id,
|
|
73
|
+
sip_call_id: z.store.sip_call_id,
|
|
74
|
+
}
|
|
75
|
+
|
|
76
|
+
sip.call.respond(ic.id, {
|
|
77
|
+
code: 422,
|
|
78
|
+
reason: 'Session Timer Too Small',
|
|
79
|
+
headers: {
|
|
80
|
+
'Supported': 'timer',
|
|
81
|
+
'Min-SE': '300',
|
|
82
|
+
'Session-Expires': '300;refresher=uac',
|
|
83
|
+
},
|
|
84
|
+
})
|
|
85
|
+
|
|
86
|
+
await z.wait([
|
|
87
|
+
{
|
|
88
|
+
event: 'call_ended',
|
|
89
|
+
call_id: ic.id,
|
|
90
|
+
},
|
|
91
|
+
{
|
|
92
|
+
event: 'call_ended',
|
|
93
|
+
call_id: oc.id,
|
|
94
|
+
},
|
|
95
|
+
{
|
|
96
|
+
event: 'response',
|
|
97
|
+
call_id: 0,
|
|
98
|
+
method: 'INVITE',
|
|
99
|
+
msg: sip_msg({
|
|
100
|
+
$rs: '422',
|
|
101
|
+
$rr: 'Session Timer Too Small',
|
|
102
|
+
}),
|
|
103
|
+
},
|
|
104
|
+
], 1000)
|
|
105
|
+
|
|
106
|
+
oc = sip.call.create(t1.id, {
|
|
107
|
+
from_uri: 'sip:alice@test.com;tag=1c619456422',
|
|
108
|
+
from_tag,
|
|
109
|
+
to_uri: `sip:bob@${t2.address}:${t2.port}`,
|
|
110
|
+
headers: {
|
|
111
|
+
'Call-ID': call_id,
|
|
112
|
+
'Supported': 'timer',
|
|
113
|
+
'Min-SE': '300',
|
|
114
|
+
'Session-Expires': '300',
|
|
115
|
+
},
|
|
116
|
+
})
|
|
117
|
+
|
|
118
|
+
delete z.store.call_id
|
|
119
|
+
|
|
120
|
+
await z.wait([
|
|
121
|
+
{
|
|
122
|
+
event: "incoming_call",
|
|
123
|
+
call_id: m.collect("call_id"),
|
|
124
|
+
transport_id: t2.id,
|
|
125
|
+
msg: sip_msg({
|
|
126
|
+
$rU: 'bob',
|
|
127
|
+
$fU: 'alice',
|
|
128
|
+
// $ft: from_tag, -- not working. bug in sip-parsing
|
|
129
|
+
$tU: 'bob',
|
|
130
|
+
$fd: 'test.com',
|
|
131
|
+
hdr_supported: 'timer',
|
|
132
|
+
hdr_min_se: '300',
|
|
133
|
+
hdr_session_expires: '300',
|
|
134
|
+
$ci: call_id,
|
|
135
|
+
})
|
|
136
|
+
},
|
|
137
|
+
{
|
|
138
|
+
event: 'response',
|
|
139
|
+
call_id: oc.id,
|
|
140
|
+
method: 'INVITE',
|
|
141
|
+
msg: sip_msg({
|
|
142
|
+
$rs: '100',
|
|
143
|
+
$rr: 'Trying',
|
|
144
|
+
}),
|
|
145
|
+
},
|
|
146
|
+
], 1000)
|
|
147
|
+
|
|
148
|
+
ic = {
|
|
149
|
+
id: z.store.call_id,
|
|
150
|
+
sip_call_id: z.store.sip_call_id,
|
|
151
|
+
}
|
|
152
|
+
|
|
153
|
+
sip.call.respond(ic.id, {
|
|
154
|
+
code: 200,
|
|
155
|
+
reason: 'OK',
|
|
156
|
+
headers: {
|
|
157
|
+
'Supported': 'timer',
|
|
158
|
+
'Min-SE': '300',
|
|
159
|
+
'Session-Expires': '300;refresher=uac',
|
|
160
|
+
},
|
|
161
|
+
})
|
|
162
|
+
|
|
163
|
+
await z.wait([
|
|
164
|
+
{
|
|
165
|
+
event: 'response',
|
|
166
|
+
call_id: oc.id,
|
|
167
|
+
method: 'INVITE',
|
|
168
|
+
msg: sip_msg({
|
|
169
|
+
$rs: '200',
|
|
170
|
+
$rr: 'OK',
|
|
171
|
+
hdr_supported: 'timer',
|
|
172
|
+
hdr_min_se: '300',
|
|
173
|
+
hdr_session_expires: '300;refresher=uac',
|
|
174
|
+
}),
|
|
175
|
+
},
|
|
176
|
+
{
|
|
177
|
+
event: 'media_update',
|
|
178
|
+
call_id: oc.id,
|
|
179
|
+
status: 'ok',
|
|
180
|
+
},
|
|
181
|
+
{
|
|
182
|
+
event: 'media_update',
|
|
183
|
+
call_id: ic.id,
|
|
184
|
+
status: 'ok',
|
|
185
|
+
},
|
|
186
|
+
], 1000)
|
|
187
|
+
|
|
188
|
+
await z.sleep(1000)
|
|
189
|
+
|
|
190
|
+
sip.call.terminate(oc.id)
|
|
191
|
+
|
|
192
|
+
// and wait for termination events
|
|
193
|
+
await z.wait([
|
|
194
|
+
{
|
|
195
|
+
event: 'response',
|
|
196
|
+
call_id: oc.id,
|
|
197
|
+
method: 'BYE',
|
|
198
|
+
msg: sip_msg({
|
|
199
|
+
$rs: '200',
|
|
200
|
+
$rr: 'OK',
|
|
201
|
+
}),
|
|
202
|
+
},
|
|
203
|
+
{
|
|
204
|
+
event: 'call_ended',
|
|
205
|
+
call_id: oc.id,
|
|
206
|
+
},
|
|
207
|
+
{
|
|
208
|
+
event: 'call_ended',
|
|
209
|
+
call_id: ic.id,
|
|
210
|
+
},
|
|
211
|
+
], 1000)
|
|
212
|
+
|
|
213
|
+
console.log("Success")
|
|
214
|
+
|
|
215
|
+
sip.stop()
|
|
216
|
+
}
|
|
217
|
+
|
|
218
|
+
|
|
219
|
+
test()
|
|
220
|
+
.catch(e => {
|
|
221
|
+
console.error(e)
|
|
222
|
+
process.exit(1)
|
|
223
|
+
})
|
|
224
|
+
|
package/samples/delayed_media.js
CHANGED