@babblevoice/babble-drachtio-callmanager 2.3.22 → 2.3.23

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 CHANGED
@@ -334,6 +334,8 @@ class call {
334
334
  * @property { boolean } [ rfc2833 ] if set to true enable 2833
335
335
  * @property { string } [ display ] how the user should be displayed
336
336
  * @property { Array } [ headers ]
337
+ * @property { string } [ contactparams]
338
+ * @property { number | true } [ autoanswer ] autoanswer true or delay
337
339
  * @property { number } [ uactimeout ] timeout in mS
338
340
  * @property { boolean } [ late ] - do we use late negotiation
339
341
  * @property { boolean } [ noAck ] do not use - converts our options into Drachtio options
@@ -2829,19 +2831,19 @@ class call {
2829
2831
 
2830
2832
  /**
2831
2833
  *
2832
- * @param { object } options
2833
- * @param { object } u
2834
+ * @param { object } u
2835
+ * @param { string } u.user
2836
+ * @param { string } u.realm
2834
2837
  */
2835
- #configautoanswerfornewuac( options, u ) {
2836
-
2837
- if( !options.contactparams ) options.contactparams = ""
2838
+ #configautoanswerfornewuac( u ) {
2838
2839
 
2839
- if( true === options.autoanswer ) {
2840
+ if( !this.options.contactparams ) this.options.contactparams = ""
2841
+ if( true === this.options.autoanswer ) {
2840
2842
  this.options.headers[ "Call-Info" ] = `<sip:${u.user}@${u.realm}>;answer-after=0`
2841
- options.contactparams += ";intercom=true"
2842
- } else if ( "number" == typeof options.autoanswer ) {
2843
- this.options.headers[ "Call-Info" ] = `<sip:${u.user}@${u.realm}>;answer-after=${options.autoanswer}`
2844
- options.contactparams += ";intercom=true"
2843
+ this.options.contactparams += ";intercom=true"
2844
+ } else if ( "number" == typeof this.options.autoanswer ) {
2845
+ this.options.headers[ "Call-Info" ] = `<sip:${u.user}@${u.realm}>;answer-after=${this.options.autoanswer}`
2846
+ this.options.contactparams += ";intercom=true"
2845
2847
  }
2846
2848
  }
2847
2849
 
@@ -2855,6 +2857,7 @@ class call {
2855
2857
  this.propagate.headers[ header ] = options.headers[ header ]
2856
2858
  }
2857
2859
  }
2860
+ if ( options.autoanswer ) this.propagate.autoanswer = options.autoanswer
2858
2861
  }
2859
2862
 
2860
2863
  /**
@@ -2867,6 +2870,9 @@ class call {
2867
2870
  this.options.headers[ header ] = this.parent.propagate.headers[ header ]
2868
2871
  }
2869
2872
  }
2873
+ if( "autoanswer" in this.parent.propagate ) {
2874
+ this.options.autoanswer = this.parent.propagate.autoanswer
2875
+ }
2870
2876
  }
2871
2877
  }
2872
2878
 
@@ -2891,7 +2897,7 @@ class call {
2891
2897
  @param { string } [ options.auth.password ] - If SIP auth required password
2892
2898
  @param { object } [ options.headers ] - Object containing extra sip headers required.
2893
2899
  @param { object } [ options.uactimeout ] - override the deault timeout
2894
- @param { boolean | number } [ options.autoanswer ] - if true add call-info to auto answer, if number delay to add
2900
+ @param { true | number } [ options.autoanswer ] - if true add call-info to auto answer, if number delay to add
2895
2901
  @param { boolean } [ options.late ] - late negotiation
2896
2902
  @param { boolean } [ options.privacy ] - sets the privacy
2897
2903
  @param { entity } [ options.entity ] - used to store this call against and look up a contact string if not supplied.
@@ -2941,7 +2947,6 @@ class call {
2941
2947
  if( options.privacy ) this.privacy = true
2942
2948
 
2943
2949
  const u = newcall.#configcalleridfornewuac( options )
2944
- newcall.#configautoanswerfornewuac( options, u )
2945
2950
 
2946
2951
 
2947
2952
  // Polycom
@@ -2956,12 +2961,13 @@ class call {
2956
2961
  newcall.options.headers = tmpheaders
2957
2962
  newcall.import()
2958
2963
 
2964
+ newcall.#configautoanswerfornewuac( u )
2959
2965
  newcall.#confignetwork( options )
2960
2966
  await newcall.#openchannelsfornewuac()
2961
2967
 
2962
2968
  let newdialog
2963
2969
  try {
2964
- newdialog = await callmanager.options.srf.createUAC( options.contact + options.contactparams, newcall.options, {
2970
+ newdialog = await callmanager.options.srf.createUAC( options.contact + newcall.options.contactparams, newcall.options, {
2965
2971
  cbRequest: ( err, req ) => {
2966
2972
 
2967
2973
  if( !req ) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "2.3.22",
3
+ "version": "2.3.23",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {
@@ -858,7 +858,6 @@ describe( "call object", function() {
858
858
  "late": true
859
859
  }
860
860
 
861
- const earlycallbackcalled = false
862
861
  const c = await call.newuac( options )
863
862
 
864
863
  /* mock */
@@ -1015,7 +1014,7 @@ describe( "call object", function() {
1015
1014
  const c = await call.newuac( options )
1016
1015
 
1017
1016
  let eventfired = false
1018
- c.on( "call.pick", ( callobject ) => {
1017
+ c.on( "call.pick", ( /*callobject*/ ) => {
1019
1018
  eventfired = true
1020
1019
  } )
1021
1020