sip-lab 1.13.0 → 1.13.1

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
@@ -10,19 +10,22 @@ It permits to:
10
10
  - send and receive DTMF inband/RFC2833/INFO.
11
11
  - play/record wav file on a call
12
12
  - send/receive fax (T.30 only)
13
- - send/receive MRCPv2 messages (experimental)
13
+ - send/receive MRCPv2 messages (TCP only, no TLS)
14
14
 
15
15
  TODO:
16
- - add suport for T.38 fax
17
- - add support for WebRTC
18
16
  - add support for video playing/recording from/to file
17
+ - add support for T.38 fax
18
+ - add support for WebSocket
19
+ - add support for WebRTC
20
+ - add support for SRTP
21
+ - add support for MSRP
19
22
 
20
23
  ### Installation
21
24
 
22
25
  This is a node.js addon and it is known to work on Debian 11, Debian 10, Ubuntu 22.04 and Ubuntu 20.04.
23
26
  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 built of the addon will be executed. Being the case, be patient as the build process will take several minutes to complete).
24
27
 
25
- To install it, first install some dependencies (you might not need them if your are on Debian 11).
28
+ To install it, first install some build dependencies (you might not need them if your are on Debian 11).
26
29
  ```
27
30
  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 cmake
28
31
  ```
package/binding.gyp CHANGED
@@ -44,7 +44,6 @@
44
44
  '-L ../3rdParty/pjproject/third_party/lib',
45
45
  '-l pjnath-x86_64-unknown-linux-gnu',
46
46
  '-l ilbccodec-x86_64-unknown-linux-gnu',
47
- '-l srtp-x86_64-unknown-linux-gnu',
48
47
  '-l webrtc-x86_64-unknown-linux-gnu',
49
48
  '-l yuv-x86_64-unknown-linux-gnu',
50
49
  '-l speex-x86_64-unknown-linux-gnu',
@@ -87,6 +86,7 @@
87
86
  '-lopencore-amrwb',
88
87
  '-lvo-amrwbenc',
89
88
  '-lspeex',
89
+ '-l srtp-x86_64-unknown-linux-gnu',
90
90
  ],
91
91
  },
92
92
  },
package/build_deps.sh CHANGED
@@ -54,7 +54,8 @@ then
54
54
  #git checkout de3d744c2e1188b59bb907b6ee32ef83740ebc64
55
55
  #git checkout 33a3c9e0a5eb84426edef05a9aa98af17d8011c3 # required for bcg729
56
56
  #git checkout 797088ed133c98492519b7d042b75735f6f9388c # updated as part of #21
57
- git checkout 651df5b50129b7c5a5feec8336dda4468d53d2b0 # updated to latest to see of crash issues improve
57
+ #git checkout 651df5b50129b7c5a5feec8336dda4468d53d2b0 # updated to latest to see of crash issues improve
58
+ git checkout 043926a5846963a2c99378e8daa495230923eaab # update to try to solve ##49 (but issue remains)
58
59
 
59
60
  cat > user.mak <<EOF
60
61
  export CFLAGS += -fPIC -g
@@ -64,7 +65,6 @@ EOF
64
65
  sed -i -r 's/BCG729_LIBS="-lbcg729"/BCG729_LIBS=''/' aconfigure
65
66
  LIBS=`pwd`/../bcg729/src/libbcg729.a ./configure --with-bcg729=`pwd`/../bcg729
66
67
  cat > pjlib/include/pj/config_site.h <<EOF
67
- #define PJMEDIA_HAS_SRTP 0
68
68
  EOF
69
69
  make dep && make clean && make
70
70
  fi
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "sip-lab",
3
- "version": "1.13.0",
3
+ "version": "1.13.1",
4
4
  "description": "",
5
5
  "main": "index.js",
6
6
  "engines": {
Binary file
Binary file
@@ -130,7 +130,7 @@ async function test() {
130
130
  mode: 1,
131
131
  media_id: 1
132
132
  },
133
- ], 1500)
133
+ ], 2000)
134
134
 
135
135
  sip.call.reinvite(oc.id, {media: 'audio,audio'})
136
136
 
package/src/sip.cpp CHANGED
@@ -433,7 +433,7 @@ struct AsockUserData {
433
433
  MediaEndpoint *media_endpt;
434
434
  Call *call;
435
435
  char buf[MAX_TCP_DATA];
436
- char len;
436
+ pj_size_t len;
437
437
  };
438
438
 
