@babblevoice/babble-drachtio-callmanager 1.6.8 → 1.6.10
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 +12 -35
- package/lib/sdp.js +4 -1
- package/package.json +1 -1
- package/test/interface/early.js +1 -1
- package/test/interface/sdp.js +37 -0
- package/test/interface/xfer.js +3 -0
package/lib/call.js
CHANGED
|
@@ -953,7 +953,7 @@ class call {
|
|
|
953
953
|
|
|
954
954
|
this.sdp.remote = sdpgen.create( this._dialog.remote.sdp )
|
|
955
955
|
this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
|
|
956
|
-
if(
|
|
956
|
+
if( !this.selectedcodec ) {
|
|
957
957
|
return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
|
|
958
958
|
}
|
|
959
959
|
|
|
@@ -1019,32 +1019,9 @@ class call {
|
|
|
1019
1019
|
|
|
1020
1020
|
this.sdp.remote = sdpgen.create( this._req.msg.body )
|
|
1021
1021
|
|
|
1022
|
-
|
|
1023
|
-
if( this.
|
|
1024
|
-
|
|
1025
|
-
alegremotesdp = this.parent.sdp.remote
|
|
1026
|
-
} else {
|
|
1027
|
-
alegremotesdp = sdpgen.create( this.parent._req.msg.body )
|
|
1028
|
-
}
|
|
1029
|
-
|
|
1030
|
-
this.selectedcodec = this.sdp.remote.intersection(
|
|
1031
|
-
alegremotesdp.intersection( this.options.preferedcodecs ), true )
|
|
1032
|
-
|
|
1033
|
-
if( this.selectedcodec ) {
|
|
1034
|
-
this.parent.selectedcodec = this.selectedcodec
|
|
1035
|
-
} else {
|
|
1036
|
-
/* Ok - transcode */
|
|
1037
|
-
this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
|
|
1038
|
-
if( "" == this.selectedcodec || "" == this.parent.selectedcodec ) {
|
|
1039
|
-
return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
|
|
1040
|
-
}
|
|
1041
|
-
}
|
|
1042
|
-
} else {
|
|
1043
|
-
/* no parent - just pick our prefered codec */
|
|
1044
|
-
this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
|
|
1045
|
-
if( "" == this.selectedcodec ) {
|
|
1046
|
-
return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
|
|
1047
|
-
}
|
|
1022
|
+
this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
|
|
1023
|
+
if( !this.selectedcodec ) {
|
|
1024
|
+
return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
|
|
1048
1025
|
}
|
|
1049
1026
|
|
|
1050
1027
|
let target = this.sdp.remote.getaudio()
|
|
@@ -1088,7 +1065,7 @@ class call {
|
|
|
1088
1065
|
|
|
1089
1066
|
if( this.parent ) {
|
|
1090
1067
|
if( !this.parent.established ) {
|
|
1091
|
-
await this.parent.answer(
|
|
1068
|
+
await this.parent.answer()
|
|
1092
1069
|
.catch( ( err ) => {
|
|
1093
1070
|
console.trace( err )
|
|
1094
1071
|
} )
|
|
@@ -1429,15 +1406,15 @@ class call {
|
|
|
1429
1406
|
|
|
1430
1407
|
if( this.canceled || this.established ) return
|
|
1431
1408
|
|
|
1432
|
-
options = { ...callmanager.options, ...this.options, ...options }
|
|
1409
|
+
this.options = { ...callmanager.options, ...this.options, ...options }
|
|
1433
1410
|
|
|
1434
1411
|
let channeldef
|
|
1435
1412
|
if( this._req.msg && this._req.msg.body ) {
|
|
1436
|
-
|
|
1437
|
-
this.selectedcodec
|
|
1438
|
-
|
|
1439
|
-
this.selectedcodec = this.sdp.remote.intersection( callmanager.options.preferedcodecs, true )
|
|
1413
|
+
this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
|
|
1414
|
+
if( !this.selectedcodec ) {
|
|
1415
|
+
return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
|
|
1440
1416
|
}
|
|
1417
|
+
|
|
1441
1418
|
let remoteaudio = this.sdp.remote.getaudio()
|
|
1442
1419
|
if( !remoteaudio ) return
|
|
1443
1420
|
|
|
@@ -1470,7 +1447,7 @@ class call {
|
|
|
1470
1447
|
.setconnectionaddress( ch.local.address )
|
|
1471
1448
|
.setaudioport( ch.local.port )
|
|
1472
1449
|
|
|
1473
|
-
if(
|
|
1450
|
+
if( this.options.rfc2833 ) {
|
|
1474
1451
|
this.sdp.local.addcodecs( "2833" )
|
|
1475
1452
|
}
|
|
1476
1453
|
|
|
@@ -1484,7 +1461,7 @@ class call {
|
|
|
1484
1461
|
if( this.canceled ) return
|
|
1485
1462
|
}
|
|
1486
1463
|
|
|
1487
|
-
if( options.early ) {
|
|
1464
|
+
if( this.options.early ) {
|
|
1488
1465
|
this.state.early = true
|
|
1489
1466
|
this._em.emit( "call.early", this )
|
|
1490
1467
|
callmanager.options.em.emit( "call.early", this )
|
package/lib/sdp.js
CHANGED
package/package.json
CHANGED
package/test/interface/early.js
CHANGED
|
@@ -448,8 +448,8 @@ a=sendrecv`.replace(/(\r\n|\n|\r)/gm, "\r\n")
|
|
|
448
448
|
expect( channelmessages[ 2 ].remote.address ).to.equal( "82.19.206.102" )
|
|
449
449
|
expect( channelmessages[ 3 ].channel ).to.equal( "mix" )
|
|
450
450
|
|
|
451
|
+
expect( channelmessages[ 6 ].channel ).to.equal( "close" )
|
|
451
452
|
expect( channelmessages[ 7 ].channel ).to.equal( "close" )
|
|
452
|
-
expect( channelmessages[ 8 ].channel ).to.equal( "close" )
|
|
453
453
|
|
|
454
454
|
expect( msginfo.body ).to.include( "UDP/TLS/RTP/SAVPF" )
|
|
455
455
|
|
package/test/interface/sdp.js
CHANGED
|
@@ -330,4 +330,41 @@ a=rtpmap:8 PCMA/8000`
|
|
|
330
330
|
expect( def.remote.port ).to.equal( 48380 )
|
|
331
331
|
expect( def.remote.codec ).to.equal( 8 )
|
|
332
332
|
} )
|
|
333
|
+
|
|
334
|
+
it( `another real life example`, async function() {
|
|
335
|
+
const testsdp = `v=0
|
|
336
|
+
o=MTLSBC 1664810796 1664810796 IN IP4 213.166.4.133
|
|
337
|
+
s=SIP Call
|
|
338
|
+
c=IN IP4 213.166.4.133
|
|
339
|
+
t=0 0
|
|
340
|
+
m=audio 52290 RTP/AVP 8 101 13 0 3 18
|
|
341
|
+
a=rtpmap:8 PCMA/8000
|
|
342
|
+
a=rtpmap:0 PCMU/8000
|
|
343
|
+
a=rtpmap:3 GSM/8000
|
|
344
|
+
a=rtpmap:18 G729/8000
|
|
345
|
+
a=fmtp:18 annexb=no
|
|
346
|
+
a=rtpmap:101 telephone-event/8000
|
|
347
|
+
a=fmtp:101 0-16
|
|
348
|
+
a=rtpmap:13 CN/8000
|
|
349
|
+
a=ptime:20`
|
|
350
|
+
|
|
351
|
+
let oursdp = sdp.create( testsdp )
|
|
352
|
+
|
|
353
|
+
let selectedcodec = oursdp.intersection( "g722", true )
|
|
354
|
+
console.log("selectedcodec",selectedcodec)
|
|
355
|
+
return
|
|
356
|
+
selectedcodec = oursdp.intersection( "g722", true )
|
|
357
|
+
let remoteaudio = oursdp.getaudio()
|
|
358
|
+
|
|
359
|
+
oursdp.select( selectedcodec )
|
|
360
|
+
|
|
361
|
+
let ourlocalsdp = sdp.create()
|
|
362
|
+
.addcodecs( selectedcodec )
|
|
363
|
+
.addcodecs( "2833" )
|
|
364
|
+
.setconnectionaddress( "1.1.1.1" )
|
|
365
|
+
.setaudioport( 1000 )
|
|
366
|
+
|
|
367
|
+
console.log(ourlocalsdp.toString())
|
|
368
|
+
|
|
369
|
+
} )
|
|
333
370
|
} )
|
package/test/interface/xfer.js
CHANGED