bria
Version:
CounterPath Bria Desktop API for Node.js
695 lines • 32.8 kB
JavaScript
"use strict";
var __extends = (this && this.__extends) || (function () {
var extendStatics = function (d, b) {
extendStatics = Object.setPrototypeOf ||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
function (d, b) { for (var p in b) if (Object.prototype.hasOwnProperty.call(b, p)) d[p] = b[p]; };
return extendStatics(d, b);
};
return function (d, b) {
if (typeof b !== "function" && b !== null)
throw new TypeError("Class extends value " + String(b) + " is not a constructor or null");
extendStatics(d, b);
function __() { this.constructor = d; }
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
};
})();
var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, generator) {
function adopt(value) { return value instanceof P ? value : new P(function (resolve) { resolve(value); }); }
return new (P || (P = Promise))(function (resolve, reject) {
function fulfilled(value) { try { step(generator.next(value)); } catch (e) { reject(e); } }
function rejected(value) { try { step(generator["throw"](value)); } catch (e) { reject(e); } }
function step(result) { result.done ? resolve(result.value) : adopt(result.value).then(fulfilled, rejected); }
step((generator = generator.apply(thisArg, _arguments || [])).next());
});
};
var __generator = (this && this.__generator) || function (thisArg, body) {
var _ = { label: 0, sent: function() { if (t[0] & 1) throw t[1]; return t[1]; }, trys: [], ops: [] }, f, y, t, g;
return g = { next: verb(0), "throw": verb(1), "return": verb(2) }, typeof Symbol === "function" && (g[Symbol.iterator] = function() { return this; }), g;
function verb(n) { return function (v) { return step([n, v]); }; }
function step(op) {
if (f) throw new TypeError("Generator is already executing.");
while (_) try {
if (f = 1, y && (t = op[0] & 2 ? y["return"] : op[0] ? y["throw"] || ((t = y["return"]) && t.call(y), 0) : y.next) && !(t = t.call(y, op[1])).done) return t;
if (y = 0, t) op = [op[0] & 2, t.value];
switch (op[0]) {
case 0: case 1: t = op; break;
case 4: _.label++; return { value: op[1], done: false };
case 5: _.label++; y = op[1]; op = [0]; continue;
case 7: op = _.ops.pop(); _.trys.pop(); continue;
default:
if (!(t = _.trys, t = t.length > 0 && t[t.length - 1]) && (op[0] === 6 || op[0] === 2)) { _ = 0; continue; }
if (op[0] === 3 && (!t || (op[1] > t[0] && op[1] < t[3]))) { _.label = op[1]; break; }
if (op[0] === 6 && _.label < t[1]) { _.label = t[1]; t = op; break; }
if (t && _.label < t[2]) { _.label = t[2]; _.ops.push(op); break; }
if (t[2]) _.ops.pop();
_.trys.pop(); continue;
}
op = body.call(thisArg, _);
} catch (e) { op = [6, e]; y = 0; } finally { f = t = 0; }
if (op[0] & 5) throw op[1]; return { value: op[0] ? op[1] : void 0, done: true };
}
};
var __values = (this && this.__values) || function(o) {
var s = typeof Symbol === "function" && Symbol.iterator, m = s && o[s], i = 0;
if (m) return m.call(o);
if (o && typeof o.length === "number") return {
next: function () {
if (o && i >= o.length) o = void 0;
return { value: o && o[i++], done: !o };
}
};
throw new TypeError(s ? "Object is not iterable." : "Symbol.iterator is not defined.");
};
var __importDefault = (this && this.__importDefault) || function (mod) {
return (mod && mod.__esModule) ? mod : { "default": mod };
};
Object.defineProperty(exports, "__esModule", { value: true });
exports.BriaClientCall = void 0;
var Leaf_1 = __importDefault(require("./Leaf"));
var AnswerCallRequest_1 = __importDefault(require("../requests/AnswerCallRequest"));
var AttendedTransferRequest_1 = __importDefault(require("../requests/AttendedTransferRequest"));
var BlindTransferRequest_1 = __importDefault(require("../requests/BlindTransferRequest"));
var DTMFRequest_1 = __importDefault(require("../requests/DTMFRequest"));
var EndCallRequest_1 = __importDefault(require("../requests/EndCallRequest"));
var HoldCallRequest_1 = __importDefault(require("../requests/HoldCallRequest"));
var MergeCallRequest_1 = __importDefault(require("../requests/MergeCallRequest"));
var PlaceCallRequest_1 = __importDefault(require("../requests/PlaceCallRequest"));
var ResumeCallRequest_1 = __importDefault(require("../requests/ResumeCallRequest"));
var SetCallOptionsRequest_1 = __importDefault(require("../requests/SetCallOptionsRequest"));
var StartCallRecordingRequest_1 = __importDefault(require("../requests/StartCallRecordingRequest"));
var StatusRequest_1 = __importDefault(require("../requests/StatusRequest"));
var StopCallRecordingRequest_1 = __importDefault(require("../requests/StopCallRecordingRequest"));
var BriaCall = /** @class */ (function () {
function BriaCall(client, xml) {
this.participants = [];
this.client = client;
this.update(xml);
}
/**
*
* @param xml
* @returns true if the call was actually updated
*/
BriaCall.prototype.update = function (xml) {
var e_1, _a, e_2, _b, e_3, _c;
this._xml = xml;
var updated = false;
var newObj = {
id: xml.get('id').at(0).getValue(),
holdStatus: xml.get('holdStatus').at(0).getValue(),
recordingStatus: xml.get('recordingStatus').at(0).getValue() === 'recordingInProgress',
recordingFile: xml.get('recordingFile').at(0).getValue(),
};
if (this.id !== newObj.id) {
this.id = newObj.id;
updated = true;
}
if (this.holdStatus !== newObj.holdStatus) {
this.holdStatus = newObj.holdStatus;
updated = true;
}
if (this.recordingStatus !== newObj.recordingStatus) {
this.recordingStatus = newObj.recordingStatus;
updated = true;
}
if (this.recordingFile !== newObj.recordingFile) {
this.recordingFile = newObj.recordingFile;
updated = true;
}
var _participants = xml.get('participants').at(0).get('participant');
var participants = [];
try {
for (var _participants_1 = __values(_participants), _participants_1_1 = _participants_1.next(); !_participants_1_1.done; _participants_1_1 = _participants_1.next()) {
var _party = _participants_1_1.value;
// UNIX timestamp (in seconds)
var timeInitiated = parseInt(_party.get('timeInitiated').at(0).getValue().trim(), 10);
var party = {
number: _party.get('number').at(0).getValue(),
displayName: _party.get('displayName').at(0).getValue(),
state: _party.get('state').at(0).getValue(),
timeInitiated: new Date(timeInitiated * 1000), // * 1000 to milliseconds
};
participants.push(party);
}
}
catch (e_1_1) { e_1 = { error: e_1_1 }; }
finally {
try {
if (_participants_1_1 && !_participants_1_1.done && (_a = _participants_1.return)) _a.call(_participants_1);
}
finally { if (e_1) throw e_1.error; }
}
var _loop_1 = function (party) {
if (!participants.find(function (p) { return p.number === party.number; })) {
// this party does not exist in the Bria call anymore, remove it
var index = this_1.participants.findIndex(function (p) { return p.number === party.number; });
this_1.participants.splice(index, 1);
updated = true;
}
};
var this_1 = this;
try {
for (var _d = __values(this.participants), _e = _d.next(); !_e.done; _e = _d.next()) {
var party = _e.value;
_loop_1(party);
}
}
catch (e_2_1) { e_2 = { error: e_2_1 }; }
finally {
try {
if (_e && !_e.done && (_b = _d.return)) _b.call(_d);
}
finally { if (e_2) throw e_2.error; }
}
var _loop_2 = function (party) {
var index = this_2.participants.findIndex(function (p) { return p.number === party.number; });
if (index !== -1) {
if (this_2.participants[index].number !== party.number) {
this_2.participants[index].number = party.number;
updated = true;
}
if (this_2.participants[index].displayName !== party.displayName) {
this_2.participants[index].displayName = party.displayName;
updated = true;
}
if (this_2.participants[index].state !== party.state) {
this_2.participants[index].state = party.state;
updated = true;
}
if (this_2.participants[index].timeInitiated !== party.timeInitiated) {
this_2.participants[index].timeInitiated = party.timeInitiated;
updated = true;
}
}
else {
this_2.participants.push(party);
}
};
var this_2 = this;
try {
for (var participants_1 = __values(participants), participants_1_1 = participants_1.next(); !participants_1_1.done; participants_1_1 = participants_1.next()) {
var party = participants_1_1.value;
_loop_2(party);
}
}
catch (e_3_1) { e_3 = { error: e_3_1 }; }
finally {
try {
if (participants_1_1 && !participants_1_1.done && (_c = participants_1.return)) _c.call(participants_1);
}
finally { if (e_3) throw e_3.error; }
}
return updated;
};
/**
* Answer a call
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getAnswer
*/
BriaCall.prototype.answer = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.answerCall(this.id)];
});
});
};
/**
* End a call
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getEndCall
*/
BriaCall.prototype.end = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.endCall(this.id)];
});
});
};
/**
* Place call on hold
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getHold
*/
BriaCall.prototype.hold = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.holdCall(this.id)];
});
});
};
/**
* Resume call that was on hold
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getResume
*/
BriaCall.prototype.resume = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.resumeCall(this.id)];
});
});
};
/**
* Request a blind transfer to a number
*
* @param targetNumber
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getTransferCall
*/
BriaCall.prototype.blindTransferToNumber = function (targetNumber) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.blindTransferByNumber(this.id, targetNumber)];
});
});
};
/**
* Request a blind transfer to a BriaCall
*
* @param targetCall
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getTransferCall
*/
BriaCall.prototype.blindTransferToCall = function (targetCall) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.blindTransferByCallId(this.id, targetCall.id)];
});
});
};
/**
* Request an attended transfer
*
* On Bria versions <6.2.0, this call will throw an exception
* @param targetNumber
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#startAttendedTransferCall
*/
BriaCall.prototype.attendedTransfer = function (targetNumber) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.attendedTransfer(this.id, targetNumber)];
});
});
};
/**
* Merge call with all other calls
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#Merge
*/
BriaCall.prototype.merge = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.mergeCall(this.id)];
});
});
};
/**
* Start a call recording
* @param filename Do not include extension, Bria includes it automatically
* @param suppressPopup Show call recording popup when ended
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiRecording.htm#Start
*/
BriaCall.prototype.startRecording = function (filename, suppressPopup) {
if (suppressPopup === void 0) { suppressPopup = false; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.startCallRecording(this.id, filename, suppressPopup)];
});
});
};
/**
* Stop a call recording
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiRecording.htm#Stop
*/
BriaCall.prototype.stopRecording = function () {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.call.stopCallRecording(this.id)];
});
});
};
return BriaCall;
}());
var BriaClientCall = /** @class */ (function (_super) {
__extends(BriaClientCall, _super);
function BriaClientCall(client) {
var _this = _super.call(this, client) || this;
_this.calls = [];
_this.callUpdated = function () { return __awaiter(_this, void 0, void 0, function () {
return __generator(this, function (_a) {
switch (_a.label) {
case 0:
// This emits our events that we need
return [4 /*yield*/, this.populateCalls()];
case 1:
// This emits our events that we need
_a.sent();
return [2 /*return*/];
}
});
}); };
/**
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiEvents.htm#postStatusChangeCallOptions
*/
_this.callOptionsUpdated = function () { return __awaiter(_this, void 0, void 0, function () {
var options;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getCallOptions()];
case 1:
options = _a.sent();
this.options = options;
this.emit('optionsUpdated');
return [2 /*return*/];
}
});
}); };
_this.client
.on('statusChange.callOptions', _this.callOptionsUpdated)
.on('statusChange.call', _this.callUpdated);
return _this;
}
BriaClientCall.prototype.populate = function () {
return __awaiter(this, void 0, void 0, function () {
var options;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.getCallOptions()];
case 1:
options = _a.sent();
this.options = options;
return [4 /*yield*/, this.populateCalls()];
case 2:
_a.sent();
return [2 /*return*/];
}
});
});
};
BriaClientCall.prototype.populateCalls = function () {
return __awaiter(this, void 0, void 0, function () {
var _calls, _loop_3, this_3, _a, _b, call, _loop_4, this_4, _calls_1, _calls_1_1, call;
var e_4, _c, e_5, _d;
return __generator(this, function (_e) {
switch (_e.label) {
case 0: return [4 /*yield*/, this.getCalls()];
case 1:
_calls = _e.sent();
_loop_3 = function (call) {
if (!_calls.find(function (c) { return c.id === call.id; })) {
// this call does not exist anymore, remove it
var index = this_3.calls.findIndex(function (c) { return c.id === call.id; });
this_3.emit('callEnd', this_3.calls[index], call.id);
this_3.calls.splice(index, 1);
}
};
this_3 = this;
try {
for (_a = __values(this.calls), _b = _a.next(); !_b.done; _b = _a.next()) {
call = _b.value;
_loop_3(call);
}
}
catch (e_4_1) { e_4 = { error: e_4_1 }; }
finally {
try {
if (_b && !_b.done && (_c = _a.return)) _c.call(_a);
}
finally { if (e_4) throw e_4.error; }
}
_loop_4 = function (call) {
var index = this_4.calls.findIndex(function (c) { return c.id === call.id; });
if (index !== -1) {
// Call exists, update it
var updated = this_4.calls[index].update(call._xml);
if (updated)
this_4.emit('callUpdate', this_4.calls[index], call.id);
}
else {
// Call doesn't exist, add it
index = this_4.calls.push(call) - 1;
this_4.emit('callStart', this_4.calls[index], call.id);
}
};
this_4 = this;
try {
for (_calls_1 = __values(_calls), _calls_1_1 = _calls_1.next(); !_calls_1_1.done; _calls_1_1 = _calls_1.next()) {
call = _calls_1_1.value;
_loop_4(call);
}
}
catch (e_5_1) { e_5 = { error: e_5_1 }; }
finally {
try {
if (_calls_1_1 && !_calls_1_1.done && (_d = _calls_1.return)) _d.call(_calls_1);
}
finally { if (e_5) throw e_5.error; }
}
return [2 /*return*/];
}
});
});
};
/**
* Get static list of calls
*
* Instead of using this method, you should access client.call.calls,
* this method is used when Bria posts a call update event internally
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getStatusCall
*/
BriaClientCall.prototype.getCalls = function () {
return __awaiter(this, void 0, void 0, function () {
var _callRes, _calls, calls, _calls_2, _calls_2_1, _call;
var e_6, _a;
return __generator(this, function (_b) {
switch (_b.label) {
case 0: return [4 /*yield*/, this.client.sendWait(new StatusRequest_1.default('call'))];
case 1:
_callRes = _b.sent();
if (!_callRes.has('call'))
return [2 /*return*/, []];
_calls = _callRes.get('call');
calls = [];
try {
for (_calls_2 = __values(_calls), _calls_2_1 = _calls_2.next(); !_calls_2_1.done; _calls_2_1 = _calls_2.next()) {
_call = _calls_2_1.value;
calls.push(new BriaCall(this.client, _call));
}
}
catch (e_6_1) { e_6 = { error: e_6_1 }; }
finally {
try {
if (_calls_2_1 && !_calls_2_1.done && (_a = _calls_2.return)) _a.call(_calls_2);
}
finally { if (e_6) throw e_6.error; }
}
return [2 /*return*/, calls];
}
});
});
};
/**
* Place a call
* @param call
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getCall
*/
BriaClientCall.prototype.placeCall = function (call) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new PlaceCallRequest_1.default(call))];
});
});
};
/**
* Answer a call
* @param callId
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getAnswer
*/
BriaClientCall.prototype.answerCall = function (callId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new AnswerCallRequest_1.default(callId))];
});
});
};
/**
* End a call
* @param callId
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getEndCall
*/
BriaClientCall.prototype.endCall = function (callId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new EndCallRequest_1.default(callId))];
});
});
};
/**
* Place call on hold
* @param callId
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getHold
*/
BriaClientCall.prototype.holdCall = function (callId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new HoldCallRequest_1.default(callId))];
});
});
};
/**
* Resume call that was on hold
* @param callId
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getResume
*/
BriaClientCall.prototype.resumeCall = function (callId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new ResumeCallRequest_1.default(callId))];
});
});
};
/**
* Send a DTMF tone to the call recipient
* @param digit
* @param type start/stop
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getDTMF
*/
BriaClientCall.prototype.sendDTMF = function (digit, type) {
return __awaiter(this, void 0, void 0, function () {
var _digit;
return __generator(this, function (_a) {
_digit = digit;
if (typeof digit === 'number') {
if (isNaN(digit) || digit < 0 || digit > 9)
throw new TypeError('"digit" is not a valid DTMFDigit');
_digit = digit.toString();
}
return [2 /*return*/, this.client.sendWait(new DTMFRequest_1.default(_digit, type))];
});
});
};
/**
* Request a blind transfer by number
*
* On Bria versions <6.2.0, both blindTransferByNumber and
* and blindTransferByCallId act functionally identical.
* @param callId
* @param targetNumber
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getTransferCall
*/
BriaClientCall.prototype.blindTransferByNumber = function (callId, targetNumber) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new BlindTransferRequest_1.default(this.client, callId, targetNumber, 'number'))];
});
});
};
/**
* Request a blind transfer by callId
*
* On Bria versions <6.2.0, both blindTransferByNumber and
* and blindTransferByCallId act functionally identical.
* @param callId
* @param targetNumber
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getTransferCall
*/
BriaClientCall.prototype.blindTransferByCallId = function (callId, targetCallId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new BlindTransferRequest_1.default(this.client, callId, targetCallId, 'callId'))];
});
});
};
/**
* Request an attended transfer
*
* On Bria versions <6.2.0 this call will throw an exception
* @param callId
* @param target
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#startAttendedTransferCall
*/
BriaClientCall.prototype.attendedTransfer = function (callId, target) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (this.client.versionLt('6.2.0'))
throw new Error('Bria client does not support call (version out-of-date)');
return [2 /*return*/, this.client.sendWait(new AttendedTransferRequest_1.default(callId, target))];
});
});
};
/**
* Merge calls into local conference
*
* This call will not provide any error if call ID is invalid
* @param callId This call should not be on hold.
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#Merge
*/
BriaClientCall.prototype.mergeCall = function (callId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
if (this.client.versionLt('6.3.0'))
throw new Error('Bria client does not support call (version out-of-date)');
return [2 /*return*/, this.client.sendWait(new MergeCallRequest_1.default(callId))];
});
});
};
/**
* Get call options
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getStatusCallOptions
*/
BriaClientCall.prototype.getCallOptions = function () {
return __awaiter(this, void 0, void 0, function () {
var _options, options;
return __generator(this, function (_a) {
switch (_a.label) {
case 0: return [4 /*yield*/, this.client.sendWait(new StatusRequest_1.default('callOptions'))];
case 1:
_options = _a.sent();
options = {
anonymous: _options.get('anonymous').at(0).getValue() === 'enabled',
lettersToNumbers: _options.get('lettersToNumbers').at(0).getValue() === 'enabled',
autoAnswer: _options.get('autoAnswer').at(0).getValue() === 'enabled',
callWaiting: _options.get('callWaiting').at(0).getValue() === 'enabled',
};
return [2 /*return*/, options];
}
});
});
};
/**
* Set call options
* @param options Partial call options
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiHandlingCalls.htm#getCallOptions
*/
BriaClientCall.prototype.setCallOptions = function (options) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new SetCallOptionsRequest_1.default(options))];
});
});
};
/**
* Start a call recording
* @param callId
* @param filename Do not include extension, Bria includes it automatically
* @param suppressPopup Show call recording popup when ended
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiRecording.htm#Start
*/
BriaClientCall.prototype.startCallRecording = function (callId, filename, suppressPopup) {
if (suppressPopup === void 0) { suppressPopup = false; }
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new StartCallRecordingRequest_1.default(callId, filename, suppressPopup))];
});
});
};
/**
* Stop a call recording
* @param callId If null, call recording is stopped for the current live call
* @see https://docs.counterpath.com/guides/desk/desk_api/clients/deskAPI/deskApiRecording.htm#Stop
*/
BriaClientCall.prototype.stopCallRecording = function (callId) {
return __awaiter(this, void 0, void 0, function () {
return __generator(this, function (_a) {
return [2 /*return*/, this.client.sendWait(new StopCallRecordingRequest_1.default(callId))];
});
});
};
return BriaClientCall;
}(Leaf_1.default));
exports.BriaClientCall = BriaClientCall;
//# sourceMappingURL=Call.js.map