sip-lab 1.12.12 → 1.12.13

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
@@ -25,12 +25,17 @@ apt install build-essential automake autoconf libtool libspeex-dev libopus-dev l
25
25
 
26
26
  Then install sip-lab by doing:
27
27
  ```
28
- npm install sip-lab
28
+ npm install sip-lab
29
29
  ```
30
30
 
31
31
  Be patient because we will need to download pjproject and build it.
32
32
 
33
- We will also download rapidjson.
33
+ We will also download and build spandsp, bcg729 and rapidjson.
34
+
35
+ However since it takes several minutes to build this module, you can install it globally:
36
+ ```
37
+ npm install -g sip-lab
38
+ ```
34
39
 
35
40
  To test from within this repo just build and install by doing:
36
41
  ```
@@ -49,6 +54,7 @@ It was originally developed with node v.10 and tested with v.12 and v16.13.1 and
49
54
  (it is known to not work with node v.8)
50
55
 
51
56
 
57
+
52
58
  ### About the code
53
59
 
54
60
  Although the code in written in *.cpp/*.hpp named files, this is not actually a C++ project.
package/devjournal CHANGED
@@ -438,5 +438,12 @@ When rebuilding the addon, this should be enough (it should be fast):
438
438
  ```
439
439
  npm install --unsafe-perm
440
440
  ```
441
+ ------------------------------------------------------------
442
+ 2022/09/11 takeshi:
443
+
444
+ To try to solve #21, we upraded pjproject to commit 797088ed133c98492519b7d042b75735f6f9388c.
445
+ However, after doing it we verified sending CANCEL doesn't cause the other side to send '497 Request Terminated' by itself anymore (see samples/sip_cancel.js)
446
+
447
+
441
448
 
442
449
 
package/install.sh CHANGED
@@ -52,10 +52,8 @@ then
52
52
  git clone https://github.com/pjsip/pjproject
53
53
  cd pjproject
54
54
  #git checkout de3d744c2e1188b59bb907b6ee32ef83740ebc64
55
- git checkout 33a3c9e0a5eb84426edef05a9aa98af17d8011c3 # required for bcg729
56
-
57
- #echo "Patching sip_transaction.c to avoid problems with CANCEL"
58
- sed -i -r 's|event->body.tx_msg.tdata == tsx->last_tx,|\t\t\t1, /* \0 */|' pjsip/src/pjsip/sip_transaction.c
55
+ #git checkout 33a3c9e0a5eb84426edef05a9aa98af17d8011c3 # required for bcg729
56
+ git checkout 797088ed133c98492519b7d042b75735f6f9388c # updated as part of #21
59
57
 
60
58
  cat > user.mak <<EOF
61
59
  export CFLAGS += -fPIC -g
package/package.json CHANGED
@@ -1,13 +1,14 @@
1
1
  {
2
2
  "name": "sip-lab",
3
- "version": "1.12.12",
3
+ "version": "1.12.13",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "engines": {
7
7
  "node": ">=10.22"
8
8
  },
9
9
  "scripts": {
10
- "install": "./install.sh"
10
+ "install": "./install.sh",
11
+ "test": "./runtests"
11
12
  },
12
13
  "repository": {
13
14
  "type": "git",
@@ -3,6 +3,7 @@ var Zeq = require('@mayama/zeq')
3
3
  var z = new Zeq()
4
4
  var m = require('data-matching')
5
5
  var sip_msg = require('sip-matching')
6
+ var assert = require('assert')
6
7
 
7
8
  async function test() {
8
9
  //sip.set_log_level(6)
@@ -116,12 +117,14 @@ async function test() {
116
117
  msg: sip_msg({
117
118
  $rm: 'NOTIFY',
118
119
  '$hdr(Event)': 'dialog',
119
- '$hdr(Subscription-State)': 'active;expires=120',
120
+ '$hdr(Subscription-State)': 'active;expires=!{sub_expires}',
120
121
  '$hdr(Allow-Events)': 'refer, dialog',
121
122
  }),
122
123
  },
123
124
  ], 1000)
124
125
 
126
+ assert(parseInt(z.store.sub_expires) > 0)
127
+
125
128
  sip.account.unregister(a1)
126
129
 
127
130
  await z.wait([
@@ -87,6 +87,11 @@ async function test() {
87
87
  $rr: 'OK',
88
88
  }),
89
89
  },
90
+ ], 1000)
91
+
92
+ sip.call.respond(ic.id, {code: 487, reason: 'Request Terminated'})
93
+
94
+ await z.wait([
90
95
  {
91
96
  event: 'response',
92
97
  call_id: oc.id,
@@ -26,8 +26,11 @@ int make_evt_dtmf(char *dest, int size, long call_id, int digits_len, const char
26
26
  }
27
27
 
28
28
  int make_evt_call_ended(char *dest, int size, long call_id, int sip_msg_len, const char *sip_msg) {
29
- printf("sip_msg_len=%i sip_msg=%s\n", sip_msg_len, sip_msg);
30
- if(sip_msg_len > 500 && sip_msg_len < 2000 && sip_msg) {
29
+ printf("sip_msg_len=%i sip_msg=%x\n", sip_msg_len, sip_msg);
30
+ if(!sip_msg || sip_msg == (char*)0xc000000000000) {
31
+ // received invalid pointer to sip_msg so do not add the message to the event
32
+ return snprintf(dest, size, "{\"event\": \"call_ended\", \"call_id\": %ld}", call_id);
33
+ } else if(sip_msg_len > 500 && sip_msg_len < 2000 && sip_msg) {
31
34
  /* sip_msg_len sometimes show up as a large value like sip_msg_len=11560297 which seems to be a bug in pjsip */
32
35
  return snprintf(dest, size, "{\"event\": \"call_ended\", \"call_id\": %ld}\n%.*s", call_id, sip_msg_len, sip_msg);
33
36
  } else {