sip-lab 1.12.13 → 1.12.17
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 +35 -0
- package/README.md +1 -0
- package/install.sh +1 -1
- package/package.json +1 -1
- package/samples/g729.js +3 -3
- package/samples/register_subscribe.js +10 -7
- package/samples/tcp_and_extra_headers.js +3 -3
package/DEV.md
ADDED
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
### For devs
|
|
2
|
+
|
|
3
|
+
We build and statically link to libs pjproject, spandsp, bgc729 and rapidjson.
|
|
4
|
+
|
|
5
|
+
Basic tasks for development:
|
|
6
|
+
|
|
7
|
+
#### To build
|
|
8
|
+
```
|
|
9
|
+
npm install
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
#### To clean up (for a clean rebuild)
|
|
13
|
+
```
|
|
14
|
+
npx node-gyp clean
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
#### To update pjproject, spandsp, bcg729 or rapidjson
|
|
18
|
+
Just delete the corresponding library subfolder in subfolder 3drParty.
|
|
19
|
+
|
|
20
|
+
|
|
21
|
+
Then temporarily change install.sh to not checkout a specific version (or checkout a desired commit)
|
|
22
|
+
|
|
23
|
+
Then run
|
|
24
|
+
```
|
|
25
|
+
npm install
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Then perform code changes and tests. When you are satisfied with them, update install.sh with the new commit id.
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
#### Running tests
|
|
32
|
+
```
|
|
33
|
+
npm test
|
|
34
|
+
```
|
|
35
|
+
|
package/README.md
CHANGED
package/install.sh
CHANGED
package/package.json
CHANGED
package/samples/g729.js
CHANGED
|
@@ -42,11 +42,11 @@ async function test() {
|
|
|
42
42
|
$rs: '100',
|
|
43
43
|
$rr: 'Trying',
|
|
44
44
|
'$(hdrcnt(via))': 1,
|
|
45
|
-
'
|
|
45
|
+
'hdr_call_id': m.collect('sip_call_id'),
|
|
46
46
|
$fU: 'alice',
|
|
47
47
|
$fd: 'test.com',
|
|
48
48
|
$tU: 'bob',
|
|
49
|
-
'
|
|
49
|
+
'hdr_l': '0',
|
|
50
50
|
}),
|
|
51
51
|
},
|
|
52
52
|
], 1000)
|
|
@@ -84,7 +84,7 @@ async function test() {
|
|
|
84
84
|
$fU: 'alice',
|
|
85
85
|
$fd: 'test.com',
|
|
86
86
|
$tU: 'bob',
|
|
87
|
-
'
|
|
87
|
+
'hdr_content_type': 'application/sdp',
|
|
88
88
|
$rb: '!{_}a=sendrecv',
|
|
89
89
|
}),
|
|
90
90
|
},
|
|
@@ -48,7 +48,7 @@ async function test() {
|
|
|
48
48
|
$tU: 'user1',
|
|
49
49
|
$td: domain,
|
|
50
50
|
'$hdr(X-MyHeader1)': 'aaa',
|
|
51
|
-
'
|
|
51
|
+
'hdr_x_myheader2': 'bbb',
|
|
52
52
|
}),
|
|
53
53
|
},
|
|
54
54
|
], 1000)
|
|
@@ -79,7 +79,9 @@ async function test() {
|
|
|
79
79
|
},
|
|
80
80
|
})
|
|
81
81
|
|
|
82
|
-
|
|
82
|
+
const sub_expires = 120
|
|
83
|
+
|
|
84
|
+
sip.subscription.subscribe(s1, {expires: sub_expires})
|
|
83
85
|
|
|
84
86
|
await z.wait([
|
|
85
87
|
{
|
|
@@ -91,8 +93,8 @@ async function test() {
|
|
|
91
93
|
$fU: 'user1',
|
|
92
94
|
$fd: domain,
|
|
93
95
|
'$hdr(Event)': 'dialog',
|
|
94
|
-
'
|
|
95
|
-
'
|
|
96
|
+
'hdr_accept': 'application/dialog-info+xml',
|
|
97
|
+
'hdr_allow_events': 'refer, dialog',
|
|
96
98
|
})
|
|
97
99
|
},
|
|
98
100
|
], 1000)
|
|
@@ -116,14 +118,15 @@ async function test() {
|
|
|
116
118
|
subscription_id: s1,
|
|
117
119
|
msg: sip_msg({
|
|
118
120
|
$rm: 'NOTIFY',
|
|
119
|
-
'
|
|
120
|
-
'$hdr(Subscription-State)': 'active;expires=!{sub_expires}',
|
|
121
|
+
'hdr_event': 'dialog',
|
|
122
|
+
'$hdr(Subscription-State)': 'active;expires=!{sub_expires:num}',
|
|
121
123
|
'$hdr(Allow-Events)': 'refer, dialog',
|
|
122
124
|
}),
|
|
123
125
|
},
|
|
124
126
|
], 1000)
|
|
125
127
|
|
|
126
|
-
|
|
128
|
+
// Subscription-State expires will be computed by pjsip. It might not be the exact value of sub_expires due to latence so we give 2 seconds of tolerance
|
|
129
|
+
assert(z.store.sub_expires > (sub_expires - 2))
|
|
127
130
|
|
|
128
131
|
sip.account.unregister(a1)
|
|
129
132
|
|
|
@@ -40,7 +40,7 @@ async function test() {
|
|
|
40
40
|
$fd: 'test.com',
|
|
41
41
|
$tU: 'bob',
|
|
42
42
|
'$hdr(X-MyHeader1)': 'abc',
|
|
43
|
-
'
|
|
43
|
+
'hdr_x_myheader2': 'def',
|
|
44
44
|
}),
|
|
45
45
|
},
|
|
46
46
|
{
|
|
@@ -51,7 +51,7 @@ async function test() {
|
|
|
51
51
|
$rs: '100',
|
|
52
52
|
$rr: 'Trying',
|
|
53
53
|
'$(hdrcnt(via))': 1,
|
|
54
|
-
'
|
|
54
|
+
'hdr_call_id': m.collect('sip_call_id'),
|
|
55
55
|
$fU: 'alice',
|
|
56
56
|
$fd: 'test.com',
|
|
57
57
|
$tU: 'bob',
|
|
@@ -96,7 +96,7 @@ async function test() {
|
|
|
96
96
|
msg: sip_msg({
|
|
97
97
|
$rs: '200',
|
|
98
98
|
$rr: 'OK',
|
|
99
|
-
'$(hdrcnt(
|
|
99
|
+
'$(hdrcnt(v))': 1,
|
|
100
100
|
$fU: 'alice',
|
|
101
101
|
$fd: 'test.com',
|
|
102
102
|
$tU: 'bob',
|