@babblevoice/babble-drachtio-callmanager 1.3.0 → 1.3.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 CHANGED
@@ -317,13 +317,15 @@ class call {
317
317
  }
318
318
 
319
319
  let entitycalls = await callstore.getbyentity( this._entity.uri )
320
+ let entitycallcount = 0
321
+ if( false !== entitycalls ) entitycallcount = entitycalls.size
320
322
 
321
323
  return {
322
324
  "username": this._entity.username,
323
325
  "realm": this._entity.realm,
324
326
  "uri": this._entity.uri,
325
327
  "display": this._entity.display?this._entity.display:"",
326
- "ccc": entitycalls.size
328
+ "ccc": entitycallcount
327
329
  }
328
330
  } )()
329
331
  }
@@ -420,8 +422,8 @@ class call {
420
422
  parsed = this._req.getParsedHeader( "from" )
421
423
  }
422
424
 
423
- let parseduri = parseuri( parsed.uri )
424
425
  if( !parsed ) parsed = {}
426
+ let parseduri = parseuri( parsed.uri )
425
427
  if( !parsed.params ) parsed.params = {}
426
428
 
427
429
  return {
@@ -1957,13 +1959,13 @@ class call {
1957
1959
  /* Call outstanding resolves for promises - this will trigger out hangup promise also */
1958
1960
  resolves.forEach( r => r( this ) )
1959
1961
 
1960
- this.removealllisteners()
1961
-
1962
1962
  this._em.emit( "call.destroyed", this )
1963
1963
  callmanager.options.em.emit( "call.destroyed", this )
1964
1964
 
1965
1965
  this._em.emit( "call.reporting", this )
1966
1966
  callmanager.options.em.emit( "call.reporting", this )
1967
+
1968
+ this.removealllisteners()
1967
1969
  }
1968
1970
 
1969
1971
  /**
@@ -2465,7 +2467,7 @@ class call {
2465
2467
  @private
2466
2468
  */
2467
2469
  c._req = req
2468
- c._req.on( "cancel", () => this._oncanceled() )
2470
+ c._req.on( "cancel", () => c._oncanceled.bind( c ) )
2469
2471
  /**
2470
2472
  @member
2471
2473
  @private
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "1.3.0",
3
+ "version": "1.3.3",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -554,9 +554,9 @@ describe( "call object", function() {
554
554
  eventhappened = true
555
555
  } )
556
556
 
557
- await c.hangup()
558
-
559
557
  expect( eventhappened ).to.be.false
558
+ await c.hangup()
559
+ expect( eventhappened ).to.be.true
560
560
  } )
561
561
 
562
562
  it( `uas.newuac - answered and destroyed event`, async function() {