sip-lab 1.34.3 → 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,15 +1,15 @@
1
- ## sip-lab
1
+ # sip-lab
2
2
 
3
- ### Overview
3
+ ## Overview
4
4
 
5
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
- ### Documentation
8
+ ## Documentation
9
9
 
10
10
  See [Documentation](https://github.com/MayamaTakeshi/sip-lab/blob/master/DOC.md)
11
11
 
12
- ### Installation
12
+ ## Installation
13
13
 
14
14
  The npm package is built for Debian 11 and this is the recommended distro.
15
15
 
@@ -42,7 +42,7 @@ The above script has detailed comments.
42
42
 
43
43
  Please read it to undestand how to write your own test scripts.
44
44
 
45
- ### Samples
45
+ ## Samples
46
46
 
47
47
  See general sample scripts in folder samples.
48
48
 
@@ -69,13 +69,13 @@ node node_modules/sip-lab/samples_extra/ws_speech_server.google.js
69
69
  ```
70
70
 
71
71
 
72
- ### About the code
72
+ ## About the code
73
73
 
74
74
  Although the code in written in *.cpp/*.hpp named files, this is not actually a C++ project.
75
75
 
76
76
  It is mostly written in C using some C++ facilities.
77
77
 
78
- ### Release Notes
78
+ ## Release Notes
79
79
 
80
80
  [ReleaseNotes](https://github.com/MayamaTakeshi/sip-lab/blob/master/RELEASE_NOTES.md)
81
81
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sip-lab",
3
- "version": "1.34.3",
3
+ "version": "1.34.4",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "engines": {
Binary file
Binary file
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
  {
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