Built motion from commit 3c2ce842.|2.6.31
[motion2.git] / server / api / squareRecording / squareRecording.rpc.js
1 // *************************************************************************
2 // *                                                                       *
3 // * xCALLY Motion -  The Omnichannel Contact Center                       *
4 // * Copyright (c) Xenialab s.r.l. All Rights Reserved                     *
5 // *                                                                       *
6 // *************************************************************************
7 // *                                                                       *
8 // * Email: info@xcally.com                                                *
9 // * Website: https://www.xcally.com                                       *
10 // *                                                                       *
11 // *************************************************************************
12 // *                                                                       *
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.                         *
16 // *                                                                       *
17 // *************************************************************************
18 var _0x5955=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','CreateSquareRecording','SquareRecording','create','body','options','raw','lodash','util','moment','bluebird','randomstring','../../mysqldb'];(function(_0x1af013,_0x1b5d19){var _0x31532f=function(_0xdb965d){while(--_0xdb965d){_0x1af013['push'](_0x1af013['shift']());}};_0x31532f(++_0x1b5d19);}(_0x5955,0x182));var _0x5595=function(_0x4bed75,_0x211cc7){_0x4bed75=_0x4bed75-0x0;var _0x2dd8e8=_0x5955[_0x4bed75];return _0x2dd8e8;};'use strict';var _=require(_0x5595('0x0'));var util=require(_0x5595('0x1'));var moment=require(_0x5595('0x2'));var BPromise=require(_0x5595('0x3'));var rs=require(_0x5595('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x5595('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5595('0x6'))('rpc');var config=require(_0x5595('0x7'));var jayson=require(_0x5595('0x8'));var client=jayson[_0x5595('0x9')][_0x5595('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2aed61,_0x535c7e,_0x146fb5){return new BPromise(function(_0x3414ad,_0x4304b5){return client[_0x5595('0xb')](_0x2aed61,_0x146fb5)[_0x5595('0xc')](function(_0x248580){logger[_0x5595('0xd')](_0x5595('0xe'),_0x535c7e,_0x5595('0xf'));logger[_0x5595('0x10')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x535c7e,'request\x20sent',JSON[_0x5595('0x11')](_0x248580));if(_0x248580[_0x5595('0x12')]){if(_0x248580[_0x5595('0x12')][_0x5595('0x13')]===0x1f4){logger[_0x5595('0x12')](_0x5595('0xe'),_0x535c7e,_0x248580[_0x5595('0x12')][_0x5595('0x14')]);return _0x4304b5(_0x248580[_0x5595('0x12')][_0x5595('0x14')]);}logger['error'](_0x5595('0xe'),_0x535c7e,_0x248580[_0x5595('0x12')][_0x5595('0x14')]);return _0x3414ad(_0x248580['error'][_0x5595('0x14')]);}else{logger[_0x5595('0xd')]('SquareRecording,\x20%s,\x20%s',_0x535c7e,_0x5595('0xf'));_0x3414ad(_0x248580['result']['message']);}})[_0x5595('0x15')](function(_0x1a3a28){logger[_0x5595('0x12')](_0x5595('0xe'),_0x535c7e,_0x1a3a28);_0x4304b5(_0x1a3a28);});});}exports[_0x5595('0x16')]=function(_0x3caa78){var _0x5bc6f5=this;return new Promise(function(_0xfde3dc,_0x58b794){return db[_0x5595('0x17')][_0x5595('0x18')](_0x3caa78[_0x5595('0x19')],{'raw':_0x3caa78['options']?_0x3caa78[_0x5595('0x1a')][_0x5595('0x1b')]===undefined?!![]:![]:!![]})[_0x5595('0xc')](function(_0x41d43c){logger[_0x5595('0xd')]('CreateSquareRecording',_0x3caa78);logger[_0x5595('0x10')](_0x5595('0x16'),_0x3caa78,JSON[_0x5595('0x11')](_0x41d43c));_0xfde3dc(_0x41d43c);})[_0x5595('0x15')](function(_0x534347){logger['error']('CreateSquareRecording',_0x534347[_0x5595('0x14')],_0x3caa78);_0x58b794(_0x5bc6f5[_0x5595('0x12')](0x1f4,_0x534347[_0x5595('0x14')]));});});};