This commit is contained in:
Dave Horton
2020-02-19 11:15:24 -05:00
parent 162dfff5a3
commit 802cc1944f
11 changed files with 1013 additions and 917 deletions

View File

@@ -172,6 +172,29 @@ class CallSession extends Emitter {
sessionTracker.remove(this.callSid);
}
normalizeUrl(url, method, auth) {
const hook = {
url,
method
};
if (auth && auth.username && auth.password) {
hook.auth = {
username: auth.username,
password: auth.password
};
}
if (typeof url === 'string' && url.startsWith('/')) {
const baseUrl = this.requestor.baseUrl;
hook.url = `${baseUrl}${url}`;
if (this.requestor.username && this.requestor.password) {
hook.auth = {
username: this.requestor.username,
password: this.requestor.password
};
}
}
return hook;
}
/**
* This is called when all tasks have completed. It is not implemented in the superclass
* but provided as a convenience for subclasses that need to do cleanup at the end of
@@ -536,7 +559,8 @@ class CallSession extends Emitter {
// update calls db
this.logger.debug(`updating redis with ${JSON.stringify(this.callInfo)}`);
this.updateCallStatus(this.callInfo, this.serviceUrl).catch((err) => this.logger.error(err, 'redis error'));
this.updateCallStatus(Object.assign({}, this.callInfo), this.serviceUrl)
.catch((err) => this.logger.error(err, 'redis error'));
}
}