mirror of
https://github.com/jambonz/sbc-inbound.git
synced 2025-12-19 04:37:43 +00:00
bugfix: rtpengine now generates internal IP on sdp for internal-facing streams
This commit is contained in:
@@ -79,10 +79,11 @@ class CallSession extends Emitter {
|
||||
this.logger.info(`uri will be: ${uri}, proxy ${proxy}`);
|
||||
|
||||
try {
|
||||
const response = await this.offer(this.rtpEngineOpts.offer);
|
||||
debug(`response from rtpengine to offer ${JSON.stringify(response)}`);
|
||||
const opts = Object.assign(this.rtpEngineOpts.offer, {sdp: this.req.body});
|
||||
const response = await this.offer(opts);
|
||||
this.logger.debug({opts, response}, 'response from rtpengine to offer');
|
||||
if ('ok' !== response.result) {
|
||||
this.logger.error(`rtpengine offer failed with ${JSON.stringify(response)}`);
|
||||
this.logger.error({}, `rtpengine offer failed with ${JSON.stringify(response)}`);
|
||||
throw new Error('rtpengine failed: answer');
|
||||
}
|
||||
|
||||
@@ -129,7 +130,7 @@ class CallSession extends Emitter {
|
||||
localSdpB: response.sdp,
|
||||
localSdpA: async(sdp, res) => {
|
||||
this.toTag = res.getParsedHeader('To').params.tag;
|
||||
const opts = Object.assign({sdp, 'to-tag': this.toTag}, this.rtpEngineOpts.answer);
|
||||
const opts = Object.assign(this.rtpEngineOpts.answer, {sdp, 'to-tag': this.toTag});
|
||||
const response = await this.answer(opts);
|
||||
if ('ok' !== response.result) {
|
||||
this.logger.error(`rtpengine answer failed with ${JSON.stringify(response)}`);
|
||||
@@ -141,7 +142,6 @@ class CallSession extends Emitter {
|
||||
|
||||
// successfully connected
|
||||
this.logger.info('call connected successfully to feature server');
|
||||
this.toTag = uas.sip.localTag;
|
||||
this._setHandlers({uas, uac});
|
||||
return;
|
||||
} catch (err) {
|
||||
@@ -215,6 +215,7 @@ class CallSession extends Emitter {
|
||||
this.logger.info({opts, response}, 'sent offer for reinvite to rtpengine');
|
||||
const sdp = await this.uac.modify(response.sdp);
|
||||
opts = Object.assign(this.rtpEngineOpts.answer, {sdp, 'to-tag': this.toTag});
|
||||
Object.assign(this.rtpEngineOpts.offer, {'to-tag': this.toTag});
|
||||
response = await this.answer(opts);
|
||||
if ('ok' !== response.result) {
|
||||
res.send(488);
|
||||
@@ -252,7 +253,7 @@ class CallSession extends Emitter {
|
||||
|
||||
async _onReinvite(dlg, req, res) {
|
||||
try {
|
||||
let opts = Object.assign(this.rtpEngineOpts.offer, {sdp: req.body});
|
||||
let opts = Object.assign(this.rtpEngineOpts.offer, {sdp: req.body, 'to-tag': this.toTag});
|
||||
let response = await this.offer(opts);
|
||||
if ('ok' !== response.result) {
|
||||
res.send(488);
|
||||
@@ -260,7 +261,7 @@ class CallSession extends Emitter {
|
||||
}
|
||||
this.logger.info({opts, response}, 'sent offer for reinvite to rtpengine');
|
||||
const sdp = await dlg.other.modify(response.sdp);
|
||||
opts = Object.assign({sdp, 'to-tag': this.toTag}, this.rtpEngineOpts.answer);
|
||||
opts = Object.assign(this.rtpEngineOpts.answer, {sdp});
|
||||
response = await this.answer(opts);
|
||||
if ('ok' !== response.result) {
|
||||
res.send(488);
|
||||
@@ -275,7 +276,7 @@ class CallSession extends Emitter {
|
||||
|
||||
async _onFeatureServerReinvite(dlg, req, res) {
|
||||
try {
|
||||
const opts = Object.assign({sdp: req.body, 'to-tag': this.toTag}, this.rtpEngineOpts.answer);
|
||||
const opts = Object.assign(this.rtpEngineOpts.answer, {sdp: req.body, 'to-tag': this.toTag});
|
||||
const response = await this.answer(opts);
|
||||
if ('ok' !== response.result) {
|
||||
res.send(488);
|
||||
|
||||
@@ -19,6 +19,7 @@ function makeRtpEngineOpts(req, srcIsUsingSrtp, dstIsUsingSrtp, teams = false) {
|
||||
common,
|
||||
offer: Object.assign(
|
||||
{'sdp': req.body, 'replace': ['origin', 'session-connection']},
|
||||
{'direction': [ 'public', 'private']},
|
||||
common,
|
||||
dstIsUsingSrtp ? srtpOpts : rtpCharacteristics),
|
||||
answer: Object.assign(
|
||||
|
||||
@@ -47,6 +47,7 @@ services:
|
||||
|
||||
rtpengine:
|
||||
image: drachtio/rtpengine:latest
|
||||
command: rtpengine --interface private/172.38.0.14 --interface public/172.38.0.14!172.38.0.14
|
||||
ports:
|
||||
- "12222:22222/udp"
|
||||
networks:
|
||||
|
||||
Reference in New Issue
Block a user