@babblevoice/babble-drachtio-callmanager 3.7.15 → 3.7.16

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 +50 -36
  2. package/package.json +1 -1
package/lib/call.js CHANGED
@@ -669,15 +669,14 @@ class call {
669
669
  #fromoutentity( startingpoint ) {
670
670
 
671
671
  const entity = this.options.entity
672
- if( entity ) {
673
- startingpoint.name = entity.display
674
- startingpoint.uri = entity.uri
675
- startingpoint.user = entity.username
676
- startingpoint.host = entity.realm
677
- return true
678
- }
672
+ if( !entity ) return false
679
673
 
680
- return false
674
+ startingpoint.name = entity.display
675
+ startingpoint.uri = entity.uri
676
+ startingpoint.user = entity.username
677
+ startingpoint.host = entity.realm
678
+ return true
679
+
681
680
  }
682
681
 
683
682
  /**
@@ -765,22 +764,23 @@ class call {
765
764
  "type": "callerid"
766
765
  }
767
766
 
768
- if( this.options.partycalling ) {
769
- this.#fromoutentity( startingpoint )
770
- this.#overridecalledid( startingpoint )
771
- return startingpoint
772
- } else if ( this.options.partycaller ) {
773
- console.error( "WARNING: partycaller retired - use partycalling instead" )
774
- this.#fromoutentity( startingpoint )
775
- this.#overridecalledid( startingpoint )
776
- return startingpoint
777
- }
778
-
779
- if( this.options.partycalled ) {
780
- this.#calleridforuac( startingpoint )
781
- } else if( "uas" === this.type ) {
782
- this.#calleridforuas( startingpoint )
767
+ if( "uas" === this.type ) {
768
+ if( this.options.partycalled ) {
769
+ this.#calleridforuac( startingpoint )
770
+ } else {
771
+ this.#calleridforuas( startingpoint )
772
+ }
783
773
  } else {
774
+ if( this.options.partycalling ) {
775
+ this.#fromoutentity( startingpoint )
776
+ this.#overridecallerid( startingpoint )
777
+ return startingpoint
778
+ } else if ( this.options.partycaller ) {
779
+ console.error( "WARNING: partycaller retired - use partycalling instead" )
780
+ this.#fromoutentity( startingpoint )
781
+ this.#overridecallerid( startingpoint )
782
+ return startingpoint
783
+ }
784
784
  const other = this.other
785
785
  if( other ) {
786
786
  this.#calleridother( startingpoint, other )
@@ -814,18 +814,23 @@ class call {
814
814
  "type": "calledid"
815
815
  }
816
816
 
817
- const other = this.other
818
-
819
- if( this.options.partycalling ) {
820
- if( other ) {
821
- other.#fromoutentity( startingpoint )
817
+ if( "uas" == this.type ) {
818
+ if( this.options.partycalled ) {
819
+ this.#fromrefertouri( startingpoint )
820
+ } else {
821
+ this.#calledidforuas( startingpoint )
822
822
  }
823
- } else if( this.options.partycalled ) {
824
- this.#fromrefertouri( startingpoint )
825
- } else if( "uas" == this.type ) {
826
- this.#calledidforuas( startingpoint )
827
823
  } else {
828
- this.#calledidforuac( startingpoint )
824
+ if( this.options.partycalling ) {
825
+ const other = this.other
826
+ if( other ) {
827
+ other.#fromdestination( startingpoint )
828
+ other.#fromoutentity( startingpoint )
829
+ }
830
+ this.#fromrefertouri( startingpoint )
831
+ } else {
832
+ this.#calledidforuac( startingpoint )
833
+ }
829
834
  }
830
835
 
831
836
  this.#overridecalledid( startingpoint )
@@ -3780,11 +3785,20 @@ class call {
3780
3785
  */
3781
3786
  #configcalleridfornewuac() {
3782
3787
 
3783
- const callerid = this.callerid
3784
- const calleridrem = this.callerid
3788
+ let callerid, calleridrem
3789
+
3790
+ const direction = this.direction
3791
+
3792
+ if( "inbound" === direction ) {
3793
+ callerid = this.calledid
3794
+ calleridrem = this.calledid
3795
+ } else {
3796
+ callerid = this.callerid
3797
+ calleridrem = this.callerid
3798
+ }
3785
3799
 
3786
3800
  let party = ";party=calling"
3787
- if( this.options.partycalled ) {
3801
+ if( "outbound" === direction ) {
3788
3802
  party = ";party=called"
3789
3803
  this.#fromrefertouri( calleridrem )
3790
3804
  }
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "3.7.15",
3
+ "version": "3.7.16",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {