@babblevoice/babble-drachtio-callmanager 2.2.6 → 2.3.0

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 +27 -3
  2. package/package.json +1 -1
package/lib/call.js CHANGED
@@ -130,6 +130,7 @@ class call {
130
130
  @property { boolean } authed
131
131
  @property { boolean } cleaned
132
132
  @property { boolean } refered
133
+ @property { boolean } picked
133
134
  */
134
135
 
135
136
  /** @member { callstate } */
@@ -143,7 +144,8 @@ class call {
143
144
  "held": false,
144
145
  "authed": false,
145
146
  "cleaned": false,
146
- "refered": false
147
+ "refered": false,
148
+ "picked": false
147
149
  }
148
150
 
149
151
  /**
@@ -419,6 +421,14 @@ class call {
419
421
  this._remote.name = calleridname
420
422
  }
421
423
 
424
+ get callerid() {
425
+ return this._remote.id
426
+ }
427
+
428
+ get calleridname() {
429
+ return this._remote.name
430
+ }
431
+
422
432
  /**
423
433
  *
424
434
  * @returns { object }
@@ -865,6 +875,7 @@ class call {
865
875
  It wuld be normal to bridge this call to another after this call has been made.
866
876
  */
867
877
  pick() {
878
+ this.state.picked = true
868
879
  this._em.emit( "call.pick", this )
869
880
  }
870
881
 
@@ -2495,9 +2506,11 @@ class call {
2495
2506
 
2496
2507
  const contactinfo = await callmanager.options.registrar.contacts( options.entity )
2497
2508
 
2498
- if( !contactinfo || 0 == contactinfo.contacts.length ) {
2509
+ if( 0 == contactinfo.contacts.length )
2499
2510
  return false
2500
- }
2511
+
2512
+ if( options.first )
2513
+ contactinfo.contacts = [ contactinfo.contacts[ 0 ] ]
2501
2514
 
2502
2515
  let numcontacts = 0
2503
2516
  const ourcallbacks = {}
@@ -2680,16 +2693,26 @@ class call {
2680
2693
  realm = remote.host
2681
2694
  user = remote.user
2682
2695
  }
2696
+
2697
+ if( this.parent.callerid ) {
2698
+ user = this.parent.callerid.number
2699
+ }
2700
+
2701
+ if( this.parent.calleridname ) {
2702
+ name = this.parent.calleridname
2703
+ }
2683
2704
  }
2684
2705
 
2685
2706
  /* oveide caller id */
2686
2707
  if( options.callerid ) {
2687
2708
  if( options.callerid.number ) {
2688
2709
  user = options.callerid.number
2710
+ this.callerid = user
2689
2711
  }
2690
2712
 
2691
2713
  if( options.callerid.name ) {
2692
2714
  name = options.callerid.name
2715
+ this.calleridname = name
2693
2716
  }
2694
2717
  }
2695
2718
 
@@ -2741,6 +2764,7 @@ class call {
2741
2764
  @param { string } [ options.entity.realm ]
2742
2765
  @param { string } [ options.entity.uri ]
2743
2766
  @param { number } [ options.entity.max ] - if included no more than this number of calls for this entity (only if we look user up)
2767
+ @param { number } [ options.entity.first ] - if multiple contacts for this entity use the first only
2744
2768
  @param { object } [ options.callerid ]
2745
2769
  @param { string } [ options.callerid.number ]
2746
2770
  @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.3.0",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {