Built motion from commit (unavailable).|2.2.6
[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 _0x3522=['moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','error','message','info','result','catch','CreateSquareRecording','create','body','stringify','lodash','util'];(function(_0x3c4856,_0x98f049){var _0xba2cac=function(_0x16fedc){while(--_0x16fedc){_0x3c4856['push'](_0x3c4856['shift']());}};_0xba2cac(++_0x98f049);}(_0x3522,0x1d2));var _0x2352=function(_0x1c05cb,_0x152df1){_0x1c05cb=_0x1c05cb-0x0;var _0x55c147=_0x3522[_0x1c05cb];return _0x55c147;};'use strict';var _=require(_0x2352('0x0'));var util=require(_0x2352('0x1'));var moment=require(_0x2352('0x2'));var BPromise=require(_0x2352('0x3'));var rs=require(_0x2352('0x4'));var fs=require('fs');var Redis=require(_0x2352('0x5'));var db=require(_0x2352('0x6'))['db'];var utils=require(_0x2352('0x7'));var logger=require('../../config/logger')(_0x2352('0x8'));var config=require(_0x2352('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0x2352('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x43b64d,_0x3d7b9c,_0x2951bb){return new BPromise(function(_0x8ba765,_0x56b405){return client[_0x2352('0xb')](_0x43b64d,_0x2951bb)[_0x2352('0xc')](function(_0x471b17){logger['info'](_0x2352('0xd'),_0x3d7b9c,_0x2352('0xe'));logger[_0x2352('0xf')](_0x2352('0x10'),_0x3d7b9c,_0x2352('0xe'),JSON['stringify'](_0x471b17));if(_0x471b17['error']){if(_0x471b17[_0x2352('0x11')]['code']===0x1f4){logger[_0x2352('0x11')](_0x2352('0xd'),_0x3d7b9c,_0x471b17[_0x2352('0x11')][_0x2352('0x12')]);return _0x56b405(_0x471b17[_0x2352('0x11')][_0x2352('0x12')]);}logger[_0x2352('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3d7b9c,_0x471b17[_0x2352('0x11')][_0x2352('0x12')]);return _0x8ba765(_0x471b17['error'][_0x2352('0x12')]);}else{logger[_0x2352('0x13')](_0x2352('0xd'),_0x3d7b9c,_0x2352('0xe'));_0x8ba765(_0x471b17[_0x2352('0x14')][_0x2352('0x12')]);}})[_0x2352('0x15')](function(_0x3014a8){logger[_0x2352('0x11')]('SquareRecording,\x20%s,\x20%s',_0x3d7b9c,_0x3014a8);_0x56b405(_0x3014a8);});});}exports[_0x2352('0x16')]=function(_0x4329f9){var _0x52f78a=this;return new Promise(function(_0x229a5c,_0x4fd385){return db['SquareRecording'][_0x2352('0x17')](_0x4329f9[_0x2352('0x18')],{'raw':_0x4329f9['options']?_0x4329f9['options']['raw']===undefined?!![]:![]:!![]})[_0x2352('0xc')](function(_0xa269a){logger[_0x2352('0x13')](_0x2352('0x16'),_0x4329f9);logger['debug'](_0x2352('0x16'),_0x4329f9,JSON[_0x2352('0x19')](_0xa269a));_0x229a5c(_0xa269a);})['catch'](function(_0x323ecf){logger[_0x2352('0x11')]('CreateSquareRecording',_0x323ecf[_0x2352('0x12')],_0x4329f9);_0x4fd385(_0x52f78a['error'](0x1f4,_0x323ecf[_0x2352('0x12')]));});});};