@babblevoice/babble-drachtio-callmanager 2.2.6 → 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.
Files changed (2) hide show
  1. package/lib/call.js +23 -2
  2. package/package.json +1 -1
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
 
@@ -2741,6 +2761,7 @@ class call {
2741
2761
  @param { string } [ options.entity.realm ]
2742
2762
  @param { string } [ options.entity.uri ]
2743
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
2744
2765
  @param { object } [ options.callerid ]
2745
2766
  @param { string } [ options.callerid.number ]
2746
2767
  @param { string } [ options.callerid.name ]
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "2.2.6",
3
+ "version": "2.2.7",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {