@babblevoice/babble-drachtio-callmanager 3.7.14 → 3.7.15
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 +66 -35
- package/package.json +1 -1
package/lib/call.js
CHANGED
|
@@ -558,12 +558,20 @@ class call {
|
|
|
558
558
|
* We make an outbound call. i.e. we send an INVITE
|
|
559
559
|
*
|
|
560
560
|
* Exceptions
|
|
561
|
-
* partycalled
|
|
562
|
-
* so the invite is
|
|
561
|
+
* partycalled - we send an INVITE but that is an inbound call
|
|
562
|
+
* so the invite is in the opposite direction.
|
|
563
563
|
* @returns { "inbound" | "outbound" }
|
|
564
564
|
*/
|
|
565
565
|
get direction() {
|
|
566
|
-
if( this.options.partycalled ) return "
|
|
566
|
+
if( this.options.partycalled ) return "outbound"
|
|
567
|
+
|
|
568
|
+
if( this.options.partycaller ) {
|
|
569
|
+
console.error( "WARNING: partycaller retired - use partycalling instead" )
|
|
570
|
+
return "inbound"
|
|
571
|
+
}
|
|
572
|
+
|
|
573
|
+
if( this.options.partycalling ) return "inbound"
|
|
574
|
+
|
|
567
575
|
return "uas"===this.type?"inbound":"outbound"
|
|
568
576
|
}
|
|
569
577
|
|
|
@@ -721,13 +729,28 @@ class call {
|
|
|
721
729
|
|
|
722
730
|
/**
|
|
723
731
|
* We have received an INVITE - so caller ID comes from headers / auth
|
|
724
|
-
*
|
|
732
|
+
* @param { object } startingpoint
|
|
725
733
|
*/
|
|
726
734
|
#calleridforuas( startingpoint ) {
|
|
727
735
|
this.#frominentity( startingpoint )
|
|
728
736
|
this.#fromremoteheaders( startingpoint )
|
|
729
737
|
}
|
|
730
738
|
|
|
739
|
+
/**
|
|
740
|
+
* Get the caller id when we have another leg.
|
|
741
|
+
* @param { object } startingpoint
|
|
742
|
+
* @param { object } other
|
|
743
|
+
*/
|
|
744
|
+
#calleridother( startingpoint, other ) {
|
|
745
|
+
if( "uas" === other.type ) {
|
|
746
|
+
other.#calleridforuas( startingpoint )
|
|
747
|
+
other.#overridecallerid( startingpoint )
|
|
748
|
+
} else {
|
|
749
|
+
other.#calledidforuac( startingpoint )
|
|
750
|
+
if( this.type !== other.type ) other.#fromrefertouri( startingpoint )
|
|
751
|
+
}
|
|
752
|
+
}
|
|
753
|
+
|
|
731
754
|
/**
|
|
732
755
|
*
|
|
733
756
|
* @returns { object }
|
|
@@ -742,29 +765,27 @@ class call {
|
|
|
742
765
|
"type": "callerid"
|
|
743
766
|
}
|
|
744
767
|
|
|
745
|
-
if(
|
|
746
|
-
|
|
747
|
-
|
|
748
|
-
|
|
749
|
-
|
|
750
|
-
|
|
751
|
-
|
|
752
|
-
|
|
753
|
-
|
|
754
|
-
|
|
755
|
-
} else {
|
|
756
|
-
other.#calledidforuac( startingpoint )
|
|
757
|
-
if( this.type !== other.type ) other.#fromrefertouri( startingpoint )
|
|
758
|
-
}
|
|
759
|
-
} else {
|
|
760
|
-
|
|
761
|
-
if ( this.options.partycaller ) {
|
|
762
|
-
this.#overridecalledid( startingpoint )
|
|
763
|
-
return startingpoint
|
|
764
|
-
}
|
|
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
|
+
}
|
|
765
778
|
|
|
766
|
-
|
|
767
|
-
|
|
779
|
+
if( this.options.partycalled ) {
|
|
780
|
+
this.#calleridforuac( startingpoint )
|
|
781
|
+
} else if( "uas" === this.type ) {
|
|
782
|
+
this.#calleridforuas( startingpoint )
|
|
783
|
+
} else {
|
|
784
|
+
const other = this.other
|
|
785
|
+
if( other ) {
|
|
786
|
+
this.#calleridother( startingpoint, other )
|
|
787
|
+
} else {
|
|
788
|
+
this.#calleridforuac( startingpoint )
|
|
768
789
|
}
|
|
769
790
|
}
|
|
770
791
|
|
|
@@ -793,9 +814,19 @@ class call {
|
|
|
793
814
|
"type": "calledid"
|
|
794
815
|
}
|
|
795
816
|
|
|
796
|
-
|
|
797
|
-
|
|
798
|
-
|
|
817
|
+
const other = this.other
|
|
818
|
+
|
|
819
|
+
if( this.options.partycalling ) {
|
|
820
|
+
if( other ) {
|
|
821
|
+
other.#fromoutentity( startingpoint )
|
|
822
|
+
}
|
|
823
|
+
} else if( this.options.partycalled ) {
|
|
824
|
+
this.#fromrefertouri( startingpoint )
|
|
825
|
+
} else if( "uas" == this.type ) {
|
|
826
|
+
this.#calledidforuas( startingpoint )
|
|
827
|
+
} else {
|
|
828
|
+
this.#calledidforuac( startingpoint )
|
|
829
|
+
}
|
|
799
830
|
|
|
800
831
|
this.#overridecalledid( startingpoint )
|
|
801
832
|
|
|
@@ -3545,9 +3576,8 @@ class call {
|
|
|
3545
3576
|
for( const contact of contactinfo.contacts ) {
|
|
3546
3577
|
if( undefined === contact ) continue
|
|
3547
3578
|
const newoptions = { ...options }
|
|
3548
|
-
|
|
3549
3579
|
if ( newoptions.clicktocall )
|
|
3550
|
-
newoptions.
|
|
3580
|
+
newoptions.partycalling = true
|
|
3551
3581
|
|
|
3552
3582
|
if( contact.contact && "string" == typeof contact.contact ) {
|
|
3553
3583
|
numcontacts++
|
|
@@ -3806,7 +3836,7 @@ class call {
|
|
|
3806
3836
|
const parts = parseuri( contactstr )
|
|
3807
3837
|
|
|
3808
3838
|
if( this.options.clicktocall ) {
|
|
3809
|
-
this.options.
|
|
3839
|
+
this.options.partycalling = true
|
|
3810
3840
|
this.options.autoanswer = true
|
|
3811
3841
|
}
|
|
3812
3842
|
|
|
@@ -3875,9 +3905,10 @@ class call {
|
|
|
3875
3905
|
* @property { number } [ uactimeout ] - override the deault timeout
|
|
3876
3906
|
* @property { string } [ uactimeoutreason ] - send a reason for timeout as Reason header
|
|
3877
3907
|
* @property { true | number } [ autoanswer ] - if true add call-info to auto answer, if number delay to add
|
|
3878
|
-
* @property { boolean } [ clicktocall ] - if set to true, will set autoanswer to true and
|
|
3879
|
-
* @property { boolean } [ partycalled ] -
|
|
3880
|
-
* @property { boolean } [ partycaller ] -
|
|
3908
|
+
* @property { boolean } [ clicktocall ] - if set to true, will set autoanswer to true and set to partycalling
|
|
3909
|
+
* @property { boolean } [ partycalled ] - we are the one recevieving the call
|
|
3910
|
+
* @property { boolean } [ partycaller ] - retired - wrong term use partycalling
|
|
3911
|
+
* @property { boolean } [ partycalling ] - we are the party making the call
|
|
3881
3912
|
* @property { boolean } [ late ] - late negotiation
|
|
3882
3913
|
* @property { boolean } [ privacy ] - sets the privacy
|
|
3883
3914
|
* @property { entity } [ entity ] - used to store this call against and look up a contact string if not supplied.
|