@babblevoice/babble-drachtio-callmanager 3.2.0 → 3.3.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 +34 -24
- package/package.json +1 -1
package/lib/call.js
CHANGED
|
@@ -483,6 +483,13 @@ class call {
|
|
|
483
483
|
return parsed
|
|
484
484
|
}
|
|
485
485
|
|
|
486
|
+
getparsedheader( hdr ) {
|
|
487
|
+
if( !this._req ) return
|
|
488
|
+
if( !this._req.has( hdr ) ) return
|
|
489
|
+
|
|
490
|
+
return this._req.getParsedHeader( hdr )
|
|
491
|
+
}
|
|
492
|
+
|
|
486
493
|
#fixparseduriobj( parsed ) {
|
|
487
494
|
|
|
488
495
|
if( !parsed ) parsed = {}
|
|
@@ -781,9 +788,6 @@ class call {
|
|
|
781
788
|
}
|
|
782
789
|
|
|
783
790
|
if( "uac" == this.type ) {
|
|
784
|
-
if( Array.isArray( this.sip.contact ) ) {
|
|
785
|
-
return parseuri( this.sip.contact[ 0 ].uri )
|
|
786
|
-
}
|
|
787
791
|
return parseuri( this.options.contact )
|
|
788
792
|
}
|
|
789
793
|
|
|
@@ -1291,7 +1295,10 @@ class call {
|
|
|
1291
1295
|
*/
|
|
1292
1296
|
async _onlatebridge() {
|
|
1293
1297
|
|
|
1294
|
-
|
|
1298
|
+
if ( this._dialog.res )
|
|
1299
|
+
this.sdp.remote = sdpgen.create( this._dialog.res.msg.body )
|
|
1300
|
+
else
|
|
1301
|
+
this.sdp.remote = sdpgen.create( this._req.msg.body )
|
|
1295
1302
|
|
|
1296
1303
|
const selectedcodec = this.sdp.remote.intersection( this.options.preferedcodecs, true )
|
|
1297
1304
|
if( !selectedcodec ) {
|
|
@@ -1302,7 +1309,10 @@ class call {
|
|
|
1302
1309
|
if( !channeldef )
|
|
1303
1310
|
return this.hangup( hangupcodes.INCOMPATIBLE_DESTINATION )
|
|
1304
1311
|
|
|
1305
|
-
|
|
1312
|
+
if ( this.channels.audio )
|
|
1313
|
+
this.channels.audio.destroy()
|
|
1314
|
+
|
|
1315
|
+
await this.#openrelatedchannel( channeldef )
|
|
1306
1316
|
|
|
1307
1317
|
this.sdp.local = sdpgen.create()
|
|
1308
1318
|
.addcodecs( selectedcodec )
|
|
@@ -1583,7 +1593,7 @@ class call {
|
|
|
1583
1593
|
}
|
|
1584
1594
|
}
|
|
1585
1595
|
|
|
1586
|
-
/**
|
|
1596
|
+
/**true
|
|
1587
1597
|
Shortcut to hangup with the reason busy.
|
|
1588
1598
|
*/
|
|
1589
1599
|
busy() {
|
|
@@ -1595,23 +1605,15 @@ class call {
|
|
|
1595
1605
|
*/
|
|
1596
1606
|
get _iswebrtc() {
|
|
1597
1607
|
|
|
1598
|
-
if( !this.sip || !this.sip.contact ) return false
|
|
1599
|
-
|
|
1600
|
-
let contactstr
|
|
1601
|
-
if( Array.isArray( this.sip.contact ) ) {
|
|
1602
|
-
contactstr = this.sip.contact[ 0 ].uri
|
|
1603
|
-
} else {
|
|
1604
|
-
contactstr = this.sip.contact
|
|
1605
|
-
}
|
|
1606
|
-
|
|
1607
1608
|
/* Have we received remote SDP? */
|
|
1608
1609
|
if( this.sdp.remote ) {
|
|
1609
1610
|
return this.sdp.remote.sdp.media[ 0 ] &&
|
|
1610
1611
|
-1 !== this.sdp.remote.sdp.media[ 0 ].protocol.toLowerCase().indexOf( "savpf" ) /* 'UDP/TLS/RTP/SAVPF' */
|
|
1611
1612
|
}
|
|
1612
1613
|
|
|
1613
|
-
|
|
1614
|
-
|
|
1614
|
+
if( !this.options || !this.options.contact ) return false
|
|
1615
|
+
return -1 !== this.options.contact.indexOf( ";transport=ws" )
|
|
1616
|
+
|
|
1615
1617
|
}
|
|
1616
1618
|
|
|
1617
1619
|
/**
|
|
@@ -2835,11 +2837,15 @@ class call {
|
|
|
2835
2837
|
if( callbacks.fail ) callbacks.fail( c )
|
|
2836
2838
|
}
|
|
2837
2839
|
|
|
2838
|
-
ourcallbacks.
|
|
2840
|
+
ourcallbacks.prebridge = ( c ) => {
|
|
2841
|
+
if( callbacks.prebridge ) return callbacks.prebridge( c )
|
|
2842
|
+
}
|
|
2843
|
+
|
|
2844
|
+
ourcallbacks.confirm = ( c, queuedcall ) => {
|
|
2839
2845
|
if( false !== waitonchildrenresolve ) {
|
|
2840
2846
|
waitonchildrenresolve( c )
|
|
2841
2847
|
waitonchildrenresolve = false
|
|
2842
|
-
if( callbacks.confirm ) callbacks.confirm( c )
|
|
2848
|
+
if( callbacks.confirm ) callbacks.confirm( c, queuedcall )
|
|
2843
2849
|
}
|
|
2844
2850
|
}
|
|
2845
2851
|
|
|
@@ -2925,11 +2931,11 @@ class call {
|
|
|
2925
2931
|
this.#checkandadd2833()
|
|
2926
2932
|
|
|
2927
2933
|
/* DTLS is only supported ( outbound ) on websocket connections */
|
|
2928
|
-
this.sip.contact = this.options.contact
|
|
2929
2934
|
if( this._iswebrtc ) {
|
|
2930
2935
|
this.sdp.local
|
|
2931
2936
|
.addssrc( this.channels.audio.local.ssrc )
|
|
2932
|
-
|
|
2937
|
+
/* ref: https://datatracker.ietf.org/doc/html/draft-ietf-rtcweb-jsep-14#page-34 offer MUST be actpass */
|
|
2938
|
+
.secure( this.channels.audio.local.dtls.fingerprint ,"actpass" )
|
|
2933
2939
|
.addicecandidates( this.channels.audio.local.address, this.channels.audio.local.port, this.channels.audio.local.icepwd )
|
|
2934
2940
|
.rtcpmux()
|
|
2935
2941
|
}
|
|
@@ -2960,7 +2966,12 @@ class call {
|
|
|
2960
2966
|
|
|
2961
2967
|
callstore.set( this )
|
|
2962
2968
|
|
|
2963
|
-
|
|
2969
|
+
if ( this._dialog.sip )
|
|
2970
|
+
this.sip.tags.remote = this._dialog.sip.remoteTag
|
|
2971
|
+
|
|
2972
|
+
let cookie = undefined
|
|
2973
|
+
if( callbacks.prebridge )
|
|
2974
|
+
cookie = await callbacks.prebridge( this )
|
|
2964
2975
|
|
|
2965
2976
|
if( true === this.#noack ) {
|
|
2966
2977
|
await this._onlatebridge()
|
|
@@ -2968,7 +2979,7 @@ class call {
|
|
|
2968
2979
|
await this._onearlybridge()
|
|
2969
2980
|
}
|
|
2970
2981
|
|
|
2971
|
-
if( callbacks.confirm ) await callbacks.confirm( this )
|
|
2982
|
+
if( callbacks.confirm ) await callbacks.confirm( this, cookie )
|
|
2972
2983
|
|
|
2973
2984
|
this._em.emit( "call.answered", this )
|
|
2974
2985
|
callmanager.options.em.emit( "call.answered", this )
|
|
@@ -3186,7 +3197,6 @@ class call {
|
|
|
3186
3197
|
if( options.entity ) {
|
|
3187
3198
|
newcall.entity = options.entity
|
|
3188
3199
|
callstore.set( newcall )
|
|
3189
|
-
|
|
3190
3200
|
}
|
|
3191
3201
|
|
|
3192
3202
|
newcall.#configcalleridfornewuac()
|