fixes for sending calls to sip endpoint that challenges

This commit is contained in:
Dave Horton
2020-07-29 08:13:10 -04:00
parent 782102b6c1
commit b0d3e6bbac
3 changed files with 7 additions and 4 deletions

View File

@@ -126,12 +126,13 @@ class CallSession extends Emitter {
let earlyMedia = false;
while (uris.length) {
const uri = uris.shift();
const passFailure = 0 === uris.length; // only a single target
debug(`sending INVITE to ${uri} via ${proxy})`);
this.logger.info(`sending INVITE to ${uri}`);
try {
const {uas, uac} = await this.srf.createB2BUA(this.req, this.res, uri, {
proxy,
passFailure: false,
passFailure,
proxyRequestHeaders: ['all', '-X-MS-Teams-FQDN', '-X-MS-Teams-Tenant-FQDN', '-Allow',
'-Session-Expires', 'Min-SE'],
proxyResponseHeaders: ['all', '-Allow'],
@@ -172,7 +173,7 @@ class CallSession extends Emitter {
if (err instanceof SipError) this.logger.info(`final call failure ${err.status}`);
else this.logger.error(err, 'unexpected call failure');
debug(`got final outdial error: ${err}`);
this.res.send(err.status || 500);
if (!passFailure) this.res.send(err.status || 500);
this.emit('failed');
this.rtpEngineResource.destroy();
const tags = ['accepted:no', `sipStatus:${err.status || 500}`];

View File

@@ -69,7 +69,7 @@ function route(opts) {
return next();
}
}
else if (!isLocalUri(uri.host, req) /*|| !dotDecimalHost */) {
if (!dotDecimalHost || !isLocalUri(uri.host, req)) {
// TODO: need to try to forward calls to a DNS host name
// so long as that domain name is not associated with an account or SP in our DB
logger.info(`forwarding call to sip endpoint ${req.uri}`);

View File

@@ -55,7 +55,9 @@ api_key_sid CHAR(36) NOT NULL UNIQUE ,
token CHAR(36) NOT NULL UNIQUE ,
account_sid CHAR(36),
service_provider_sid CHAR(36),
expires_at TIMESTAMP,
expires_at TIMESTAMP NULL,
last_used TIMESTAMP NULL,
created_at TIMESTAMP DEFAULT CURRENT_TIMESTAMP,
PRIMARY KEY (api_key_sid)
) ENGINE=InnoDB COMMENT='An authorization token that is used to access the REST api';