@babblevoice/projectrtp 2.4.16 → 2.5.20
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 +3 -70
- package/lib/server.js +3 -3
- package/package.json +6 -4
- package/src/globals.h +2 -0
- package/src/projectrtpbuffer.cpp +30 -6
- package/src/projectrtpbuffer.h +14 -3
- package/src/projectrtpchannel.cpp +110 -56
- package/src/projectrtpchannel.h +6 -0
- package/src/projectrtpchannelmux.cpp +8 -10
- package/src/projectrtpcodecx.cpp +10 -7
- package/src/projectrtpcodecx.h +17 -2
- package/src/projectrtppacket.cpp +16 -41
- package/src/projectrtppacket.h +0 -2
- package/src/projectrtprawsound.cpp +23 -6
- package/src/projectrtprawsound.h +3 -2
- package/src/projectrtpsoundfile.cpp +4 -1
- package/src/projectrtptonegen.cpp +26 -43
- package/test/interface/projectrtpchannel.js +10 -10
- package/test/interface/projectrtpdtmf.js +86 -2
- package/test/interface/projectrtpmix.js +1 -2
- package/test/interface/rtpproxymultinode.js +5 -5
- package/test/interface/transcode.js +657 -0
|
@@ -23,6 +23,21 @@ function sendpayload( sendtime, pk, dstport, server ) {
|
|
|
23
23
|
}, sendtime )
|
|
24
24
|
}
|
|
25
25
|
|
|
26
|
+
/**
|
|
27
|
+
* Limitation of not parsing ccrc.
|
|
28
|
+
* @param { Buffer } packet
|
|
29
|
+
* @return { object }
|
|
30
|
+
*/
|
|
31
|
+
function parsepk( packet ) {
|
|
32
|
+
return {
|
|
33
|
+
sn: packet.readUInt16BE( 2 ),
|
|
34
|
+
ts: packet.readUInt32BE( 4 ),
|
|
35
|
+
pt: packet.readUInt8( 1 ) & 0x7f,
|
|
36
|
+
ssrc: packet.readUInt32BE( 8 ),
|
|
37
|
+
payload: new Uint8Array( packet.slice( 12 ) )
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
|
|
26
41
|
/* helper functions */
|
|
27
42
|
function sendpk( sn, ts, sendtime, dstport, server, pt = 0, ssrc ) {
|
|
28
43
|
|
|
@@ -253,6 +268,74 @@ describe( "dtmf", function() {
|
|
|
253
268
|
expect( dtmfpkcount ).to.equal( 3*3 )
|
|
254
269
|
} )
|
|
255
270
|
|
|
271
|
+
it( "2 channels mixing and request rtp server to send 2833 to one with dynamic payloadtype", async function() {
|
|
272
|
+
|
|
273
|
+
/* create our RTP/UDP endpoint */
|
|
274
|
+
const clienta = dgram.createSocket( "udp4" )
|
|
275
|
+
const clientb = dgram.createSocket( "udp4" )
|
|
276
|
+
|
|
277
|
+
const rfc2833pt = 44
|
|
278
|
+
|
|
279
|
+
let dtmfpkcount = 0
|
|
280
|
+
clienta.on( "message", function( msg ) {
|
|
281
|
+
if( rfc2833pt == ( 0x7f & msg [ 1 ] ) ) {
|
|
282
|
+
dtmfpkcount++
|
|
283
|
+
} else {
|
|
284
|
+
expect( msg.length ).to.equal( 172 )
|
|
285
|
+
expect( 0x7f & msg [ 1 ] ).to.equal( 0 )
|
|
286
|
+
}
|
|
287
|
+
} )
|
|
288
|
+
|
|
289
|
+
clientb.on( "message", function( msg ) {
|
|
290
|
+
if( 101 == ( 0x7f & msg [ 1 ] ) ) {
|
|
291
|
+
expect( true ).to.equal( false ) //here = bad
|
|
292
|
+
dtmfpkcount++
|
|
293
|
+
}
|
|
294
|
+
clientb.send( msg, channelb.local.port, "localhost" )
|
|
295
|
+
} )
|
|
296
|
+
|
|
297
|
+
this.timeout( 3000 )
|
|
298
|
+
this.slow( 2500 )
|
|
299
|
+
|
|
300
|
+
clienta.bind()
|
|
301
|
+
await new Promise( ( resolve ) => { clienta.on( "listening", () => resolve() ) } )
|
|
302
|
+
clientb.bind()
|
|
303
|
+
await new Promise( ( resolve ) => { clientb.on( "listening", () => resolve() ) } )
|
|
304
|
+
|
|
305
|
+
const ouraport = clienta.address().port
|
|
306
|
+
const ourbport = clientb.address().port
|
|
307
|
+
|
|
308
|
+
let done
|
|
309
|
+
const finished = new Promise( ( r ) => { done = r } )
|
|
310
|
+
|
|
311
|
+
const channela = await projectrtp.openchannel( { "remote": { "address": "localhost", "port": ouraport, "codec": 0, rfc2833pt } }, function( d ) {
|
|
312
|
+
if( "close" === d.action ) channelb.close()
|
|
313
|
+
} )
|
|
314
|
+
|
|
315
|
+
const channelb = await projectrtp.openchannel( { "remote": { "address": "localhost", "port": ourbport, "codec": 0 } }, function( d ) {
|
|
316
|
+
if( "close" === d.action ) done()
|
|
317
|
+
} )
|
|
318
|
+
|
|
319
|
+
expect( channela.mix( channelb ) ).to.be.true
|
|
320
|
+
|
|
321
|
+
/* send a packet every 20mS x 70 */
|
|
322
|
+
for( let i = 0; 50 > i; i ++ ) {
|
|
323
|
+
sendpk( i, i*160, i*20, channela.local.port, clienta )
|
|
324
|
+
}
|
|
325
|
+
|
|
326
|
+
await new Promise( ( resolve ) => { setTimeout( () => resolve(), 400 ) } )
|
|
327
|
+
channela.dtmf( "*9F" )
|
|
328
|
+
await new Promise( ( resolve ) => { setTimeout( () => resolve(), 800 ) } )
|
|
329
|
+
channela.close()
|
|
330
|
+
|
|
331
|
+
await finished
|
|
332
|
+
|
|
333
|
+
clienta.close()
|
|
334
|
+
clientb.close()
|
|
335
|
+
|
|
336
|
+
expect( dtmfpkcount ).to.equal( 3*3 )
|
|
337
|
+
} )
|
|
338
|
+
|
|
256
339
|
it( "3 channels mixing and request rtp server to send 2833 to one", async function() {
|
|
257
340
|
|
|
258
341
|
/* create our RTP/UDP endpoint */
|
|
@@ -262,11 +345,12 @@ describe( "dtmf", function() {
|
|
|
262
345
|
|
|
263
346
|
let dtmfpkcount = 0
|
|
264
347
|
clienta.on( "message", function( msg ) {
|
|
265
|
-
|
|
348
|
+
const pk = parsepk( msg )
|
|
349
|
+
if( 101 == pk.pt ) {
|
|
266
350
|
dtmfpkcount++
|
|
267
351
|
} else {
|
|
268
352
|
expect( msg.length ).to.equal( 172 )
|
|
269
|
-
expect(
|
|
353
|
+
expect( pk.pt ).to.equal( 0 )
|
|
270
354
|
}
|
|
271
355
|
} )
|
|
272
356
|
|
|
@@ -904,8 +904,7 @@ describe( "channel mix", function() {
|
|
|
904
904
|
expect( endpointbpkcountzero ).to.be.within( 65, 75 )
|
|
905
905
|
expect( endpointcpkcountzero ).to.be.within( 65, 75 )
|
|
906
906
|
expect( endpointapkcountnotzero ).to.be.within( 4, 12 )
|
|
907
|
-
expect( endpointbpkcountnotzero ).to.be.within( 4
|
|
908
|
-
, 12 )
|
|
907
|
+
expect( endpointbpkcountnotzero ).to.be.within( 4, 12 )
|
|
909
908
|
expect( endpointcpkcountnotzero ).to.be.below( 2 )
|
|
910
909
|
|
|
911
910
|
await finished
|
|
@@ -6,7 +6,7 @@ const mocknode = require( "../mock/mocknode" )
|
|
|
6
6
|
|
|
7
7
|
describe( "rtpproxy multi node", function() {
|
|
8
8
|
|
|
9
|
-
it( "2 node simple mix", async function() {
|
|
9
|
+
it.skip( "2 node simple mix", async function() {
|
|
10
10
|
|
|
11
11
|
const actual = { "mix": 0, "open": 0, "unmix": 0, "close": 0, "remote": 0 }
|
|
12
12
|
/*
|
|
@@ -173,7 +173,7 @@ describe( "rtpproxy multi node", function() {
|
|
|
173
173
|
|
|
174
174
|
} )
|
|
175
175
|
|
|
176
|
-
it( "2 node 2 channel simple mix rtp server listening on same node", async function() {
|
|
176
|
+
it.skip( "2 node 2 channel simple mix rtp server listening on same node", async function() {
|
|
177
177
|
|
|
178
178
|
/*
|
|
179
179
|
We need to check that the nodes are maintained when using the same rtp server.
|
|
@@ -316,7 +316,7 @@ describe( "rtpproxy multi node", function() {
|
|
|
316
316
|
|
|
317
317
|
} )
|
|
318
318
|
|
|
319
|
-
it( "2 node 2 channel connect to same rtp server not broken", async function() {
|
|
319
|
+
it.skip( "2 node 2 channel connect to same rtp server not broken", async function() {
|
|
320
320
|
|
|
321
321
|
/*
|
|
322
322
|
We need to check that the nodes are maintained when using the same rtp server.
|
|
@@ -403,7 +403,7 @@ describe( "rtpproxy multi node", function() {
|
|
|
403
403
|
prtp.proxy.clearnodes()
|
|
404
404
|
} )
|
|
405
405
|
|
|
406
|
-
it( "2 node 1 channel on one, 2 channels other", async function() {
|
|
406
|
+
it.skip( "2 node 1 channel on one, 2 channels other", async function() {
|
|
407
407
|
|
|
408
408
|
this.timeout( 3000 )
|
|
409
409
|
this.slow( 2500 )
|
|
@@ -587,7 +587,7 @@ describe( "rtpproxy multi node", function() {
|
|
|
587
587
|
|
|
588
588
|
} )
|
|
589
589
|
|
|
590
|
-
it( "3 node 1 channel each, close main node", async function() {
|
|
590
|
+
it.skip( "3 node 1 channel each, close main node", async function() {
|
|
591
591
|
|
|
592
592
|
this.timeout( 3000 )
|
|
593
593
|
this.slow( 2500 )
|