This commit is contained in:
Dave Horton
2021-07-21 12:39:44 -04:00
parent 574cdcb216
commit d2416c8ba4
3 changed files with 16 additions and 11 deletions
+1 -1
View File
@@ -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
+1
View File
@@ -3,5 +3,6 @@
"DTLS": "off",
"SDES": "off",
"ICE": "remove",
"flags": ["media handover"],
"rtcp-mux": ["demux"]
}
+14 -10
View File
@@ -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');