@babblevoice/babble-drachtio-callmanager 2.2.5 → 2.2.7

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
@@ -419,6 +419,14 @@ class call {
419
419
  this._remote.name = calleridname
420
420
  }
421
421
 
422
+ get callerid() {
423
+ return this._remote.id
424
+ }
425
+
426
+ get calleridname() {
427
+ return this._remote.name
428
+ }
429
+
422
430
  /**
423
431
  *
424
432
  * @returns { object }
@@ -2495,9 +2503,11 @@ class call {
2495
2503
 
2496
2504
  const contactinfo = await callmanager.options.registrar.contacts( options.entity )
2497
2505
 
2498
- if( !contactinfo || 0 == contactinfo.contacts.length ) {
2506
+ if( 0 == contactinfo.contacts.length )
2499
2507
  return false
2500
- }
2508
+
2509
+ if( options.first )
2510
+ contactinfo.contacts = [ contactinfo.contacts[ 0 ] ]
2501
2511
 
2502
2512
  let numcontacts = 0
2503
2513
  const ourcallbacks = {}
@@ -2680,16 +2690,26 @@ class call {
2680
2690
  realm = remote.host
2681
2691
  user = remote.user
2682
2692
  }
2693
+
2694
+ if( this.parent.callerid ) {
2695
+ user = this.parent.callerid.number
2696
+ }
2697
+
2698
+ if( this.parent.calleridname ) {
2699
+ name = this.parent.calleridname
2700
+ }
2683
2701
  }
2684
2702
 
2685
2703
  /* oveide caller id */
2686
2704
  if( options.callerid ) {
2687
2705
  if( options.callerid.number ) {
2688
2706
  user = options.callerid.number
2707
+ this.callerid = user
2689
2708
  }
2690
2709
 
2691
2710
  if( options.callerid.name ) {
2692
2711
  name = options.callerid.name
2712
+ this.calleridname = name
2693
2713
  }
2694
2714
  }
2695
2715
 
@@ -2735,11 +2755,13 @@ class call {
2735
2755
  @param { object } [ options.uactimeout ] - override the deault timeout
2736
2756
  @param { boolean | number } [ options.autoanswer ] - if true add call-info to auto answer, if number delay to add
2737
2757
  @param { boolean } [ options.late ] - late negotiation
2758
+ @param { boolean } [ options.privacy ] - sets the privacy
2738
2759
  @param { entity } [ options.entity ] - used to store this call against and look up a contact string if not supplied.
2739
2760
  @param { string } [ options.entity.username ]
2740
2761
  @param { string } [ options.entity.realm ]
2741
2762
  @param { string } [ options.entity.uri ]
2742
2763
  @param { number } [ options.entity.max ] - if included no more than this number of calls for this entity (only if we look user up)
2764
+ @param { number } [ options.entity.first ] - if multiple contacts for this entity use the first only
2743
2765
  @param { object } [ options.callerid ]
2744
2766
  @param { string } [ options.callerid.number ]
2745
2767
  @param { string } [ options.callerid.name ]
@@ -2774,6 +2796,8 @@ class call {
2774
2796
  callstore.set( newcall )
2775
2797
  }
2776
2798
 
2799
+ if( options.privacy ) this.privacy = true
2800
+
2777
2801
  const u = newcall.#configcalleridfornewuac( options )
2778
2802
  newcall.#configautoanswerfornewuac( options, u )
2779
2803
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "2.2.5",
3
+ "version": "2.2.7",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {
package/test/unit/call.js CHANGED
@@ -27,6 +27,6 @@ describe( "call.js", function() {
27
27
  expect( newcallcalled ).to.be.true
28
28
 
29
29
  await call.hangup()
30
- } )
30
+ } )
31
31
 
32
32
  } )