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 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
@@ -61,3 +61,4 @@ Although the code in written in *.cpp/*.hpp named files, this is not actually a
61
61
 
62
62
  It is mostly written in C using some C++ facilities.
63
63
 
64
+
package/install.sh CHANGED
@@ -8,7 +8,7 @@ set -o pipefail
8
8
  START_DIR=`pwd`
9
9
 
10
10
 
11
- mkdir -p 3rdParty
11
+ mkdir -p $START_DIR/3rdParty
12
12
 
13
13
 
14
14
  cd $START_DIR/3rdParty
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sip-lab",
3
- "version": "1.12.13",
3
+ "version": "1.12.17",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "engines": {
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
- '$hdr(call-id)': m.collect('sip_call_id'),
45
+ 'hdr_call_id': m.collect('sip_call_id'),
46
46
  $fU: 'alice',
47
47
  $fd: 'test.com',
48
48
  $tU: 'bob',
49
- '$hdr(l)': '0',
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
- '$hdr(content-type)': 'application/sdp',
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
- '$hdr(X-MyHeader2)': 'bbb',
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
- sip.subscription.subscribe(s1, {expires: 120})
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
- '$hdr(Accept)': 'application/dialog-info+xml',
95
- '$hdr(Allow-Events)': 'refer, dialog',
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
- '$hdr(Event)': 'dialog',
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
- assert(parseInt(z.store.sub_expires) > 0)
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
- '$hdr(X-MyHeader2)': 'def',
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
- '$hdr(call-id)': m.collect('sip_call_id'),
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(VIA))': 1,
99
+ '$(hdrcnt(v))': 1,
100
100
  $fU: 'alice',
101
101
  $fd: 'test.com',
102
102
  $tU: 'bob',