@babblevoice/babble-drachtio-callmanager 3.7.7 → 3.7.8
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 +49 -27
- package/package.json +1 -1
package/lib/call.js
CHANGED
|
@@ -1328,38 +1328,60 @@ class call {
|
|
|
1328
1328
|
}
|
|
1329
1329
|
}
|
|
1330
1330
|
|
|
1331
|
+
/**
|
|
1332
|
+
*
|
|
1333
|
+
* @returns { boolean } - true if an error has occured
|
|
1334
|
+
*/
|
|
1335
|
+
#answerparenterrors() {
|
|
1336
|
+
if( !this.parent.established ) {
|
|
1337
|
+
this.hangup( hangupcodes.USER_GONE )
|
|
1338
|
+
return true
|
|
1339
|
+
}
|
|
1340
|
+
|
|
1341
|
+
/* are we still established? */
|
|
1342
|
+
if( !this.established || this.state.destroyed || this.parent.destroyed ) return true
|
|
1343
|
+
if( !this.channels.audio ) {
|
|
1344
|
+
/* something bad has happened */
|
|
1345
|
+
this.hangup( hangupcodes.NOT_ACCEPTABLE )
|
|
1346
|
+
return true
|
|
1347
|
+
}
|
|
1348
|
+
|
|
1349
|
+
if( !this.parent.channels.audio ) {
|
|
1350
|
+
this.hangup( hangupcodes.USER_GONE )
|
|
1351
|
+
return true
|
|
1352
|
+
}
|
|
1353
|
+
|
|
1354
|
+
return false
|
|
1355
|
+
}
|
|
1356
|
+
|
|
1357
|
+
/**
|
|
1358
|
+
*
|
|
1359
|
+
* @returns { Promise< object > } - return ourself
|
|
1360
|
+
*/
|
|
1331
1361
|
async #answerparent() {
|
|
1332
|
-
if( this.parent )
|
|
1333
|
-
|
|
1334
|
-
|
|
1335
|
-
|
|
1336
|
-
|
|
1337
|
-
|
|
1338
|
-
|
|
1339
|
-
|
|
1340
|
-
if( !this.parent.established ) {
|
|
1341
|
-
return this.hangup( hangupcodes.USER_GONE )
|
|
1342
|
-
}
|
|
1343
|
-
}
|
|
1344
|
-
|
|
1345
|
-
/* are we still established? */
|
|
1346
|
-
if( !this.established || this.state.destroyed || this.parent.destroyed ) return this
|
|
1347
|
-
if( !this.channels.audio ) {
|
|
1348
|
-
/* something bad has happened */
|
|
1349
|
-
this.hangup( hangupcodes.NOT_ACCEPTABLE )
|
|
1350
|
-
return this
|
|
1362
|
+
if( !this.parent ) return
|
|
1363
|
+
|
|
1364
|
+
if( !this.parent.established ) {
|
|
1365
|
+
try {
|
|
1366
|
+
await this.parent.answer()
|
|
1367
|
+
} catch( e ) {
|
|
1368
|
+
console.trace( e )
|
|
1351
1369
|
}
|
|
1370
|
+
}
|
|
1352
1371
|
|
|
1353
|
-
|
|
1372
|
+
if( this.#answerparenterrors() ) return this
|
|
1354
1373
|
|
|
1355
|
-
|
|
1356
|
-
callmanager.options.em.emit( "call.mix", this )
|
|
1357
|
-
this.parent._em.emit( "call.mix", this.parent )
|
|
1358
|
-
callmanager.options.em.emit( "call.mix", this.parent )
|
|
1374
|
+
this.channels.audio.mix( this.parent.channels.audio )
|
|
1359
1375
|
|
|
1360
|
-
|
|
1361
|
-
|
|
1362
|
-
|
|
1376
|
+
this._em.emit( "call.mix", this )
|
|
1377
|
+
callmanager.options.em.emit( "call.mix", this )
|
|
1378
|
+
this.parent._em.emit( "call.mix", this.parent )
|
|
1379
|
+
callmanager.options.em.emit( "call.mix", this.parent )
|
|
1380
|
+
|
|
1381
|
+
this.epochs.mix = Math.floor( +new Date() / 1000 )
|
|
1382
|
+
if( this.parent ) this.parent.epochs.mix = Math.floor( +new Date() / 1000 )
|
|
1383
|
+
|
|
1384
|
+
return this
|
|
1363
1385
|
}
|
|
1364
1386
|
|
|
1365
1387
|
/**
|