drachtio-srf 4.4.55 → 4.4.59

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.
@@ -26,6 +26,7 @@ function sockPort(socket) {
26
26
  }
27
27
 
28
28
  function serverVersionAtLeast(serverVersion, minSupportedVersion) {
29
+ if (process.env.NODE_ENV === 'test') return true;
29
30
  if (serverVersion) {
30
31
  try {
31
32
  const regex = /^v(\d+)\.(\d+)\.(\d+)/;
@@ -335,7 +336,7 @@ class DrachtioAgent extends Emitter {
335
336
  const obj = this.mapServer.get(res.socket) ;
336
337
  debug(`agent#sendResponse: ${JSON.stringify(res.msg)}`);
337
338
  const msgId = this.sendMessage(res.socket, res.msg, Object.assign({stackTxnId: res.req.stackTxnId}, opts)) ;
338
- if (callback || fnAck) {
339
+ if ((callback && typeof callback === 'function') || fnAck) {
339
340
 
340
341
  obj.pendingRequests.set(msgId, (token, msg, meta) => {
341
342
  obj.pendingRequests.delete(msgId) ;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "drachtio-srf",
3
- "version": "4.4.55",
3
+ "version": "4.4.59",
4
4
  "description": "drachtio signaling resource framework",
5
5
  "main": "lib/srf.js",
6
6
  "scripts": {
@@ -26,7 +26,7 @@
26
26
  "debug": "^3.2.7",
27
27
  "delegates": "^0.1.0",
28
28
  "deprecate": "^1.1.1",
29
- "drachtio-sip": "^0.6.0",
29
+ "drachtio-sip": "^0.6.2",
30
30
  "node-noop": "0.0.1",
31
31
  "only": "0.0.2",
32
32
  "sdp-transform": "^2.14.1",
@@ -138,4 +138,15 @@ services:
138
138
  networks:
139
139
  testbed:
140
140
  ipv4_address: 172.29.0.22
141
-
141
+
142
+
143
+ sipp-uas-prack:
144
+ image: drachtio/sipp:latest
145
+ command: sipp -sf /tmp/uas-prack.xml
146
+ container_name: sipp-uas-prack
147
+ volumes:
148
+ - ./scenarios:/tmp
149
+ tty: true
150
+ networks:
151
+ testbed:
152
+ ipv4_address: 172.29.0.23
@@ -0,0 +1,146 @@
1
+ <?xml version="1.0" encoding="ISO-8859-1" ?>
2
+ <!DOCTYPE scenario SYSTEM "sipp.dtd">
3
+
4
+ <!-- This program is free software; you can redistribute it and/or -->
5
+ <!-- modify it under the terms of the GNU General Public License as -->
6
+ <!-- published by the Free Software Foundation; either version 2 of the -->
7
+ <!-- License, or (at your option) any later version. -->
8
+ <!-- -->
9
+ <!-- This program is distributed in the hope that it will be useful, -->
10
+ <!-- but WITHOUT ANY WARRANTY; without even the implied warranty of -->
11
+ <!-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the -->
12
+ <!-- GNU General Public License for more details. -->
13
+ <!-- -->
14
+ <!-- You should have received a copy of the GNU General Public License -->
15
+ <!-- along with this program; if not, write to the -->
16
+ <!-- Free Software Foundation, Inc., -->
17
+ <!-- 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA -->
18
+ <!-- -->
19
+ <!-- Sipp default 'uas' scenario. -->
20
+ <!-- -->
21
+
22
+ <scenario name="Basic UAS responder">
23
+ <!-- By adding rrs="true" (Record Route Sets), the route sets -->
24
+ <!-- are saved and used for following messages sent. Useful to test -->
25
+ <!-- against stateful SIP proxies/B2BUAs. -->
26
+ <recv request="INVITE" crlf="true">
27
+ <action>
28
+ <ereg regexp=".*" search_in="hdr" header="Subject:" assign_to="1" />
29
+ <ereg regexp=".*" search_in="hdr" header="CSeq:" assign_to="2" />
30
+ <ereg regexp=".*" search_in="hdr" header="To:" assign_to="3" />
31
+ <ereg regexp=".*" search_in="hdr" header="Via:" assign_to="4" />
32
+ </action>
33
+ </recv>
34
+
35
+ <!-- The '[last_*]' keyword is replaced automatically by the -->
36
+ <!-- specified header if it was present in the last message received -->
37
+ <!-- (except if it was a retransmission). If the header was not -->
38
+ <!-- present or if no message has been received, the '[last_*]' -->
39
+ <!-- keyword is discarded, and all bytes until the end of the line -->
40
+ <!-- are also discarded. -->
41
+ <!-- -->
42
+ <!-- If the specified header was present several times in the -->
43
+ <!-- message, all occurrences are concatenated (CRLF separated) -->
44
+ <!-- to be used in place of the '[last_*]' keyword. -->
45
+
46
+ <send>
47
+ <![CDATA[
48
+
49
+ SIP/2.0 180 Ringing
50
+ [last_Via:]
51
+ [last_From:]
52
+ To: [$3];tag=[pid]SIPpTag01[call_number]
53
+ [last_Call-ID:]
54
+ [last_CSeq:]
55
+ [last_Record-Route:]
56
+ Subject:[$1]
57
+ Require: 100rel
58
+ RSeq: 1
59
+ Content-Length: 0
60
+
61
+ ]]>
62
+ </send>
63
+
64
+ <recv request="PRACK"crlf="true">
65
+ </recv>
66
+
67
+ <send>
68
+ <![CDATA[
69
+
70
+ SIP/2.0 200 OK
71
+ [last_Via:]
72
+ [last_From:]
73
+ To: [$3];tag=[pid]SIPpTag01[call_number]
74
+ [last_Call-ID:]
75
+ [last_CSeq:]
76
+ Subject:[$1]
77
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
78
+ Content-Length: 0
79
+
80
+ ]]>
81
+ </send>
82
+
83
+
84
+
85
+ <send>
86
+ <![CDATA[
87
+
88
+ SIP/2.0 200 OK
89
+ Via: [$4]
90
+ [last_From:]
91
+ To: [$3];tag=[pid]SIPpTag01[call_number]
92
+ [last_Call-ID:]
93
+ CSeq: [$2]
94
+ [last_Record-Route:]
95
+ Subject:[$1]
96
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
97
+ Content-Type: application/sdp
98
+ Content-Length: [len]
99
+
100
+ v=0
101
+ o=user1 53655765 2353687637 IN IP[local_ip_type] [local_ip]
102
+ s=-
103
+ c=IN IP[media_ip_type] [media_ip]
104
+ t=0 0
105
+ m=audio [media_port] RTP/AVP 0
106
+ a=rtpmap:0 PCMU/8000
107
+
108
+ ]]>
109
+ </send>
110
+
111
+ <recv request="ACK"
112
+ rtd="true"
113
+ crlf="true">
114
+ </recv>
115
+
116
+ <recv request="BYE">
117
+ </recv>
118
+
119
+ <send>
120
+ <![CDATA[
121
+
122
+ SIP/2.0 200 OK
123
+ [last_Via:]
124
+ [last_From:]
125
+ [last_To:]
126
+ [last_Call-ID:]
127
+ [last_CSeq:]
128
+ Contact: <sip:[local_ip]:[local_port];transport=[transport]>
129
+ Content-Length: 0
130
+
131
+ ]]>
132
+ </send>
133
+
134
+ <!-- Keep the call open for a while in case the 200 is lost to be -->
135
+ <!-- able to retransmit it if we receive the BYE again. -->
136
+ <timewait milliseconds="4000"/>
137
+
138
+
139
+ <!-- definition of the response time repartition table (unit is ms) -->
140
+ <ResponseTimeRepartition value="10, 20, 30, 40, 50, 100, 150, 200"/>
141
+
142
+ <!-- definition of the call length repartition table (unit is ms) -->
143
+ <CallLengthRepartition value="10, 50, 100, 500, 1000, 5000, 10000"/>
144
+
145
+ </scenario>
146
+
package/test/uac.js CHANGED
@@ -20,6 +20,20 @@ test('UAC', (t) => {
20
20
  let uacOverlap;
21
21
  let srf = new Srf();
22
22
  connect(srf)
23
+ .then(() => {
24
+ return srf.createUAC('sip:sipp-uas-prack', {
25
+ method: 'INVITE',
26
+ headers: {
27
+ To: 'sip:dhorton@sip.drachtio.org',
28
+ From: 'sip:dhorton@sip.drachtio.org'
29
+ }
30
+ });
31
+ })
32
+ .then((uac) => {
33
+ t.pass('Srf#createUAC sends PRACK when received RSeq');
34
+ uac.destroy();
35
+ return;
36
+ })
23
37
  .then(() => {
24
38
  return srf.createUAC('sip:sipp-uas-302', {
25
39
  method: 'INVITE',
@@ -36,6 +50,7 @@ test('UAC', (t) => {
36
50
  uac.destroy();
37
51
  return;
38
52
  })
53
+
39
54
  .then(() => {
40
55
  return srf.createUAC('sip:sipp-uas', {
41
56
  method: 'INVITE',
@@ -362,7 +377,6 @@ test('UAC', (t) => {
362
377
  srf.disconnect();
363
378
  return t.pass('Srf#request can be canceled');
364
379
  })
365
-
366
380
  .then(() => {
367
381
  return t.end();
368
382
  })