@babblevoice/babble-drachtio-callmanager 2.3.27 → 2.3.28
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/README.md +2 -1
- package/lib/call.js +5 -40
- package/lib/sdp.js +20 -0
- package/package.json +1 -1
- package/test/interface/sdp.js +30 -1
package/README.md
CHANGED
|
@@ -37,7 +37,8 @@ const r = new Registrar( {
|
|
|
37
37
|
"staletime": 180, /* number of seconds we consider a client stale if we don't hear a response from an OPTIONS or REGISTER ping */
|
|
38
38
|
"expires": 3600, /* default expires */
|
|
39
39
|
"minexpires": 3600, /* Force the client with 423 to extend expires to this amount - conflicts with regping */
|
|
40
|
-
"userlookup": passwordLookup
|
|
40
|
+
"userlookup": passwordLookup,
|
|
41
|
+
"forcerport": true /* when sending invite - request rport */
|
|
41
42
|
} )
|
|
42
43
|
|
|
43
44
|
|
package/lib/call.js
CHANGED
|
@@ -2686,6 +2686,9 @@ class call {
|
|
|
2686
2686
|
* @param { object } [ channeldef ]
|
|
2687
2687
|
*/
|
|
2688
2688
|
async #openrelatedchannel( channeldef ) {
|
|
2689
|
+
|
|
2690
|
+
if( this.channels.audio ) return
|
|
2691
|
+
|
|
2689
2692
|
const relatedcall = this.other
|
|
2690
2693
|
/* TODO: this is a hack. projectrtp has become too complicated with both a listen and connect
|
|
2691
2694
|
mechanism. This is causing problems in code like this. There is no interface to
|
|
@@ -2858,44 +2861,6 @@ class call {
|
|
|
2858
2861
|
return { user, realm }
|
|
2859
2862
|
}
|
|
2860
2863
|
|
|
2861
|
-
/**
|
|
2862
|
-
* Some phones require a NOTIFY to complete the auto-answer process - send it here
|
|
2863
|
-
* @param { object } res
|
|
2864
|
-
*/
|
|
2865
|
-
#notifytalk( res ) {
|
|
2866
|
-
|
|
2867
|
-
if( 180 != res.status && 183 != res.status ) return
|
|
2868
|
-
if( !this.options.autoanswer ) return
|
|
2869
|
-
|
|
2870
|
-
console.log("res", res)
|
|
2871
|
-
const opts = {
|
|
2872
|
-
"method": "NOTIFY",
|
|
2873
|
-
"headers": {
|
|
2874
|
-
"Event": "talk",
|
|
2875
|
-
"Subscription-State": "terminated;reason=noresource",
|
|
2876
|
-
"Allow-Events": "talk, hold, conference, presence, as-feature-event, dialog, line-seize, call-info, sla, include-session-description, presence.winfo, message-summary, refer",
|
|
2877
|
-
"Content-Length": "0",
|
|
2878
|
-
"Call-ID": res.getParsedHeader( "call-id" ),
|
|
2879
|
-
"To": res.get( "to" ),
|
|
2880
|
-
"From": res.get( "from" ),
|
|
2881
|
-
}
|
|
2882
|
-
}
|
|
2883
|
-
|
|
2884
|
-
console.log(opts)
|
|
2885
|
-
|
|
2886
|
-
callmanager.options.srf.request( this.options.contact + this.options.contactparams, opts, ( err, req ) => {
|
|
2887
|
-
if( err ) {
|
|
2888
|
-
console.error( err )
|
|
2889
|
-
return
|
|
2890
|
-
}
|
|
2891
|
-
|
|
2892
|
-
// req is the SIP request that went out over the wire
|
|
2893
|
-
req.on( "response", (/*res*/) => {
|
|
2894
|
-
//console.log(`received ${res.status} response to our OPTIONS request`)
|
|
2895
|
-
} )
|
|
2896
|
-
} )
|
|
2897
|
-
}
|
|
2898
|
-
|
|
2899
2864
|
/**
|
|
2900
2865
|
*
|
|
2901
2866
|
* @param { string } contactstr
|
|
@@ -2907,9 +2872,11 @@ class call {
|
|
|
2907
2872
|
if( !this.options.contactparams ) this.options.contactparams = ""
|
|
2908
2873
|
if( true === this.options.autoanswer ) {
|
|
2909
2874
|
this.options.headers[ "Call-Info" ] = `<sip:${parts.host}>;answer-after=0`
|
|
2875
|
+
this.options.headers[ "Alert-Info" ] = "auto-answer"
|
|
2910
2876
|
this.options.contactparams += ";intercom=true"
|
|
2911
2877
|
} else if ( "number" == typeof this.options.autoanswer ) {
|
|
2912
2878
|
this.options.headers[ "Call-Info" ] = `<sip:${parts.host}>;answer-after=${this.options.autoanswer}`
|
|
2879
|
+
this.options.headers[ "Alert-Info" ] = "auto-answer"
|
|
2913
2880
|
this.options.contactparams += ";intercom=true"
|
|
2914
2881
|
}
|
|
2915
2882
|
}
|
|
@@ -3083,8 +3050,6 @@ class call {
|
|
|
3083
3050
|
await newcall._onearly()
|
|
3084
3051
|
}
|
|
3085
3052
|
|
|
3086
|
-
newcall.#notifytalk( res )
|
|
3087
|
-
|
|
3088
3053
|
if( newcall.canceled ) {
|
|
3089
3054
|
newcall.hangup()
|
|
3090
3055
|
}
|
package/lib/sdp.js
CHANGED
|
@@ -691,10 +691,30 @@ class sdp {
|
|
|
691
691
|
|
|
692
692
|
if( "ilbc" in o && 8000 == o.ilbc.rate ) {
|
|
693
693
|
this.#dynamicpts.setdynamicpt( "ilbc", "ilbc", o.ilbc.payload )
|
|
694
|
+
|
|
695
|
+
const m = this.sdp.media.find( mo => "audio" === mo.type )
|
|
696
|
+
if( m ) {
|
|
697
|
+
// @ts-ignore
|
|
698
|
+
const ilbcindex = m.payloads.indexOf( prtpcodecpts.ilbc )
|
|
699
|
+
if( -1 !== ilbcindex ) {
|
|
700
|
+
// @ts-ignore
|
|
701
|
+
m.payloads.splice( ilbcindex, 1, o.ilbc.payload )
|
|
702
|
+
}
|
|
703
|
+
}
|
|
694
704
|
}
|
|
695
705
|
|
|
696
706
|
if( "rfc2833" in o && 8000 == o.rfc2833.rate ) {
|
|
697
707
|
this.#dynamicpts.setdynamicpt( "2833", "telephone-event", o.rfc2833.payload )
|
|
708
|
+
|
|
709
|
+
const m = this.sdp.media.find( mo => "audio" === mo.type )
|
|
710
|
+
if( m ) {
|
|
711
|
+
// @ts-ignore
|
|
712
|
+
const televindex = m.payloads.indexOf( prtpcodecpts[ "2833" ] )
|
|
713
|
+
if( -1 !== televindex ) {
|
|
714
|
+
// @ts-ignore
|
|
715
|
+
m.payloads.splice( televindex, 1, o.rfc2833.payload )
|
|
716
|
+
}
|
|
717
|
+
}
|
|
698
718
|
}
|
|
699
719
|
|
|
700
720
|
return this
|
package/package.json
CHANGED
package/test/interface/sdp.js
CHANGED
|
@@ -814,7 +814,7 @@ o=- \\d+ 0 IN IP4 127.0.0.1
|
|
|
814
814
|
s=project
|
|
815
815
|
c=IN IP4 127.0.0.1
|
|
816
816
|
t=0 0
|
|
817
|
-
m=audio 0 RTP/AVP
|
|
817
|
+
m=audio 0 RTP/AVP 110 127
|
|
818
818
|
a=rtpmap:110 ilbc/8000
|
|
819
819
|
a=rtpmap:127 telephone-event/8000
|
|
820
820
|
a=fmtp:110 mode=20
|
|
@@ -898,4 +898,33 @@ a=rtpmap:127 telephone-event/8000
|
|
|
898
898
|
expect( media.direction ).to.be.undefined
|
|
899
899
|
} )
|
|
900
900
|
|
|
901
|
+
it( "receive sdp send sdp ilbc", async () => {
|
|
902
|
+
const polysdp = `v=0
|
|
903
|
+
o=- 1699618792 1699618792 IN IP4 82.19.206.102
|
|
904
|
+
s=Polycom IP Phone
|
|
905
|
+
c=IN IP4 82.19.206.102
|
|
906
|
+
t=0 0
|
|
907
|
+
a=sendrecv
|
|
908
|
+
m=audio 63450 RTP/AVP 110 127
|
|
909
|
+
a=rtpmap:110 iLBC/8000
|
|
910
|
+
a=fmtp:110 mode=20
|
|
911
|
+
a=rtpmap:127 telephone-event/8000
|
|
912
|
+
`.replace( /\r\n/g, "\n" ).replace( /\n/g, "\r\n" )
|
|
913
|
+
|
|
914
|
+
const sdpobj = sdp.create( polysdp )
|
|
915
|
+
|
|
916
|
+
sdpobj.select( sdpobj.intersection( "g722 pcma pcmu ilbc", true ) )
|
|
917
|
+
|
|
918
|
+
const respsdp = sdp.create()
|
|
919
|
+
.addcodecs( sdpobj.selected.name )
|
|
920
|
+
.setconnectionaddress( "1.1.1.1" )
|
|
921
|
+
.setaudioport( 10000 )
|
|
922
|
+
.setdynamepayloadtypes( sdpobj )
|
|
923
|
+
|
|
924
|
+
const outsdpstring = respsdp.toString()
|
|
925
|
+
|
|
926
|
+
expect( outsdpstring ).include( outsdpstring, "m=audio 10000 RTP/AVP 110" )
|
|
927
|
+
expect( outsdpstring ).include( outsdpstring, "a=rtpmap:110 ilbc/8000" )
|
|
928
|
+
|
|
929
|
+
} )
|
|
901
930
|
} )
|