Built motion from commit (unavailable).|2.5.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 _0x121d=['stringify','error','message','result','catch','SquareRecording','create','body','options','raw','then','CreateSquareRecording','moment','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','request','info','SquareRecording,\x20%s,\x20%s','debug','SquareRecording,\x20%s,\x20%s,\x20%s','request\x20sent'];(function(_0x298d5a,_0x389846){var _0x320661=function(_0x2da588){while(--_0x2da588){_0x298d5a['push'](_0x298d5a['shift']());}};_0x320661(++_0x389846);}(_0x121d,0x1ce));var _0xd121=function(_0x4d3a94,_0xa86dda){_0x4d3a94=_0x4d3a94-0x0;var _0x46aa90=_0x121d[_0x4d3a94];return _0x46aa90;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0xd121('0x0'));var BPromise=require('bluebird');var rs=require(_0xd121('0x1'));var fs=require('fs');var Redis=require(_0xd121('0x2'));var db=require(_0xd121('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0xd121('0x4'));var config=require(_0xd121('0x5'));var jayson=require(_0xd121('0x6'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x612d15,_0x161595,_0x37c70a){return new BPromise(function(_0x514c27,_0x3e00ed){return client[_0xd121('0x7')](_0x612d15,_0x37c70a)['then'](function(_0xdbddff){logger[_0xd121('0x8')](_0xd121('0x9'),_0x161595,'request\x20sent');logger[_0xd121('0xa')](_0xd121('0xb'),_0x161595,_0xd121('0xc'),JSON[_0xd121('0xd')](_0xdbddff));if(_0xdbddff[_0xd121('0xe')]){if(_0xdbddff['error']['code']===0x1f4){logger[_0xd121('0xe')](_0xd121('0x9'),_0x161595,_0xdbddff[_0xd121('0xe')]['message']);return _0x3e00ed(_0xdbddff['error'][_0xd121('0xf')]);}logger[_0xd121('0xe')](_0xd121('0x9'),_0x161595,_0xdbddff[_0xd121('0xe')][_0xd121('0xf')]);return _0x514c27(_0xdbddff[_0xd121('0xe')][_0xd121('0xf')]);}else{logger[_0xd121('0x8')](_0xd121('0x9'),_0x161595,_0xd121('0xc'));_0x514c27(_0xdbddff[_0xd121('0x10')]['message']);}})[_0xd121('0x11')](function(_0xd1e404){logger[_0xd121('0xe')](_0xd121('0x9'),_0x161595,_0xd1e404);_0x3e00ed(_0xd1e404);});});}exports['CreateSquareRecording']=function(_0x30b20e){var _0x38f2b8=this;return new Promise(function(_0x4a22bd,_0x4b457a){return db[_0xd121('0x12')][_0xd121('0x13')](_0x30b20e[_0xd121('0x14')],{'raw':_0x30b20e[_0xd121('0x15')]?_0x30b20e[_0xd121('0x15')][_0xd121('0x16')]===undefined?!![]:![]:!![]})[_0xd121('0x17')](function(_0x1f9097){logger[_0xd121('0x8')](_0xd121('0x18'),_0x30b20e);logger[_0xd121('0xa')](_0xd121('0x18'),_0x30b20e,JSON[_0xd121('0xd')](_0x1f9097));_0x4a22bd(_0x1f9097);})[_0xd121('0x11')](function(_0x4b7f34){logger['error'](_0xd121('0x18'),_0x4b7f34[_0xd121('0xf')],_0x30b20e);_0x4b457a(_0x38f2b8[_0xd121('0xe')](0x1f4,_0x4b7f34['message']));});});};