major revamp of http client functionalit

This commit is contained in:
Dave Horton
2020-02-14 12:45:28 -05:00
parent ff531e6964
commit 446000ee97
35 changed files with 906 additions and 433 deletions

View File

@@ -1,6 +1,10 @@
const {CallDirection, CallStatus} = require('../utils/constants');
const uuidv4 = require('uuid/v4');
/**
* @classdesc Represents the common information for all calls
* that is provided in call status webhooks
*/
class CallInfo {
constructor(opts) {
this.direction = opts.direction;
@@ -48,11 +52,20 @@ class CallInfo {
}
}
/**
* update the status of the call
* @param {string} callStatus - current call status
* @param {number} sipStatus - current sip status
*/
updateCallStatus(callStatus, sipStatus) {
this.callStatus = callStatus;
if (sipStatus) this.sipStatus = sipStatus;
}
/**
* associate customer-provided data with the call information.
* this information will be provided with every call status callhook
*/
set customerData(obj) {
this._customerData = obj;
}
@@ -84,6 +97,7 @@ class CallInfo {
}
return obj;
}
}
module.exports = CallInfo;