diff --git a/LICENSE b/LICENSE index 9a7af18..23369fa 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 jambonz +Copyright (c) 2021 Drachtio Communications Services, LLC Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/data/rtp-transcoding.json b/data/rtp-transcoding.json index 9fc3f4a..1b5e5f6 100644 --- a/data/rtp-transcoding.json +++ b/data/rtp-transcoding.json @@ -3,5 +3,6 @@ "DTLS": "off", "SDES": "off", "ICE": "remove", + "flags": ["media handover"], "rtcp-mux": ["demux"] } \ No newline at end of file diff --git a/lib/call-session.js b/lib/call-session.js index aa1363d..80c7f29 100644 --- a/lib/call-session.js +++ b/lib/call-session.js @@ -333,22 +333,25 @@ class CallSession extends Emitter { if (req.has('X-Retain-Call-Sid')) { Object.assign(headers, {'X-Retain-Call-Sid': req.get('X-Retain-Call-Sid')}); } - const dlg = await this.srf.createUAC(referTo.uri, {localSdp: dlg.local.sdp, headers}); - this.uas.destroy(); - - this.uas = dlg; - this.uas.other = this.uac; - this.uac.other = this.uas; - this.uas.on('modify', this._onReinvite.bind(this, this.uas)); - this.uas.on('refer', this._onFeatureServerTransfer.bind(this, this.uas)); - this.uas.on('destroy', () => { + const uas = await this.srf.createUAC(referTo.uri, {localSdp: dlg.local.sdp, headers}); + this.uas = uas; + uas.other = this.uac; + this.uac.other = uas; + uas.on('modify', this._onReinvite.bind(this, uas)); + uas.on('refer', this._onFeatureServerTransfer.bind(this, uas)); + uas.on('destroy', () => { this.logger.info('call ended with normal termination'); this.rtpEngineResource.destroy(); this.activeCallIds.delete(this.req.get('Call-ID')); - this.uas.other.destroy(); + uas.other.destroy(); }); + // now we can destroy the old dialog + dlg.destroy(); + // modify rtpengine to stream to new feature server + // NB: the media handover flag should suffice to tell rtpengine to relearn addresses + /* let response = await this.offer(Object.assign(this.rtpEngineOpts.offer, {sdp: this.uas.remote.sdp})); if ('ok' !== response.result) { throw new Error(`_onReinvite: rtpengine failed: offer: ${JSON.stringify(response)}`); @@ -360,6 +363,7 @@ class CallSession extends Emitter { if ('ok' !== response.result) { throw new Error(`_onReinvite: rtpengine failed: ${JSON.stringify(response)}`); } + */ this.logger.info('successfully moved call to new feature server'); } catch (err) { this.logger.error(err, 'Error handling refer from feature server');