Built motion from commit (unavailable).|2.5.7
[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 _0x30b7=['request\x20sent','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','code','message','CreateSquareRecording','create','body','options','raw','debug','catch','util','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s'];(function(_0x4e02a2,_0xda965b){var _0xef9b03=function(_0xa0f5f2){while(--_0xa0f5f2){_0x4e02a2['push'](_0x4e02a2['shift']());}};_0xef9b03(++_0xda965b);}(_0x30b7,0xe5));var _0x730b=function(_0x23376a,_0x1fea7b){_0x23376a=_0x23376a-0x0;var _0x267ec3=_0x30b7[_0x23376a];return _0x267ec3;};'use strict';var _=require('lodash');var util=require(_0x730b('0x0'));var moment=require('moment');var BPromise=require(_0x730b('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x730b('0x2'));var db=require(_0x730b('0x3'))['db'];var utils=require(_0x730b('0x4'));var logger=require(_0x730b('0x5'))(_0x730b('0x6'));var config=require(_0x730b('0x7'));var jayson=require(_0x730b('0x8'));var client=jayson[_0x730b('0x9')][_0x730b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x558309,_0x3a9ab3,_0x4e0ebb){return new BPromise(function(_0xf2f30e,_0x5d1be0){return client[_0x730b('0xb')](_0x558309,_0x4e0ebb)['then'](function(_0x3588e7){logger[_0x730b('0xc')](_0x730b('0xd'),_0x3a9ab3,_0x730b('0xe'));logger['debug'](_0x730b('0xf'),_0x3a9ab3,_0x730b('0xe'),JSON[_0x730b('0x10')](_0x3588e7));if(_0x3588e7[_0x730b('0x11')]){if(_0x3588e7[_0x730b('0x11')][_0x730b('0x12')]===0x1f4){logger[_0x730b('0x11')](_0x730b('0xd'),_0x3a9ab3,_0x3588e7[_0x730b('0x11')][_0x730b('0x13')]);return _0x5d1be0(_0x3588e7['error']['message']);}logger[_0x730b('0x11')](_0x730b('0xd'),_0x3a9ab3,_0x3588e7['error'][_0x730b('0x13')]);return _0xf2f30e(_0x3588e7[_0x730b('0x11')][_0x730b('0x13')]);}else{logger[_0x730b('0xc')](_0x730b('0xd'),_0x3a9ab3,_0x730b('0xe'));_0xf2f30e(_0x3588e7['result'][_0x730b('0x13')]);}})['catch'](function(_0x2923d4){logger['error'](_0x730b('0xd'),_0x3a9ab3,_0x2923d4);_0x5d1be0(_0x2923d4);});});}exports[_0x730b('0x14')]=function(_0x19e049){var _0x3e1143=this;return new Promise(function(_0x5270db,_0x14c2da){return db['SquareRecording'][_0x730b('0x15')](_0x19e049[_0x730b('0x16')],{'raw':_0x19e049[_0x730b('0x17')]?_0x19e049[_0x730b('0x17')][_0x730b('0x18')]===undefined?!![]:![]:!![]})['then'](function(_0x5b219a){logger[_0x730b('0xc')](_0x730b('0x14'),_0x19e049);logger[_0x730b('0x19')](_0x730b('0x14'),_0x19e049,JSON['stringify'](_0x5b219a));_0x5270db(_0x5b219a);})[_0x730b('0x1a')](function(_0x4e56f3){logger[_0x730b('0x11')](_0x730b('0x14'),_0x4e56f3[_0x730b('0x13')],_0x19e049);_0x14c2da(_0x3e1143[_0x730b('0x11')](0x1f4,_0x4e56f3[_0x730b('0x13')]));});});};