@babblevoice/babble-drachtio-callmanager 3.7.26 → 3.7.27

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 +10 -4
  2. package/package.json +1 -1
package/lib/call.js CHANGED
@@ -2948,7 +2948,7 @@ class call {
2948
2948
  const a_1 = b_1.other
2949
2949
  if( !a_1 ) return await this.#handle3leggedxfer( b_1, b_2, req, res)
2950
2950
 
2951
- const bothhaveaudio = [ a_1, c_1 ].every( ( call ) => Boolean( call?.channels?.audio ) )
2951
+ const bothestablished = [ a_1, c_1 ].every( ( call ) => call.state.established )
2952
2952
 
2953
2953
  const allcalls = [ a_1, b_1, b_2, c_1 ]
2954
2954
  const callswithaudio = allcalls.filter(
@@ -2994,14 +2994,20 @@ class call {
2994
2994
  a_1.adopt( c_1 )
2995
2995
 
2996
2996
  /* a_1 will receive the reinvite if on a different node - don't send reinvite */
2997
- if( bothhaveaudio ) {
2997
+ if( bothestablished ) {
2998
2998
  await c_1.mix( a_1, false )
2999
2999
  /* update the caller id on the call (and SDP if the channel changed) */
3000
3000
  /* TODO this reinvite should contain refered-by and replaces headers */
3001
3001
  await a_1.reinvite()
3002
3002
  } else {
3003
- if( !a_1?.channels?.audio && c_1?.channels?.audio ) c_1.channels.audio.play( c_1._ringsoup )
3004
- if( !c_1?.channels?.audio && a_1?.channels?.audio ) a_1.channels.audio.play( a_1._ringsoup )
3003
+ if( !a_1.state.established && c_1?.channels?.audio ) c_1.channels.audio.play( c_1.ringsoup )
3004
+ if( !c_1.state.established && a_1?.channels?.audio ) a_1.channels.audio.play( a_1.ringsoup )
3005
+
3006
+ /* let the receiver know about the changes */
3007
+ a_1.once( "call.answered", async () => {
3008
+ await c_1.mix( a_1, false )
3009
+ a_1.reinvite()
3010
+ } )
3005
3011
  }
3006
3012
 
3007
3013
  await b_2._notifyrefercomplete()
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@babblevoice/babble-drachtio-callmanager",
3
- "version": "3.7.26",
3
+ "version": "3.7.27",
4
4
  "description": "Call processing to create a PBX",
5
5
  "main": "index.js",
6
6
  "scripts": {