mirror of
https://github.com/jambonz/sbc-inbound.git
synced 2026-11-02 01:24:10 +00:00
simplify handling of reinvites from feature server
This commit is contained in:
1 parent
2c751a0b36
commit
de64af278d
1 file changed
+17
-3
+17
-3
@@ -154,10 +154,9 @@ class CallSession extends Emitter {
|
||||
this.rtpEngineResource.destroy();
|
||||
this.activeCallIds.delete(this.req.get('Call-ID'));
|
||||
});
|
||||
|
||||
//re-invite
|
||||
dlg.on('modify', this._onReinvite.bind(this, dlg));
|
||||
});
|
||||
uas.on('modify', this._onReinvite.bind(this, uas));
|
||||
uac.on('modify', this._onFeatureServerReinvite.bind(this, uac));
|
||||
|
||||
// default forwarding of other request types
|
||||
forwardInDialogRequests(uas);
|
||||
@@ -184,6 +183,21 @@ class CallSession extends Emitter {
|
||||
}
|
||||
}
|
||||
|
||||
async _onFeatureServerReinvite(dlg, req, res) {
|
||||
try {
|
||||
const opts = Object.assign({sdp: req.body, 'to-tag': res.getParsedHeader('To').params.tag},
|
||||
this.rtpEngineOpts.answer);
|
||||
const response = await this.answer(opts);
|
||||
if ('ok' !== response.result) {
|
||||
res.send(488);
|
||||
throw new Error(`_onFeatureServerReinvite: rtpengine failed: ${JSON.stringify(response)}`);
|
||||
}
|
||||
res.send(200, {body: response.sdp});
|
||||
} catch (err) {
|
||||
this.logger.error(err, 'Error handling reinvite from feature server');
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
module.exports = CallSession;
|
||||
Reference in new issue
Block a user