sip-lab 1.12.14 → 1.12.19

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 CHANGED
@@ -28,3 +28,8 @@ npm install
28
28
  Then perform code changes and tests. When you are satisfied with them, update install.sh with the new commit id.
29
29
 
30
30
 
31
+ #### Running tests
32
+ ```
33
+ npm test
34
+ ```
35
+
package/README.md CHANGED
@@ -37,6 +37,11 @@ However since it takes several minutes to build this module, you can install it
37
37
  npm install -g sip-lab
38
38
  ```
39
39
 
40
+ But if you do so, you will need to set NODE_PATH for node to find it by doing:
41
+ ```
42
+ export NODE_PATH=$(npm root --quiet -g)
43
+ ```
44
+
40
45
  To test from within this repo just build and install by doing:
41
46
  ```
42
47
  npm install -g node-gyp
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.14",
3
+ "version": "1.12.19",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "engines": {
@@ -19,13 +19,10 @@
19
19
  "gypfile": true,
20
20
  "homepage": "https://github.com/MayamaTakeshi/sip-lab",
21
21
  "dependencies": {
22
- "node-addon-api": "^1.7.2",
23
- "node-gyp": "^8.4.1"
24
- },
25
- "devDependencies": {
26
22
  "@mayama/zeq": "^4.1.14",
27
- "data-matching": "^1.23.8",
28
- "sip-matching": "^1.3.31",
29
- "string-matching": "^1.11.9"
23
+ "data-matching": "^1.24.0",
24
+ "node-addon-api": "^1.7.2",
25
+ "node-gyp": "^8.4.1",
26
+ "sip-matching": "^1.3.31"
30
27
  }
31
28
  }
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',