This commit is contained in:
Dave Horton
2024-09-19 10:36:05 -04:00
parent 524a556a7c
commit b9d789c1bf

View File

@@ -68,6 +68,8 @@ class CallSession extends Emitter {
this.service_provider_sid = req.locals.service_provider_sid;
this.srsClients = [];
this.recordingNoAnswerTimeout = (process.env.JAMBONES_RECORDING_NO_ANSWER_TIMEOUT || 2) * 1000;
this.isUsingPrivateNetwork = isPrivateVoipNetwork(this.req.source_address);
}
get isFromMSTeams() {
@@ -187,7 +189,7 @@ class CallSession extends Emitter {
...this.rtpEngineOpts.common,
...this.rtpEngineOpts.uac.mediaOpts,
'from-tag': this.rtpEngineOpts.uas.tag,
direction: [isPrivateVoipNetwork(this.req.source_address) ? 'private' : 'public', 'private'],
direction: [this.isUsingPrivateNetwork ? 'private' : 'public', 'private'],
sdp
};
const startAt = process.hrtime();
@@ -224,7 +226,7 @@ class CallSession extends Emitter {
// set Contact header based on scenario, and transport protocol
let responseHeaders = {};
if (isPrivateVoipNetwork(this.req.source_address)) {
if (this.isUsingPrivateNetwork) {
this.contactHeader = `<${scheme}:${this.privateSipAddress};transport=${this.req.protocol}>`;
responseHeaders = {
...responseHeaders,
@@ -998,11 +1000,15 @@ Duration=${payload.duration} `
...customHeaders
} = req.headers;
if (this.isUsingPrivateNetwork && this.privateSipAddress) {
u.host = this.privateSipAddress;
}
const response = await this.uas.request({
method: 'REFER',
headers: {
'Refer-To': `<${stringifyUri(uri)}>`,
'Referred-By': `<${stringifyUri(u)}>`,
...(this.contactHeader && {'Contact': this.contactHeader}),
...customHeaders
}
});