sip-lab 1.34.2 → 1.34.4

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/README.md CHANGED
@@ -1,44 +1,37 @@
1
- ## sip-lab
1
+ # sip-lab
2
2
 
3
- ### Overview
3
+ ## Overview
4
4
 
5
- A nodejs module that helps to write functional tests for SIP systems (including media operations).
5
+ A nodejs module that helps to write functional/integration tests for SIP systems (including media operations).
6
6
  It uses pjproject for SIP and media processing.
7
7
 
8
- It permits to:
9
- - make audio calls using UDP, TCP and TLS transports
10
- - send/receive DTMF inband/RFC2833/INFO.
11
- - send/receive [BFSK](https://en.wikipedia.org/wiki/Frequency-shift_keying) bits.
12
- - play/record audio on a call from/to a wav file
13
- - send/receive fax (T.30 only)
14
- - send/receive MRCPv2 messages (TCP only, no TLS)
15
- - send/receive audio using SRTP
16
- - do speech synth using flite
17
- - do speech recog using pocketsphinx (but only works well with sampling rate of 16000)
18
- - do speech synth/recog using [ws_speech_server](https://github.com/MayamaTakeshi/ws_speech_server) (this permits to use google/amazon/azure/etc speech services)
8
+ ## Documentation
19
9
 
20
- TODO:
21
- - add support for video playing/recording from/to file
22
- - add support for T.38 fax
23
- - add support for SIP over WebSocket
24
- - add support for WebRTC
25
- - add support for MSRP
10
+ See [Documentation](https://github.com/MayamaTakeshi/sip-lab/blob/master/DOC.md)
11
+
12
+ ## Installation
26
13
 
27
- ### Installation
14
+ The npm package is built for Debian 11 and this is the recommended distro.
28
15
 
29
- This is a node.js addon and it is known to work on Debian 11.
16
+ You can use other debian/ubuntu version but they will require a build of dependencies that will take time (something like 7 minutes but this was measured on my slow PC).
30
17
 
31
- 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 (about 6 minutes on a docker container)).
18
+ First install apt packages:
32
19
 
33
- To install it, first install build dependencies:
34
20
  ```
35
21
  apt install build-essential automake autoconf libtool libspeex-dev libopus-dev libsdl2-dev libavdevice-dev libswscale-dev libv4l-dev libopencore-amrnb-dev libopencore-amrwb-dev libvo-amrwbenc-dev libvo-amrwbenc-dev libboost-dev libtiff-dev libpcap-dev libssl-dev uuid-dev flite-dev cmake git wget
22
+
36
23
  ```
37
24
 
38
- Then install sip-lab (local build of the addon might be triggered here if this is not Debian 11):
25
+ Then switch to node v19, switch to your node project folder and install sip-lab:
26
+
39
27
  ```
40
- npm install sip-lab
28
+ nvm install 19
29
+ nvm use 19
30
+ cd YOUR_NODE_PROJECT_FOLDER
31
+ npm i sip-lab
41
32
  ```
33
+ Obs: once you install sip-lab, you can switch to other node versions like v20, v21.
34
+
42
35
 
43
36
  Then run some sample script from subfolder samples:
44
37
  ```
@@ -49,17 +42,7 @@ The above script has detailed comments.
49
42
 
50
43
  Please read it to undestand how to write your own test scripts.
51
44
 
52
- Notes:
53
- - It will not work on Debian 10 as cmake version is older than required.
54
- - It will work on Debian 12 but a build process will be required. But you need to build using node v19 or older. Building with node v20 or v21 will fail (https://github.com/MayamaTakeshi/sip-lab/issues/107). But once you have it built, you can switch to a newer version of node.
55
-
56
- So basically, if you stick with Debian 11 and any node version from 15 to 21, istallation should be smooth.
57
-
58
- ### Documentation
59
-
60
- See [Documentation](https://github.com/MayamaTakeshi/sip-lab/blob/master/DOC.md)
61
-
62
- ### Samples
45
+ ## Samples
63
46
 
64
47
  See general sample scripts in folder samples.
65
48
 
@@ -86,13 +69,13 @@ node node_modules/sip-lab/samples_extra/ws_speech_server.google.js
86
69
  ```
87
70
 
88
71
 
89
- ### About the code
72
+ ## About the code
90
73
 
91
74
  Although the code in written in *.cpp/*.hpp named files, this is not actually a C++ project.
92
75
 
93
76
  It is mostly written in C using some C++ facilities.
94
77
 
95
- ### Release Notes
78
+ ## Release Notes
96
79
 
97
80
  [ReleaseNotes](https://github.com/MayamaTakeshi/sip-lab/blob/master/RELEASE_NOTES.md)
98
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sip-lab",
3
- "version": "1.34.2",
3
+ "version": "1.34.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "engines": {
Binary file
Binary file
package/samples/g729.js CHANGED
@@ -80,8 +80,8 @@ async function test() {
80
80
  sip.call.start_record_wav(oc.id, {file: './oc.wav'})
81
81
  sip.call.start_record_wav(ic.id, {file: './ic.wav'})
82
82
 
83
- sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/yosemitesam.wav', end_of_file_event: true, no_loop: true})
84
- sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/yosemitesam.wav', end_of_file_event: true, no_loop: true})
83
+ sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/hello_good_morning.wav', end_of_file_event: true, no_loop: true})
84
+ sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/hello_good_morning.wav', end_of_file_event: true, no_loop: true})
85
85
 
86
86
  await z.wait([
87
87
  {
@@ -92,7 +92,7 @@ async function test() {
92
92
  event: 'end_of_file',
93
93
  call_id: ic.id,
94
94
  },
95
- ], 3000)
95
+ ], 5000)
96
96
 
97
97
  sip.call.reinvite(oc.id)
98
98
 
@@ -81,8 +81,8 @@ async function test() {
81
81
  sip.call.start_record_wav(oc.id, {file: './oc.wav'})
82
82
  sip.call.start_record_wav(ic.id, {file: './ic.wav'})
83
83
 
84
- sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/yosemitesam.wav', end_of_file_event: true, no_loop: true})
85
- sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/yosemitesam.wav', end_of_file_event: true, no_loop: true})
84
+ sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/hello_good_morning.wav', end_of_file_event: true, no_loop: true})
85
+ sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/hello_good_morning.wav', end_of_file_event: true, no_loop: true})
86
86
 
87
87
  await z.wait([
88
88
  {
@@ -93,7 +93,7 @@ async function test() {
93
93
  event: 'end_of_file',
94
94
  call_id: ic.id,
95
95
  },
96
- ], 3000)
96
+ ], 5000)
97
97
 
98
98
  sip.call.reinvite(oc.id)
99
99
 
package/samples/simple.js CHANGED
@@ -31,6 +31,8 @@ async function test() {
31
31
  console.log("t1", t1)
32
32
  console.log("t2", t2)
33
33
 
34
+ max_forwards = '18'
35
+
34
36
  // make the call from t1 to t2 with some custom heaaders
35
37
  const oc = sip.call.create(t1.id, {
36
38
  from_uri: 'sip:alice@test.com',
@@ -38,6 +40,7 @@ async function test() {
38
40
  headers: {
39
41
  'X-MyHeader1': 'abc',
40
42
  'X-MyHeader2': 'def',
43
+ 'Max-Forwards': max_forwards,
41
44
  },
42
45
  })
43
46
 
@@ -56,6 +59,7 @@ async function test() {
56
59
  $fd: 'test.com',
57
60
  '$hdr(X-MyHeader1)': 'abc',
58
61
  hdr_x_myheader2: 'def',
62
+ hdr_max_forwards: max_forwards,
59
63
  })
60
64
  },
61
65
  {
@@ -87,8 +87,8 @@ async function test() {
87
87
 
88
88
  await z.sleep(100)
89
89
 
90
- sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/yosemitesam.wav', end_of_file_event: true})
91
- sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/yosemitesam.wav', end_of_file_event: true})
90
+ sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/hello_good_morning.wav', end_of_file_event: true})
91
+ sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/hello_good_morning.wav', end_of_file_event: true})
92
92
 
93
93
  await z.sleep(500)
94
94
 
@@ -143,7 +143,7 @@ async function test() {
143
143
  event: 'end_of_file',
144
144
  call_id: oc.id,
145
145
  },
146
- ], 2000)
146
+ ], 5000)
147
147
 
148
148
 
149
149
  sip.call.reinvite(ic.id)
@@ -87,8 +87,8 @@ async function test() {
87
87
 
88
88
  await z.sleep(100)
89
89
 
90
- sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/yosemitesam.wav', end_of_file_event: true, no_loop: true})
91
- sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/yosemitesam.wav', end_of_file_event: true, no_loop: true})
90
+ sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/hello_good_morning.wav', end_of_file_event: true, no_loop: true})
91
+ sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/hello_good_morning.wav', end_of_file_event: true, no_loop: true})
92
92
 
93
93
  sip.call.reinvite(oc.id)
94
94
 
@@ -183,7 +183,7 @@ async function test() {
183
183
  event: 'end_of_file',
184
184
  call_id: oc.id,
185
185
  },
186
- ], 3000)
186
+ ], 5000)
187
187
 
188
188
  await z.sleep(3000) // we should not receive end_of_file events again
189
189
 
package/samples/tcp.js CHANGED
@@ -312,8 +312,8 @@ async function test() {
312
312
  },
313
313
  ], 2000)
314
314
 
315
- sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/yosemitesam.wav'})
316
- sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/yosemitesam.wav'})
315
+ sip.call.start_play_wav(oc.id, {file: 'samples/artifacts/hello_good_morning.wav'})
316
+ sip.call.start_play_wav(ic.id, {file: 'samples/artifacts/hello_good_morning.wav'})
317
317
 
318
318
  await z.sleep(2000)
319
319
 
package/src/sip.cpp CHANGED
@@ -8607,6 +8607,15 @@ pj_bool_t add_headers(pj_pool_t *pool, pjsip_tx_data *tdata,
8607
8607
  const char *value = itr->value.GetString();
8608
8608
 
8609
8609
  pj_str_t hname = pj_str((char *)name);
8610
+
8611
+ if (pj_stricmp2(&hname, "Max-Forwards") == 0) {
8612
+ pjsip_max_fwd_hdr* max_fwd = (pjsip_max_fwd_hdr*)pjsip_msg_find_hdr(tdata->msg, PJSIP_H_MAX_FORWARDS, NULL);
8613
+ if (max_fwd) {
8614
+ max_fwd->ivalue = atoi(value);
8615
+ continue;
8616
+ }
8617
+ }
8618
+
8610
8619
  pjsip_hdr *hdr = (pjsip_hdr *)pjsip_parse_hdr(pool, &hname, (char *)value,
8611
8620
  strlen(value), NULL);
8612
8621
 
Binary file