1 // *************************************************************************
3 // * xCALLY Motion - The Omnichannel Contact Center *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved *
6 // *************************************************************************
8 // * Email: info@xcally.com *
9 // * Website: https://www.xcally.com *
11 // *************************************************************************
13 // * The SOFTWARE PRODUCT is protected by copyright laws and international *
14 // * copyright treaties, as well as other intellectual property laws and *
15 // * treaties. The SOFTWARE PRODUCT is licensed, not sold. *
17 // *************************************************************************
18 var _0x2199=['http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','raw','debug','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise'];(function(_0x321bb2,_0x202794){var _0x9c12ed=function(_0x263dd3){while(--_0x263dd3){_0x321bb2['push'](_0x321bb2['shift']());}};_0x9c12ed(++_0x202794);}(_0x2199,0x13b));var _0x9219=function(_0xddbe80,_0x214d6b){_0xddbe80=_0xddbe80-0x0;var _0x9dc743=_0x2199[_0xddbe80];return _0x9dc743;};'use strict';var _=require('lodash');var util=require(_0x9219('0x0'));var moment=require(_0x9219('0x1'));var BPromise=require(_0x9219('0x2'));var rs=require(_0x9219('0x3'));var fs=require('fs');var Redis=require(_0x9219('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x9219('0x5'));var logger=require(_0x9219('0x6'))(_0x9219('0x7'));var config=require('../../config/environment');var jayson=require(_0x9219('0x8'));var client=jayson['client'][_0x9219('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x87e351,_0x4b3763,_0x2dbf72){return new BPromise(function(_0x20da62,_0x4ceddb){return client[_0x9219('0xa')](_0x87e351,_0x2dbf72)[_0x9219('0xb')](function(_0x2ecf3f){logger[_0x9219('0xc')](_0x9219('0xd'),_0x4b3763,_0x9219('0xe'));logger['debug'](_0x9219('0xf'),_0x4b3763,'request\x20sent',JSON[_0x9219('0x10')](_0x2ecf3f));if(_0x2ecf3f[_0x9219('0x11')]){if(_0x2ecf3f['error'][_0x9219('0x12')]===0x1f4){logger[_0x9219('0x11')](_0x9219('0xd'),_0x4b3763,_0x2ecf3f['error'][_0x9219('0x13')]);return _0x4ceddb(_0x2ecf3f['error'][_0x9219('0x13')]);}logger[_0x9219('0x11')]('SquareRecording,\x20%s,\x20%s',_0x4b3763,_0x2ecf3f[_0x9219('0x11')]['message']);return _0x20da62(_0x2ecf3f['error']['message']);}else{logger['info'](_0x9219('0xd'),_0x4b3763,'request\x20sent');_0x20da62(_0x2ecf3f['result'][_0x9219('0x13')]);}})[_0x9219('0x14')](function(_0x5a506b){logger[_0x9219('0x11')](_0x9219('0xd'),_0x4b3763,_0x5a506b);_0x4ceddb(_0x5a506b);});});}exports[_0x9219('0x15')]=function(_0x4283bf){var _0x105a80=this;return new Promise(function(_0x30cca3,_0x4e8e07){return db[_0x9219('0x16')][_0x9219('0x17')](_0x4283bf[_0x9219('0x18')],{'raw':_0x4283bf['options']?_0x4283bf['options'][_0x9219('0x19')]===undefined?!![]:![]:!![]})[_0x9219('0xb')](function(_0x5ba506){logger[_0x9219('0xc')](_0x9219('0x15'),_0x4283bf);logger[_0x9219('0x1a')]('CreateSquareRecording',_0x4283bf,JSON[_0x9219('0x10')](_0x5ba506));_0x30cca3(_0x5ba506);})[_0x9219('0x14')](function(_0x129263){logger['error'](_0x9219('0x15'),_0x129263[_0x9219('0x13')],_0x4283bf);_0x4e8e07(_0x105a80[_0x9219('0x11')](0x1f4,_0x129263[_0x9219('0x13')]));});});};