Built motion from commit (unavailable).|2.5.26
[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 _0x98b4=['jayson/promise','request','then','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','CreateSquareRecording','create','body','options','raw','stringify','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment'];(function(_0x4716b9,_0x3d1435){var _0x472146=function(_0x3b9c55){while(--_0x3b9c55){_0x4716b9['push'](_0x4716b9['shift']());}};_0x472146(++_0x3d1435);}(_0x98b4,0x18b));var _0x498b=function(_0x25d386,_0x108d0d){_0x25d386=_0x25d386-0x0;var _0x857f4a=_0x98b4[_0x25d386];return _0x857f4a;};'use strict';var _=require(_0x498b('0x0'));var util=require(_0x498b('0x1'));var moment=require(_0x498b('0x2'));var BPromise=require(_0x498b('0x3'));var rs=require(_0x498b('0x4'));var fs=require('fs');var Redis=require(_0x498b('0x5'));var db=require(_0x498b('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x498b('0x7'))(_0x498b('0x8'));var config=require(_0x498b('0x9'));var jayson=require(_0x498b('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x52d7e8,_0x1235ba,_0x5602c8){return new BPromise(function(_0x321a76,_0x4cb5fe){return client[_0x498b('0xb')](_0x52d7e8,_0x5602c8)[_0x498b('0xc')](function(_0x2514cc){logger['info'](_0x498b('0xd'),_0x1235ba,_0x498b('0xe'));logger[_0x498b('0xf')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x1235ba,_0x498b('0xe'),JSON['stringify'](_0x2514cc));if(_0x2514cc[_0x498b('0x10')]){if(_0x2514cc['error'][_0x498b('0x11')]===0x1f4){logger['error'](_0x498b('0xd'),_0x1235ba,_0x2514cc['error']['message']);return _0x4cb5fe(_0x2514cc[_0x498b('0x10')]['message']);}logger[_0x498b('0x10')](_0x498b('0xd'),_0x1235ba,_0x2514cc[_0x498b('0x10')][_0x498b('0x12')]);return _0x321a76(_0x2514cc[_0x498b('0x10')]['message']);}else{logger[_0x498b('0x13')](_0x498b('0xd'),_0x1235ba,_0x498b('0xe'));_0x321a76(_0x2514cc[_0x498b('0x14')][_0x498b('0x12')]);}})['catch'](function(_0x35b2a0){logger['error'](_0x498b('0xd'),_0x1235ba,_0x35b2a0);_0x4cb5fe(_0x35b2a0);});});}exports[_0x498b('0x15')]=function(_0xa49daa){var _0x5bdee4=this;return new Promise(function(_0x4ab931,_0x34f906){return db['SquareRecording'][_0x498b('0x16')](_0xa49daa[_0x498b('0x17')],{'raw':_0xa49daa[_0x498b('0x18')]?_0xa49daa[_0x498b('0x18')][_0x498b('0x19')]===undefined?!![]:![]:!![]})[_0x498b('0xc')](function(_0x15967f){logger[_0x498b('0x13')](_0x498b('0x15'),_0xa49daa);logger['debug'](_0x498b('0x15'),_0xa49daa,JSON[_0x498b('0x1a')](_0x15967f));_0x4ab931(_0x15967f);})['catch'](function(_0x5b4161){logger['error'](_0x498b('0x15'),_0x5b4161[_0x498b('0x12')],_0xa49daa);_0x34f906(_0x5bdee4[_0x498b('0x10')](0x1f4,_0x5b4161[_0x498b('0x12')]));});});};