@babblevoice/babble-drachtio-callmanager 1.6.9 → 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 CHANGED
@@ -1019,36 +1019,9 @@ class call {
1019
1019
 
1020
1020
  this.sdp.remote = sdpgen.create( this._req.msg.body )
1021
1021
 
1022
- let alegremotesdp
1023
- if( this.parent ) {
1024
- if( this.parent.established ) {
1025
- alegremotesdp = this.parent.sdp.remote
1026
- } else {
1027
- alegremotesdp = sdpgen.create( this.parent._req.msg.body )
1028
- }
1029
- let alegpossiblecodecs = alegremotesdp.intersection( this.options.preferedcodecs )
1030
- if( !alegpossiblecodecs ) alegpossiblecodecs = alegremotesdp.intersection( callmanager.options.preferedcodecs )
1031
- if( !alegpossiblecodecs ) {
1032
- return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
1033
- }
1034
-
1035
- this.selectedcodec = this.sdp.remote.intersection( alegpossiblecodecs, true )
1036
- /* if this doesn't work - then we will have to transcode if we can find a codec which works */
1037
- if( this.selectedcodec ) {
1038
- this.parent.selectedcodec = this.selectedcodec
1039
- } else {
1040
- this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
1041
- if( !this.selectedcodec ) this.selectedcodec = this.sdp.remote.intersection( callmanager.options.preferedcodecs )
1042
- if( !this.selectedcodec ) {
1043
- return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
1044
- }
1045
- }
1046
- } else {
1047
- /* no parent - just pick our prefered codec */
1048
- this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
1049
- if( !this.selectedcodec ) {
1050
- return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
1051
- }
1022
+ this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
1023
+ if( !this.selectedcodec ) {
1024
+ return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
1052
1025
  }
1053
1026
 
1054
1027
  let target = this.sdp.remote.getaudio()
@@ -1433,13 +1406,11 @@ class call {
1433
1406
 
1434
1407
  if( this.canceled || this.established ) return
1435
1408
 
1436
- options = { ...callmanager.options, ...this.options, ...options }
1409
+ this.options = { ...callmanager.options, ...this.options, ...options }
1437
1410
 
1438
1411
  let channeldef
1439
1412
  if( this._req.msg && this._req.msg.body ) {
1440
- /* options.preferedcodecs may have been narrowed down so we still check callmanager as well */
1441
- this.selectedcodec = this.sdp.remote.intersection( options.preferedcodecs, true )
1442
- if( !this.selectedcodec ) this.selectedcodec = this.sdp.remote.intersection( callmanager.options.preferedcodecs, true )
1413
+ this.selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
1443
1414
  if( !this.selectedcodec ) {
1444
1415
  return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
1445
1416
  }
@@ -1476,7 +1447,7 @@ class call {
1476
1447
  .setconnectionaddress( ch.local.address )
1477
1448
  .setaudioport( ch.local.port )
1478
1449
 
1479
- if( callmanager.options.rfc2833 ) {
1450
+ if( this.options.rfc2833 ) {
1480
1451
  this.sdp.local.addcodecs( "2833" )
1481
1452
  }
1482
1453
 
@@ -1490,7 +1461,7 @@ class call {
1490
1461
  if( this.canceled ) return
1491
1462
  }
1492
1463
 
1493
- if( options.early ) {
1464
+ if( this.options.early ) {
1494
1465
  this.state.early = true
1495
1466
  this._em.emit( "call.early", this )
1496
1467
  callmanager.options.em.emit( "call.early", this )
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "1.6.9",
3
+ "version": "1.6.10",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -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
 
@@ -292,6 +292,9 @@ describe( "xfer", function() {
292
292
  srfscenario.inbound()
293
293
  } )
294
294
 
295
+ /* needed for _dialog.on... */
296
+ await b_2.answer()
297
+
295
298
  let c_1 = await b_2.newuac( { "contact": "1001@dummy" } )
296
299
 
297
300
  /* now we refer b_2 to b_1 */