sip-lab 1.17.4 → 1.17.7
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/DEV.md +3 -1
- package/README.md +1 -1
- package/package.json +2 -2
- package/samples/100_calls.js +5 -5
- package/src/sip.cpp +1 -1
- package/samples/16_calls.js +0 -152
package/DEV.md
CHANGED
|
@@ -78,9 +78,11 @@ After the message is built you can pass them to prebuildify-cross:
|
|
|
78
78
|
nvm use v16.13.1
|
|
79
79
|
npx prebuildify-cross -i mayamatakeshi/sip-lab-debian11:latest -t 19.0.0 -t 20.0.0 -t 21.0.0 --strip
|
|
80
80
|
```
|
|
81
|
-
|
|
82
81
|
Obs: however the above will fail if you are behind proxy (solution pending).
|
|
83
82
|
|
|
83
|
+
Also, although we don't use '-t 15.0.0 -t 16.0.0 -t 17.0.0 -t 18.0.0' it will still work with them.
|
|
84
|
+
And actually, it seem if use the above, it will not work with them (see https://github.com/MayamaTakeshi/sip-lab/issues/68)
|
|
85
|
+
|
|
84
86
|
#### Running tests
|
|
85
87
|
```
|
|
86
88
|
npm test
|
package/README.md
CHANGED
|
@@ -23,7 +23,7 @@ TODO:
|
|
|
23
23
|
### Installation
|
|
24
24
|
|
|
25
25
|
This is a node.js addon and it is known to work on Debian 11, Debian 10, Ubuntu 22.04 and Ubuntu 20.04.
|
|
26
|
-
It is distributed with prebuild binaries for node.js
|
|
26
|
+
It is distributed with prebuild binaries for node.js 15.0.0 and above (but built for Debian 11. For other Debian versions or for Ubuntu a local build of the addon will be executed. Being the case, be patient as the build process will take several minutes to complete).
|
|
27
27
|
|
|
28
28
|
To install it, first install some build dependencies (you might not need them if your are on Debian 11).
|
|
29
29
|
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "sip-lab",
|
|
3
|
-
"version": "1.17.
|
|
3
|
+
"version": "1.17.7",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"engines": {
|
|
@@ -21,7 +21,7 @@
|
|
|
21
21
|
"gypfile": true,
|
|
22
22
|
"homepage": "https://github.com/MayamaTakeshi/sip-lab",
|
|
23
23
|
"dependencies": {
|
|
24
|
-
"@mayama/zeq": "^4.
|
|
24
|
+
"@mayama/zeq": "^4.15.0",
|
|
25
25
|
"mrcp": "^1.4.0",
|
|
26
26
|
"mrcp-matching": "^1.0.0",
|
|
27
27
|
"node-addon-api": "^5.0.0",
|
package/samples/100_calls.js
CHANGED
|
@@ -48,7 +48,7 @@ async function test() {
|
|
|
48
48
|
event: "incoming_call",
|
|
49
49
|
call_id: m.push("ic_ids"),
|
|
50
50
|
transport_id: t.id,
|
|
51
|
-
})).value(),
|
|
51
|
+
})).value(), 50000)
|
|
52
52
|
|
|
53
53
|
// Now we answer the calls
|
|
54
54
|
z.store.ic_ids.forEach(ic_id => {
|
|
@@ -84,7 +84,7 @@ async function test() {
|
|
|
84
84
|
status: 'ok',
|
|
85
85
|
})).value())
|
|
86
86
|
|
|
87
|
-
await z.wait(events,
|
|
87
|
+
await z.wait(events, 50000)
|
|
88
88
|
|
|
89
89
|
ocs.forEach(oc => {
|
|
90
90
|
sip.call.send_dtmf(oc.id, {digits: '1234', mode: 0})
|
|
@@ -96,7 +96,7 @@ async function test() {
|
|
|
96
96
|
digits: '1234',
|
|
97
97
|
mode: 0,
|
|
98
98
|
media_id: 0,
|
|
99
|
-
})).value(),
|
|
99
|
+
})).value(), 50000)
|
|
100
100
|
|
|
101
101
|
z.store.ic_ids.forEach(ic_id => {
|
|
102
102
|
sip.call.send_dtmf(ic_id, {digits: '4321', mode: 1})
|
|
@@ -108,7 +108,7 @@ async function test() {
|
|
|
108
108
|
digits: '4321',
|
|
109
109
|
mode: 1,
|
|
110
110
|
media_id: 0,
|
|
111
|
-
})).value(),
|
|
111
|
+
})).value(), 50000)
|
|
112
112
|
|
|
113
113
|
// now we terminate the calls
|
|
114
114
|
ocs.forEach(oc => {
|
|
@@ -136,7 +136,7 @@ async function test() {
|
|
|
136
136
|
call_id: ic_id,
|
|
137
137
|
})).value())
|
|
138
138
|
|
|
139
|
-
await z.wait(events,
|
|
139
|
+
await z.wait(events, 50000)
|
|
140
140
|
|
|
141
141
|
console.log("Success")
|
|
142
142
|
|
package/src/sip.cpp
CHANGED
|
@@ -4692,7 +4692,7 @@ static void on_state_changed(pjsip_inv_session *inv, pjsip_event *e) {
|
|
|
4692
4692
|
MediaEndpoint *me = call->media[i];
|
|
4693
4693
|
if (ENDPOINT_TYPE_AUDIO == me->type) {
|
|
4694
4694
|
AudioEndpoint *ae = (AudioEndpoint *)me->endpoint.audio;
|
|
4695
|
-
addon_log(L_DBG, "processing media[%d] as
|
|
4695
|
+
addon_log(L_DBG, "processing media[%d] as AudioEndpoint\n", i);
|
|
4696
4696
|
if (ae->master_port) {
|
|
4697
4697
|
addon_log(L_DBG, "calling pjmedia_port_stop\n");
|
|
4698
4698
|
status = pjmedia_master_port_stop(ae->master_port);
|
package/samples/16_calls.js
DELETED
|
@@ -1,152 +0,0 @@
|
|
|
1
|
-
// This test creates 256 caller UDP SIP endpoints, 256 callee UDP SIP endpoines and makes one call between them, test dtmf and disconeects.
|
|
2
|
-
|
|
3
|
-
const sip = require ('../index.js')
|
|
4
|
-
const Zeq = require('@mayama/zeq')
|
|
5
|
-
const m = require('data-matching')
|
|
6
|
-
const sip_msg = require('sip-matching')
|
|
7
|
-
const _ = require('lodash')
|
|
8
|
-
|
|
9
|
-
const NUMBER_OF_CALLS = 16
|
|
10
|
-
|
|
11
|
-
var z = new Zeq()
|
|
12
|
-
|
|
13
|
-
sip.dtmf_aggregation_on(500)
|
|
14
|
-
|
|
15
|
-
z.add_event_filter({
|
|
16
|
-
event: 'response',
|
|
17
|
-
msg: sip_msg({
|
|
18
|
-
$rs: '100',
|
|
19
|
-
}),
|
|
20
|
-
})
|
|
21
|
-
|
|
22
|
-
async function test() {
|
|
23
|
-
z.trap_events(sip.event_source, 'event', (evt) => {
|
|
24
|
-
var e = evt.args[0]
|
|
25
|
-
return e
|
|
26
|
-
})
|
|
27
|
-
|
|
28
|
-
console.log(sip.start((data) => { console.log(data)} ))
|
|
29
|
-
|
|
30
|
-
const caller_ts = []
|
|
31
|
-
const callee_ts = []
|
|
32
|
-
|
|
33
|
-
const ocs = []
|
|
34
|
-
|
|
35
|
-
for(var i=0 ; i<NUMBER_OF_CALLS ; i++) {
|
|
36
|
-
const caller_t = sip.transport.create({address: "127.0.0.1"})
|
|
37
|
-
caller_ts.push(caller_t)
|
|
38
|
-
const callee_t = sip.transport.create({address: "127.0.0.1"})
|
|
39
|
-
callee_ts.push(callee_t)
|
|
40
|
-
|
|
41
|
-
// make the call
|
|
42
|
-
const oc = sip.call.create(caller_t.id, {from_uri: 'sip:alice@test.com', to_uri: `sip:bob@${callee_t.address}:${callee_t.port}`})
|
|
43
|
-
ocs.push(oc)
|
|
44
|
-
}
|
|
45
|
-
|
|
46
|
-
// Here we will wait for the calls to arrive
|
|
47
|
-
await z.wait(_.chain(callee_ts).map(t => ({
|
|
48
|
-
event: "incoming_call",
|
|
49
|
-
call_id: m.push("ic_ids"),
|
|
50
|
-
transport_id: t.id,
|
|
51
|
-
})).value(), 5000)
|
|
52
|
-
|
|
53
|
-
// Now we answer the calls
|
|
54
|
-
z.store.ic_ids.forEach(ic_id => {
|
|
55
|
-
sip.call.respond(ic_id, {code: 200, reason: 'OK'})
|
|
56
|
-
})
|
|
57
|
-
|
|
58
|
-
// Then we wait for the '200 OK' at the caller side
|
|
59
|
-
var events = _.chain(ocs).map(oc => ({
|
|
60
|
-
event: 'response',
|
|
61
|
-
call_id: oc.id,
|
|
62
|
-
method: 'INVITE',
|
|
63
|
-
msg: sip_msg({
|
|
64
|
-
$rs: '200',
|
|
65
|
-
$rr: 'OK',
|
|
66
|
-
'$(hdrcnt(VIA))': 1,
|
|
67
|
-
$fU: 'alice',
|
|
68
|
-
$fd: 'test.com',
|
|
69
|
-
$tU: 'bob',
|
|
70
|
-
'$hdr(content-type)': 'application/sdp',
|
|
71
|
-
$rb: '!{_}a=sendrecv',
|
|
72
|
-
}),
|
|
73
|
-
})).value()
|
|
74
|
-
|
|
75
|
-
events = events.concat(_.chain(ocs).map(oc => ({
|
|
76
|
-
event: 'media_update',
|
|
77
|
-
call_id: oc.id,
|
|
78
|
-
status: 'ok',
|
|
79
|
-
})).value())
|
|
80
|
-
|
|
81
|
-
events = events.concat(_.chain(z.store.ic_ids).map(ic_id => ({
|
|
82
|
-
event: 'media_update',
|
|
83
|
-
call_id: ic_id,
|
|
84
|
-
status: 'ok',
|
|
85
|
-
})).value())
|
|
86
|
-
|
|
87
|
-
await z.wait(events, 5000)
|
|
88
|
-
|
|
89
|
-
ocs.forEach(oc => {
|
|
90
|
-
sip.call.send_dtmf(oc.id, {digits: '1234', mode: 0})
|
|
91
|
-
})
|
|
92
|
-
|
|
93
|
-
await z.wait(_.chain(z.store.ic_ids).map(ic_id => ({
|
|
94
|
-
event: 'dtmf',
|
|
95
|
-
call_id: ic_id,
|
|
96
|
-
digits: '1234',
|
|
97
|
-
mode: 0,
|
|
98
|
-
media_id: 0,
|
|
99
|
-
})).value(), 5000)
|
|
100
|
-
|
|
101
|
-
z.store.ic_ids.forEach(ic_id => {
|
|
102
|
-
sip.call.send_dtmf(ic_id, {digits: '4321', mode: 1})
|
|
103
|
-
})
|
|
104
|
-
|
|
105
|
-
await z.wait(_.chain(ocs).map(oc => ({
|
|
106
|
-
event: 'dtmf',
|
|
107
|
-
call_id: oc.id,
|
|
108
|
-
digits: '4321',
|
|
109
|
-
mode: 1,
|
|
110
|
-
media_id: 0,
|
|
111
|
-
})).value(), 5000)
|
|
112
|
-
|
|
113
|
-
// now we terminate the calls
|
|
114
|
-
ocs.forEach(oc => {
|
|
115
|
-
sip.call.terminate(oc.id)
|
|
116
|
-
})
|
|
117
|
-
|
|
118
|
-
// and wait for termination events
|
|
119
|
-
events = _.chain(ocs).map(oc => ({
|
|
120
|
-
event: 'response',
|
|
121
|
-
call_id: oc.id,
|
|
122
|
-
method: 'BYE',
|
|
123
|
-
msg: sip_msg({
|
|
124
|
-
$rs: '200',
|
|
125
|
-
$rr: 'OK',
|
|
126
|
-
}),
|
|
127
|
-
})).value()
|
|
128
|
-
|
|
129
|
-
events = events.concat(_.chain(ocs).map(oc => ({
|
|
130
|
-
event: 'call_ended',
|
|
131
|
-
call_id: oc.id,
|
|
132
|
-
})).value())
|
|
133
|
-
|
|
134
|
-
events = events.concat(_.chain(z.store.ic_ids).map(ic_id => ({
|
|
135
|
-
event: 'call_ended',
|
|
136
|
-
call_id: ic_id,
|
|
137
|
-
})).value())
|
|
138
|
-
|
|
139
|
-
await z.wait(events, 5000)
|
|
140
|
-
|
|
141
|
-
console.log("Success")
|
|
142
|
-
|
|
143
|
-
sip.stop()
|
|
144
|
-
}
|
|
145
|
-
|
|
146
|
-
|
|
147
|
-
test()
|
|
148
|
-
.catch(e => {
|
|
149
|
-
console.error(e)
|
|
150
|
-
process.exit(1)
|
|
151
|
-
})
|
|
152
|
-
|