@babblevoice/babble-drachtio-callmanager 3.3.5 → 3.4.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 +17 -16
  2. package/package.json +1 -1
package/lib/call.js CHANGED
@@ -1120,9 +1120,10 @@ class call {
1120
1120
  Delink calls logically - any calls which have parent or children they are all removed.
1121
1121
  when the dialog is either answered (or doesn't answer for some reason).
1122
1122
  The promise resolves to a new call is one is generated, or undefined if not.
1123
+ @param { boolean } [ unmix ] if true also unmix this call
1123
1124
  @return { call }
1124
1125
  */
1125
- detach() {
1126
+ detach( unmix ) {
1126
1127
  if( this.parent ) {
1127
1128
  this.parent.children.delete( this )
1128
1129
  }
@@ -1133,6 +1134,9 @@ class call {
1133
1134
 
1134
1135
  this.parent = undefined
1135
1136
  this.children.clear()
1137
+
1138
+ if( unmix && this.channels.audio ) this.channels.audio.unmix()
1139
+
1136
1140
  return this
1137
1141
  }
1138
1142
 
@@ -1150,17 +1154,7 @@ class call {
1150
1154
  /* maintain privacy */
1151
1155
  other.options.privacy = this.options.privacy
1152
1156
 
1153
- if( mix ) {
1154
- this.channels.audio.mix( other.channels.audio )
1155
-
1156
- this._em.emit( "call.mix", this )
1157
- callmanager.options.em.emit( "call.mix", this )
1158
- other._em.emit( "call.mix", other )
1159
- callmanager.options.em.emit( "call.mix", other )
1160
-
1161
- this.epochs.mix = Math.floor( +new Date() / 1000 )
1162
- other.epochs.mix = Math.floor( +new Date() / 1000 )
1163
- }
1157
+ if( mix ) this.mix( other )
1164
1158
  return this
1165
1159
  }
1166
1160
 
@@ -2045,7 +2039,7 @@ class call {
2045
2039
 
2046
2040
  /**
2047
2041
  Mix two calls. If the two calls are on a different node
2048
- the second call is bonded and reinvited.
2042
+ the other call is bonded and reinvited.
2049
2043
  @param { call } othercall - our call object which is early
2050
2044
  @private
2051
2045
  */
@@ -2057,8 +2051,7 @@ class call {
2057
2051
  const channeldef = await othercall.#createchannelremotedef()
2058
2052
 
2059
2053
  const oldchannel = othercall.channels.audio
2060
- const newchannel = await this.#openchannel( channeldef, othercall )
2061
-
2054
+ const newchannel = await this.#openchannel( channeldef, this )
2062
2055
  await othercall.bond( this ).reinvite( channeldef, newchannel )
2063
2056
 
2064
2057
  await oldchannel.unmix()
@@ -2066,6 +2059,14 @@ class call {
2066
2059
  }
2067
2060
 
2068
2061
  await this.channels.audio.mix( othercall.channels.audio )
2062
+
2063
+ this._em.emit( "call.mix", this )
2064
+ callmanager.options.em.emit( "call.mix", this )
2065
+ othercall._em.emit( "call.mix", othercall )
2066
+ callmanager.options.em.emit( "call.mix", othercall )
2067
+
2068
+ this.epochs.mix = Math.floor( +new Date() / 1000 )
2069
+ othercall.epochs.mix = Math.floor( +new Date() / 1000 )
2069
2070
  }
2070
2071
 
2071
2072
  /**
@@ -2083,7 +2084,7 @@ class call {
2083
2084
  this.channels.count++
2084
2085
  return chan
2085
2086
  }
2086
-
2087
+
2087
2088
  const chan = await projectrtp.openchannel(
2088
2089
  channeldef, this._handlechannelevents.bind( this ) )
2089
2090
  this.channels.count++
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "3.3.5",
3
+ "version": "3.4.0",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {