@babblevoice/babble-drachtio-callmanager 1.1.0 → 1.1.3
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/lib/call.js +14 -17
- package/package.json +2 -2
- package/test/interface/sdp.js +37 -0
package/lib/call.js
CHANGED
|
@@ -930,13 +930,14 @@ class call {
|
|
|
930
930
|
alegremotesdp = sdpgen.create( this.parent._req.msg.body )
|
|
931
931
|
}
|
|
932
932
|
|
|
933
|
-
this.
|
|
933
|
+
this.selectedcodec = this.sdp.remote.intersection(
|
|
934
934
|
alegremotesdp.intersection( this.options.preferedcodecs ), true )
|
|
935
935
|
|
|
936
|
-
if(
|
|
936
|
+
if( this.selectedcodec ) {
|
|
937
|
+
this.parent.selectedcodec = this.selectedcodec
|
|
938
|
+
} else {
|
|
937
939
|
/* Ok - transcode */
|
|
938
940
|
this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
|
|
939
|
-
this.parent.selectedcodec = this.options.preferedcodecs
|
|
940
941
|
if( "" == this.selectedcodec || "" == this.parent.selectedcodec ) {
|
|
941
942
|
return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
|
|
942
943
|
}
|
|
@@ -1875,17 +1876,15 @@ class call {
|
|
|
1875
1876
|
*/
|
|
1876
1877
|
static _createchannelremotedef( address, port, codec ) {
|
|
1877
1878
|
return {
|
|
1878
|
-
"
|
|
1879
|
-
|
|
1880
|
-
|
|
1881
|
-
|
|
1882
|
-
|
|
1883
|
-
|
|
1884
|
-
|
|
1885
|
-
setup: ""
|
|
1886
|
-
}
|
|
1887
|
-
*/
|
|
1879
|
+
"address": address,
|
|
1880
|
+
"port": port,
|
|
1881
|
+
"codec": codec
|
|
1882
|
+
/*
|
|
1883
|
+
dtls:{
|
|
1884
|
+
fingerprint: "",
|
|
1885
|
+
setup: ""
|
|
1888
1886
|
}
|
|
1887
|
+
*/
|
|
1889
1888
|
}
|
|
1890
1889
|
}
|
|
1891
1890
|
|
|
@@ -1978,12 +1977,10 @@ class call {
|
|
|
1978
1977
|
|
|
1979
1978
|
this._sethangupcause( src, reason )
|
|
1980
1979
|
|
|
1981
|
-
let audiochannel = this.channels.audio
|
|
1982
|
-
this.channels.audio = false
|
|
1983
1980
|
/* flag destroyed so when we receive our close event we know what to do */
|
|
1984
1981
|
this.destroyed = true
|
|
1985
|
-
if(
|
|
1986
|
-
|
|
1982
|
+
if( this.channels.audio ) {
|
|
1983
|
+
this.channels.audio.close()
|
|
1987
1984
|
this._timers.cleanup = setTimeout( () => {
|
|
1988
1985
|
console.error( "Timeout waiting for channel close, cleaning up anyway", this.uuid )
|
|
1989
1986
|
this._cleanup()
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@babblevoice/babble-drachtio-callmanager",
|
|
3
|
-
"version": "1.1.
|
|
3
|
+
"version": "1.1.3",
|
|
4
4
|
"description": "Call processing to create a PBX",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -20,7 +20,7 @@
|
|
|
20
20
|
],
|
|
21
21
|
"license": "MIT",
|
|
22
22
|
"dependencies": {
|
|
23
|
-
"@babblevoice/babble-drachtio-auth": "^1.0.
|
|
23
|
+
"@babblevoice/babble-drachtio-auth": "^1.0.1",
|
|
24
24
|
"chai": "^4.3.4",
|
|
25
25
|
"drachtio-srf": "^4.4.47",
|
|
26
26
|
"mocha": "^9.2.2",
|
package/test/interface/sdp.js
CHANGED
|
@@ -2,6 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
const expect = require( "chai" ).expect
|
|
4
4
|
const sdp = require( "../../lib/sdp.js" )
|
|
5
|
+
const call = require( "../../lib/call.js" )
|
|
5
6
|
|
|
6
7
|
describe( "sdp", function() {
|
|
7
8
|
|
|
@@ -293,4 +294,40 @@ a=ssrc:2706351154 label:83ac3abd-cc86-427a-9cb7-ebac0c73964a`.replace(/(\r\n|\n|
|
|
|
293
294
|
expect( oursdp.sdp.media[ 0 ].candidates[ 0 ].type ).to.equal( "host" )
|
|
294
295
|
expect( oursdp.sdp.media[ 0 ].candidates[ 0 ].generation ).to.equal( 0 )
|
|
295
296
|
} )
|
|
297
|
+
|
|
298
|
+
it( `sdp pcma real life sdp avon`, async function() {
|
|
299
|
+
const testsdp = `v=0
|
|
300
|
+
o=MTLSBC 1657399906 1657399907 IN IP4 213.166.4.136
|
|
301
|
+
s=SIP Call
|
|
302
|
+
c=IN IP4 213.166.4.136
|
|
303
|
+
t=0 0
|
|
304
|
+
a=sendrecv
|
|
305
|
+
m=audio 48380 RTP/AVP 8
|
|
306
|
+
a=rtpmap:8 PCMA/8000`
|
|
307
|
+
|
|
308
|
+
let oursdp = sdp.create( testsdp )
|
|
309
|
+
let selectedcodec = oursdp.intersection( "g722 ilbc pcmu pcma", true )
|
|
310
|
+
expect( selectedcodec ).to.equal( "pcma" )
|
|
311
|
+
|
|
312
|
+
} )
|
|
313
|
+
|
|
314
|
+
it( `sdp pcma real life sdp getautdio avon`, async function() {
|
|
315
|
+
const testsdp = `v=0
|
|
316
|
+
o=MTLSBC 1657399906 1657399907 IN IP4 213.166.4.136
|
|
317
|
+
s=SIP Call
|
|
318
|
+
c=IN IP4 213.166.4.136
|
|
319
|
+
t=0 0
|
|
320
|
+
a=sendrecv
|
|
321
|
+
m=audio 48380 RTP/AVP 8
|
|
322
|
+
a=rtpmap:8 PCMA/8000`
|
|
323
|
+
|
|
324
|
+
let oursdp = sdp.create( testsdp )
|
|
325
|
+
let remoteaudio = oursdp.getaudio()
|
|
326
|
+
|
|
327
|
+
let def = call._createchannelremotedef( remoteaudio.address, remoteaudio.port, remoteaudio.audio.payloads[ 0 ] )
|
|
328
|
+
|
|
329
|
+
expect( def.address ).to.equal( "213.166.4.136" )
|
|
330
|
+
expect( def.port ).to.equal( 48380 )
|
|
331
|
+
expect( def.codec ).to.equal( 8 )
|
|
332
|
+
} )
|
|
296
333
|
} )
|