@babblevoice/babble-drachtio-callmanager 2.3.2 → 2.3.3
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 +14 -4
- package/package.json +1 -1
package/lib/call.js
CHANGED
|
@@ -277,7 +277,8 @@ class call {
|
|
|
277
277
|
"channelevent": false
|
|
278
278
|
},
|
|
279
279
|
"reject": {
|
|
280
|
-
"auth": false
|
|
280
|
+
"auth": false,
|
|
281
|
+
"channelevent": false
|
|
281
282
|
},
|
|
282
283
|
"promise": {
|
|
283
284
|
"hangup": false,
|
|
@@ -1316,7 +1317,7 @@ class call {
|
|
|
1316
1317
|
*/
|
|
1317
1318
|
waitfortelevents( match = /[0-9A-D*#]/, timeout = 30000 ) {
|
|
1318
1319
|
|
|
1319
|
-
if( this.destroyed ) throw "Call already destroyed"
|
|
1320
|
+
if( this.destroyed ) throw Error( "Call already destroyed" )
|
|
1320
1321
|
if( this._promises.promise.events ) return this._promises.promise.events
|
|
1321
1322
|
|
|
1322
1323
|
this._promises.promise.events = new Promise( ( resolve ) => {
|
|
@@ -1556,6 +1557,7 @@ class call {
|
|
|
1556
1557
|
|
|
1557
1558
|
const r = this._promises.resolve.channelevent
|
|
1558
1559
|
this._promises.resolve.channelevent = false
|
|
1560
|
+
this._promises.reject.channelevent = false
|
|
1559
1561
|
this._promises.promise.channelevent = false
|
|
1560
1562
|
if( r ) r( e )
|
|
1561
1563
|
}
|
|
@@ -1597,12 +1599,13 @@ class call {
|
|
|
1597
1599
|
*/
|
|
1598
1600
|
waitforanyevent( constraints, timeout = 500 ) {
|
|
1599
1601
|
|
|
1600
|
-
if( this.destroyed ) throw "Call already destroyed"
|
|
1602
|
+
if( this.destroyed ) throw Error( "Call already destroyed" )
|
|
1601
1603
|
if ( this._promises.promise.channelevent ) return this._promises.promise.channelevent
|
|
1602
1604
|
|
|
1603
1605
|
this._eventconstraints = constraints
|
|
1604
1606
|
|
|
1605
|
-
this._promises.promise.channelevent = new Promise( ( resolve ) => {
|
|
1607
|
+
this._promises.promise.channelevent = new Promise( ( resolve, reject ) => {
|
|
1608
|
+
this._promises.reject.channelevent = reject
|
|
1606
1609
|
this._promises.resolve.channelevent = resolve
|
|
1607
1610
|
} )
|
|
1608
1611
|
|
|
@@ -1610,6 +1613,7 @@ class call {
|
|
|
1610
1613
|
const r = this._promises.resolve.channelevent
|
|
1611
1614
|
this._promises.promise.channelevent = false
|
|
1612
1615
|
this._promises.resolve.channelevent = false
|
|
1616
|
+
this._promises.reject.channelevent = false
|
|
1613
1617
|
if( r ) r( "timeout" )
|
|
1614
1618
|
}, timeout * 1000 )
|
|
1615
1619
|
|
|
@@ -2252,6 +2256,12 @@ class call {
|
|
|
2252
2256
|
this._promises.resolve.auth = false
|
|
2253
2257
|
if( authreject ) authreject( this )
|
|
2254
2258
|
|
|
2259
|
+
const chanev = this._promises.reject.channelevent
|
|
2260
|
+
this._promises.resolve.channelevent = false
|
|
2261
|
+
this._promises.reject.channelevent = false
|
|
2262
|
+
this._promises.promise.channelevent = false
|
|
2263
|
+
if( chanev ) chanev( Error( "Call hungup" ) )
|
|
2264
|
+
|
|
2255
2265
|
const resolves = []
|
|
2256
2266
|
for ( const [ key, value ] of Object.entries( this._promises.resolve ) ) {
|
|
2257
2267
|
if( value ) resolves.push( value )
|