@babblevoice/babble-drachtio-callmanager 3.7.15 → 3.7.17

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 +60 -38
  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
  /**
@@ -751,6 +750,20 @@ class call {
751
750
  }
752
751
  }
753
752
 
753
+ /**
754
+ *
755
+ * @param { object } startingpoint
756
+ * @param { object } other
757
+ */
758
+ #calledidother( startingpoint, other ) {
759
+ if( "uas" === other.type ) {
760
+ other.#calledidforuas( startingpoint )
761
+ other.#overridecalledid( startingpoint )
762
+ } else {
763
+ other.#calleridforuac( startingpoint )
764
+ }
765
+ }
766
+
754
767
  /**
755
768
  *
756
769
  * @returns { object }
@@ -765,22 +778,23 @@ class call {
765
778
  "type": "callerid"
766
779
  }
767
780
 
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 )
781
+ if( "uas" === this.type ) {
782
+ if( this.options.partycalled ) {
783
+ this.#calleridforuac( startingpoint )
784
+ } else {
785
+ this.#calleridforuas( startingpoint )
786
+ }
783
787
  } else {
788
+ if( this.options.partycalling ) {
789
+ this.#fromoutentity( startingpoint )
790
+ this.#overridecallerid( startingpoint )
791
+ return startingpoint
792
+ } else if ( this.options.partycaller ) {
793
+ console.error( "WARNING: partycaller retired - use partycalling instead" )
794
+ this.#fromoutentity( startingpoint )
795
+ this.#overridecallerid( startingpoint )
796
+ return startingpoint
797
+ }
784
798
  const other = this.other
785
799
  if( other ) {
786
800
  this.#calleridother( startingpoint, other )
@@ -814,18 +828,23 @@ class call {
814
828
  "type": "calledid"
815
829
  }
816
830
 
817
- const other = this.other
818
-
819
- if( this.options.partycalling ) {
820
- if( other ) {
821
- other.#fromoutentity( startingpoint )
831
+ if( "uas" == this.type ) {
832
+ if( this.options.partycalled ) {
833
+ this.#fromrefertouri( startingpoint )
834
+ } else {
835
+ this.#calledidforuas( startingpoint )
822
836
  }
823
- } else if( this.options.partycalled ) {
824
- this.#fromrefertouri( startingpoint )
825
- } else if( "uas" == this.type ) {
826
- this.#calledidforuas( startingpoint )
827
837
  } else {
828
- this.#calledidforuac( startingpoint )
838
+ if( this.options.partycalling ) {
839
+ const other = this.other
840
+ if( other ) {
841
+ this.#calledidother( startingpoint, other )
842
+ } else {
843
+ this.#fromrefertouri( startingpoint )
844
+ }
845
+ } else {
846
+ this.#calledidforuac( startingpoint )
847
+ }
829
848
  }
830
849
 
831
850
  this.#overridecalledid( startingpoint )
@@ -3780,13 +3799,16 @@ class call {
3780
3799
  */
3781
3800
  #configcalleridfornewuac() {
3782
3801
 
3783
- const callerid = this.callerid
3784
- const calleridrem = this.callerid
3785
-
3802
+ let callerid, calleridrem
3786
3803
  let party = ";party=calling"
3787
- if( this.options.partycalled ) {
3804
+
3805
+ if( "inbound" === this.direction ) {
3806
+ callerid = this.calledid
3807
+ calleridrem = this.calledid
3808
+ } else {
3809
+ callerid = this.callerid
3810
+ calleridrem = this.callerid
3788
3811
  party = ";party=called"
3789
- this.#fromrefertouri( calleridrem )
3790
3812
  }
3791
3813
 
3792
3814
  const calleridstr = `"${callerid.name?callerid.name:callerid.user}" <sip:${callerid.user}@${callerid.host}>`
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.17",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {