@babblevoice/babble-drachtio-callmanager 3.7.4 → 3.7.6
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 +53 -20
- package/package.json +1 -1
package/lib/call.js
CHANGED
|
@@ -791,7 +791,8 @@ class call {
|
|
|
791
791
|
}
|
|
792
792
|
|
|
793
793
|
if( "uas" == this.type ) this.#calledidforuas( startingpoint )
|
|
794
|
-
else if(
|
|
794
|
+
else if( this.options.partycalled ) this.#fromrefertouri( startingpoint )
|
|
795
|
+
else this.#calledidforuac( startingpoint )
|
|
795
796
|
|
|
796
797
|
this.#overridecalledid( startingpoint )
|
|
797
798
|
|
|
@@ -1454,7 +1455,14 @@ class call {
|
|
|
1454
1455
|
.rtcpmux()
|
|
1455
1456
|
}
|
|
1456
1457
|
|
|
1457
|
-
|
|
1458
|
+
try {
|
|
1459
|
+
this._dialog = await this._dialog.ack( this.sdp.local.toString() )
|
|
1460
|
+
} catch( e ) {
|
|
1461
|
+
if( this.destroyed ) return
|
|
1462
|
+
this.hangup( hangupcodes.USER_GONE )
|
|
1463
|
+
return
|
|
1464
|
+
}
|
|
1465
|
+
|
|
1458
1466
|
this.established = true
|
|
1459
1467
|
this.#addevents( this._dialog )
|
|
1460
1468
|
|
|
@@ -2013,6 +2021,10 @@ class call {
|
|
|
2013
2021
|
this._hold()
|
|
2014
2022
|
if( this.state.held ) {
|
|
2015
2023
|
this._dialog.modify( this.sdp.local.toString() )
|
|
2024
|
+
.catch( () => {
|
|
2025
|
+
if( this.destroyed ) return
|
|
2026
|
+
this.hangup( hangupcodes.USER_GONE )
|
|
2027
|
+
} )
|
|
2016
2028
|
}
|
|
2017
2029
|
}
|
|
2018
2030
|
|
|
@@ -2023,6 +2035,10 @@ class call {
|
|
|
2023
2035
|
this._unhold()
|
|
2024
2036
|
if( !this.state.held ) {
|
|
2025
2037
|
this._dialog.modify( this.sdp.local.toString() )
|
|
2038
|
+
.catch( () => {
|
|
2039
|
+
if( this.destroyed ) return
|
|
2040
|
+
this.hangup( hangupcodes.USER_GONE )
|
|
2041
|
+
} )
|
|
2026
2042
|
}
|
|
2027
2043
|
}
|
|
2028
2044
|
|
|
@@ -2185,9 +2201,11 @@ class call {
|
|
|
2185
2201
|
"body": "SIP/2.0 400 Ok\r\n"
|
|
2186
2202
|
}
|
|
2187
2203
|
|
|
2188
|
-
|
|
2189
|
-
|
|
2190
|
-
} )
|
|
2204
|
+
try {
|
|
2205
|
+
await this._dialog.request( opts )
|
|
2206
|
+
} catch( e ) {
|
|
2207
|
+
/* silent */
|
|
2208
|
+
}
|
|
2191
2209
|
}
|
|
2192
2210
|
|
|
2193
2211
|
/**
|
|
@@ -2211,10 +2229,11 @@ class call {
|
|
|
2211
2229
|
"body": "SIP/2.0 200 Ok\r\n"
|
|
2212
2230
|
}
|
|
2213
2231
|
|
|
2214
|
-
|
|
2215
|
-
.
|
|
2216
|
-
|
|
2217
|
-
|
|
2232
|
+
try {
|
|
2233
|
+
await this._dialog.request( opts )
|
|
2234
|
+
} catch( e ) {
|
|
2235
|
+
/* silent */
|
|
2236
|
+
}
|
|
2218
2237
|
}
|
|
2219
2238
|
|
|
2220
2239
|
/**
|
|
@@ -2238,10 +2257,11 @@ class call {
|
|
|
2238
2257
|
"body": "SIP/2.0 100 Trying\r\n"
|
|
2239
2258
|
}
|
|
2240
2259
|
|
|
2241
|
-
|
|
2242
|
-
.
|
|
2243
|
-
|
|
2244
|
-
|
|
2260
|
+
try{
|
|
2261
|
+
await this._dialog.request( opts )
|
|
2262
|
+
} catch( e ) {
|
|
2263
|
+
/* silent */
|
|
2264
|
+
}
|
|
2245
2265
|
}
|
|
2246
2266
|
|
|
2247
2267
|
/**
|
|
@@ -2269,7 +2289,13 @@ class call {
|
|
|
2269
2289
|
|
|
2270
2290
|
this.#configcalleridfornewuac()
|
|
2271
2291
|
|
|
2272
|
-
|
|
2292
|
+
let remoteresponse
|
|
2293
|
+
try {
|
|
2294
|
+
remoteresponse = await this._dialog.request( { ...this.options, ...requestoptions } )
|
|
2295
|
+
} catch( e ) {
|
|
2296
|
+
/* silent */
|
|
2297
|
+
}
|
|
2298
|
+
|
|
2273
2299
|
if( this.destroyed ) return
|
|
2274
2300
|
|
|
2275
2301
|
if( remoteresponse?.msg?.body ) {
|
|
@@ -3201,7 +3227,7 @@ class call {
|
|
|
3201
3227
|
if( this.state.established ) {
|
|
3202
3228
|
if( this.#hangupestablish( reason, tone ) ) return
|
|
3203
3229
|
} else if( "uac" === this.type && this.state.trying ) {
|
|
3204
|
-
this.#hangupnotestablish()
|
|
3230
|
+
await this.#hangupnotestablish()
|
|
3205
3231
|
await this._onhangup( source, reason )
|
|
3206
3232
|
return
|
|
3207
3233
|
} else if( this._res ) {
|
|
@@ -3226,7 +3252,11 @@ class call {
|
|
|
3226
3252
|
if( !this._dialog ) return
|
|
3227
3253
|
if( !this._dialog.destroy ) return
|
|
3228
3254
|
|
|
3229
|
-
|
|
3255
|
+
try {
|
|
3256
|
+
await this._dialog.destroy()
|
|
3257
|
+
} catch( e ) {
|
|
3258
|
+
/* silent */
|
|
3259
|
+
}
|
|
3230
3260
|
}
|
|
3231
3261
|
|
|
3232
3262
|
/**
|
|
@@ -3276,13 +3306,11 @@ class call {
|
|
|
3276
3306
|
/**
|
|
3277
3307
|
* The call is not established so send a cancel.
|
|
3278
3308
|
*/
|
|
3279
|
-
#hangupnotestablish() {
|
|
3309
|
+
async #hangupnotestablish() {
|
|
3280
3310
|
try {
|
|
3281
3311
|
this.canceled = true
|
|
3282
3312
|
if( this._req ) {
|
|
3283
|
-
this._req.cancel(
|
|
3284
|
-
if( err ) console.trace( err )
|
|
3285
|
-
} )
|
|
3313
|
+
await this._req.cancel()
|
|
3286
3314
|
}
|
|
3287
3315
|
} catch( e ) { console.trace( e ) }
|
|
3288
3316
|
}
|
|
@@ -3344,7 +3372,12 @@ class call {
|
|
|
3344
3372
|
|
|
3345
3373
|
this.#configcalleridfornewuac()
|
|
3346
3374
|
|
|
3375
|
+
|
|
3347
3376
|
this._dialog.request( { ...this.options, ...requestoptions } )
|
|
3377
|
+
.catch( () => {
|
|
3378
|
+
if( this.destroyed ) return
|
|
3379
|
+
this.hangup( hangupcodes.USER_GONE )
|
|
3380
|
+
} )
|
|
3348
3381
|
|
|
3349
3382
|
return true
|
|
3350
3383
|
}
|