write service_provider_sid with alerts

This commit is contained in:
Dave Horton
2022-09-07 23:51:40 +02:00
parent e90ef6bc70
commit 889257d7db
14 changed files with 85 additions and 175 deletions

View File

@@ -201,6 +201,12 @@ class CallSession extends Emitter {
return this.direction === CallDirection.Inbound && this.res.finalResponseSent;
}
/**
* returns the account sid
*/
get serviceProviderSid() {
return this.callInfo.serviceProviderSid;
}
/**
* returns the account sid
*/
@@ -520,6 +526,7 @@ class CallSession extends Emitter {
this.logger.info({err}, `malformed google service_key provisioned for account ${sid}`);
writeAlerts({
alert_type: AlertType.TTS_FAILURE,
service_provider_sid: this.serviceProviderSid,
account_sid: this.accountSid,
vendor
}).catch((err) => this.logger.error({err}, 'Error writing tts alert'));
@@ -550,6 +557,7 @@ class CallSession extends Emitter {
else {
writeAlerts({
alert_type: AlertType.STT_NOT_PROVISIONED,
service_provider_sid: this.serviceProviderSid,
account_sid: this.accountSid,
vendor
}).catch((err) => this.logger.error({err}, 'Error writing tts alert'));
@@ -1382,8 +1390,13 @@ class CallSession extends Emitter {
}
else {
this.logger.info({accountSid: this.accountSid, webhook: r[0]}, 'performQueueWebhook: webhook found');
this.queueEventHookRequestor = new HttpRequestor(this.logger, this.accountSid,
r[0], this.webhook_secret);
this.queueEventHookRequestor = new HttpRequestor(
this.logger,
this.serviceProviderSid,
this.accountSid,
r[0],
this.webhook_secret
);
this.queueEventHook = r[0];
}
} catch (err) {