@babblevoice/babble-drachtio-callmanager 3.10.0 → 3.10.1
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 +22 -8
- package/package.json +1 -1
package/lib/call.js
CHANGED
|
@@ -1354,12 +1354,19 @@ class call {
|
|
|
1354
1354
|
/* When we adopt-and-mix (enterprise queues and ring groups connect this
|
|
1355
1355
|
way rather than via #answerparent) we are the parent leg. preconnect
|
|
1356
1356
|
runs before the mix (projectrtp cannot play into a mixing channel),
|
|
1357
|
-
then we mix, then postconnect.
|
|
1357
|
+
then we mix, then postconnect. Only take the deferred (hook) path when a
|
|
1358
|
+
hook is actually registered - otherwise mix synchronously in this tick,
|
|
1359
|
+
exactly as before, so callers that assume the mix has been issued on
|
|
1360
|
+
return (recording, queue setup) don't race a microtask. */
|
|
1358
1361
|
if( mix ) {
|
|
1359
|
-
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1362
|
+
if( this.callbacks && ( this.callbacks.preconnect || this.callbacks.postconnect ) ) {
|
|
1363
|
+
this.#notifyconnecthook( this, other, "preconnect" )
|
|
1364
|
+
.then( () => this.mix( other ) )
|
|
1365
|
+
.then( () => this.#notifyconnecthook( this, other, "postconnect" ) )
|
|
1366
|
+
.catch( ( e ) => console.trace( e ) )
|
|
1367
|
+
} else {
|
|
1368
|
+
this.mix( other )
|
|
1369
|
+
}
|
|
1363
1370
|
}
|
|
1364
1371
|
return this
|
|
1365
1372
|
}
|
|
@@ -1534,8 +1541,13 @@ class call {
|
|
|
1534
1541
|
/* preconnect: our parent leg's handler runs BEFORE the mix. projectrtp
|
|
1535
1542
|
cannot play audio into a channel that is being mixed, so a prompt that
|
|
1536
1543
|
must be heard on connect is played to each leg separately here (both
|
|
1537
|
-
channels are open by this point), then we mix.
|
|
1538
|
-
|
|
1544
|
+
channels are open by this point), then we mix. Only yield when a hook is
|
|
1545
|
+
actually registered - a normal bridge must mix synchronously in this tick
|
|
1546
|
+
exactly as before, or recording/queue setup that assumes the mix has been
|
|
1547
|
+
issued can race. */
|
|
1548
|
+
if( this.parent.callbacks.preconnect ) {
|
|
1549
|
+
await this.#notifyconnecthook( this.parent, this, "preconnect" )
|
|
1550
|
+
}
|
|
1539
1551
|
|
|
1540
1552
|
this.channels.audio.mix( this.parent.channels.audio )
|
|
1541
1553
|
|
|
@@ -1558,7 +1570,9 @@ class call {
|
|
|
1558
1570
|
}
|
|
1559
1571
|
}
|
|
1560
1572
|
|
|
1561
|
-
|
|
1573
|
+
if( this.parent.callbacks.postconnect ) {
|
|
1574
|
+
await this.#notifyconnecthook( this.parent, this, "postconnect" )
|
|
1575
|
+
}
|
|
1562
1576
|
|
|
1563
1577
|
return this
|
|
1564
1578
|
}
|