mirror of
https://github.com/jambonz/sbc-inbound.git
synced 2026-02-09 02:29:31 +00:00
Contact in 200 should set sip(s) appropriately and have port and prot… (#148)
* Contact in 200 should set sip(s) appropriately and have port and protocol * fix for k8s * lint * wip
This commit is contained in:
@@ -213,24 +213,36 @@ class CallSession extends Emitter {
|
||||
createSiprecBody(headers, response.sdp, this.xml.type, this.xml.content) :
|
||||
response.sdp;
|
||||
|
||||
const responseHeaders = {};
|
||||
if (isPrivateVoipNetwork(this.req.source_address)) {
|
||||
Object.assign(responseHeaders, {'Contact':`<sip:${this.privateSipAddress}>`});
|
||||
}
|
||||
if (this.req.locals.carrier) {
|
||||
Object.assign(headers, {
|
||||
'X-Originating-Carrier': this.req.locals.carrier,
|
||||
'X-Voip-Carrier-Sid': this.req.locals.voip_carrier_sid
|
||||
});
|
||||
}
|
||||
if (this.req.locals.msTeamsTenantFqdn) {
|
||||
|
||||
// set Contact header based on scenario, and transport protocol
|
||||
let responseHeaders = {};
|
||||
if (isPrivateVoipNetwork(this.req.source_address)) {
|
||||
responseHeaders = {
|
||||
...responseHeaders,
|
||||
'Contact':`<${obj.scheme}:${this.privateSipAddress}>;transport=${this.req.protocol}`
|
||||
};
|
||||
} else if (this.req.locals.msTeamsTenantFqdn) {
|
||||
Object.assign(headers, {'X-MS-Teams-Tenant-FQDN': this.req.locals.msTeamsTenantFqdn});
|
||||
|
||||
// for Microsoft Teams the Contact header must include the tenant FQDN
|
||||
Object.assign(responseHeaders, {
|
||||
responseHeaders = {
|
||||
...responseHeaders,
|
||||
Allow: 'INVITE, ACK, OPTIONS, CANCEL, BYE, NOTIFY, UPDATE, PRACK',
|
||||
Contact: `sip:${this.req.locals.msTeamsTenantFqdn}`
|
||||
});
|
||||
};
|
||||
}
|
||||
else {
|
||||
const hostport = this.srf.locals.sbcPublicIpAddress[this.req.protocol];
|
||||
responseHeaders = {
|
||||
...responseHeaders,
|
||||
'Contact':`<${obj.scheme}:${hostport}>;transport=${this.req.protocol}`
|
||||
};
|
||||
}
|
||||
if (this.req.locals.application_sid) {
|
||||
Object.assign(headers, {'X-Application-Sid': this.req.locals.application_sid});
|
||||
|
||||
Reference in New Issue
Block a user