439
439
  bool init_media_ports(Call *c, AudioEndpoint *ae, unsigned sampling_rate,
@@ -841,18 +841,20 @@ static pj_bool_t on_data_read(pj_activesock_t *asock, void *data,
841
841
  AsockUserData *ud = (AsockUserData*)pj_activesock_get_user_data(asock);
842
842
  if(!ud) return PJ_FALSE;
843
843
 
844
- printf("%.*s\n", size, data);
845
844
  if (size == 0) {
846
845
  // TODO: destroy the activesock.
847
846
  return PJ_FALSE;
848
847
  }
849
848
 
850
- assert(size + ud->len < MAX_TCP_DATA);
849
+ assert(ud->len >= 0);
850
+
851
+ assert(size >= 0);
852
+ assert(size + ud->len + 1 < MAX_TCP_DATA);
851
853
 
852
854
  memcpy(&ud->buf[ud->len], data, size);
853
- ud->len = size + ud->len;
855
+ ud->len = ud->len + size;
854
856
  ud->buf[ud->len] = '\0';
855
-
857
+
856
858
  char *sep = strstr(ud->buf, "\r\n\r\n");
857
859
  if(!sep) {
858
860
  // msg incomplete
@@ -877,8 +879,10 @@ static pj_bool_t on_data_read(pj_activesock_t *asock, void *data,
877
879
  num_str[len] = '\0';
878
880
  int body_len = atoi(num_str);
879
881
 
880
- if(sep+4+body_len < ud->buf+ud->len) {
881
- // msg incomplete
882
+ assert(body_len > 0 && body_len < 4096);
883
+
884
+ if(ud->buf+ud->len < sep+4+body_len) {
885
+ printf("tcp data: msg incomplete %i %i\n", ud->buf+ud->len, sep+4+body_len);
882
886
  *remainder = 0;
883
887
  return PJ_TRUE;
884
888
  }
@@ -3294,7 +3298,7 @@ int pjw_call_start_record_wav(long call_id, const char *json) {
3294
3298
  pj_status_t status;
3295
3299
  pjmedia_port *stream_port;
3296
3300
 
3297
- unsigned media_id;
3301
+ unsigned media_id = 0;
3298
3302
 
3299
3303
  MediaEndpoint *me;
3300
3304
  AudioEndpoint *ae;
@@ -3399,7 +3403,7 @@ int pjw_call_start_play_wav(long call_id, const char *json) {
3399
3403
  AudioEndpoint *ae;
3400
3404
  int ae_count;
3401
3405
 
3402
- unsigned media_id;
3406
+ unsigned media_id = 0;
3403
3407
 
3404
3408
  char *file;
3405
3409
 
@@ -3527,7 +3531,7 @@ int pjw_call_stop_play_wav(long call_id, const char *json) {
3527
3531
  int ae_count;
3528
3532
  int res;
3529
3533
 
3530
- unsigned media_id;
3534
+ unsigned media_id = 0;
3531
3535
 
3532
3536
  char buffer[MAX_JSON_INPUT];
3533
3537
 
@@ -3624,7 +3628,7 @@ int pjw_call_stop_record_wav(long call_id, const char *json) {
3624
3628
  int ae_count;
3625
3629
  int res;
3626
3630
 
3627
- unsigned media_id;
3631
+ unsigned media_id = 0;
3628
3632
 
3629
3633
  char buffer[MAX_JSON_INPUT];
3630
3634
 
@@ -3703,7 +3707,7 @@ int pjw_call_start_fax(long call_id, const char *json) {
3703
3707
  AudioEndpoint *ae;
3704
3708
  int ae_count;
3705
3709
 
3706
- unsigned media_id;
3710
+ unsigned media_id = 0;
3707
3711
 
3708
3712
  char buffer[MAX_JSON_INPUT];
3709
3713
 
@@ -3841,7 +3845,7 @@ int pjw_call_stop_fax(long call_id, const char *json) {
3841
3845
  int ae_count;
3842
3846
  int res;
3843
3847
 
3844
- unsigned media_id;
3848
+ unsigned media_id = 0;
3845
3849
 
3846
3850
  char buffer[MAX_JSON_INPUT];
3847
3851
 
@@ -3924,7 +3928,7 @@ int pjw_call_get_stream_stat(long call_id, const char *json, char *out_stats) {
3924
3928
  AudioEndpoint *ae;
3925
3929
  VideoEndpoint *ve;
3926
3930
 
3927
- unsigned media_id;
3931
+ unsigned media_id = 0;
3928
3932
 
3929
3933
  pjmedia_stream *med_stream = NULL;
3930
3934
 
@@ -7601,7 +7605,7 @@ int pjw_call_send_tcp_msg(long call_id, const char *json) {
7601
7605
  MrcpEndpoint *mrcp_endpt;
7602
7606
  int res;
7603
7607
 
7604
- unsigned media_id;
7608
+ unsigned media_id = 0;
7605
7609
 
7606
7610
  char buffer[MAX_JSON_INPUT];
7607
7611