Built motion from commit 47436d59.|2.6.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 _0x83c0=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','CreateSquareRecording','create','body','options','raw','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x56311e,_0x5611db){var _0x5de8d7=function(_0x93c25b){while(--_0x93c25b){_0x56311e['push'](_0x56311e['shift']());}};_0x5de8d7(++_0x5611db);}(_0x83c0,0x1d6));var _0x083c=function(_0x26d2c6,_0x4e35bc){_0x26d2c6=_0x26d2c6-0x0;var _0x3dd976=_0x83c0[_0x26d2c6];return _0x3dd976;};'use strict';var _=require(_0x083c('0x0'));var util=require('util');var moment=require(_0x083c('0x1'));var BPromise=require(_0x083c('0x2'));var rs=require(_0x083c('0x3'));var fs=require('fs');var Redis=require(_0x083c('0x4'));var db=require(_0x083c('0x5'))['db'];var utils=require(_0x083c('0x6'));var logger=require(_0x083c('0x7'))(_0x083c('0x8'));var config=require(_0x083c('0x9'));var jayson=require(_0x083c('0xa'));var client=jayson[_0x083c('0xb')][_0x083c('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x2e2fec,_0x689ac8,_0x331407){return new BPromise(function(_0x42302d,_0x3c8426){return client[_0x083c('0xd')](_0x2e2fec,_0x331407)[_0x083c('0xe')](function(_0x170fb8){logger[_0x083c('0xf')](_0x083c('0x10'),_0x689ac8,_0x083c('0x11'));logger[_0x083c('0x12')]('SquareRecording,\x20%s,\x20%s,\x20%s',_0x689ac8,_0x083c('0x11'),JSON[_0x083c('0x13')](_0x170fb8));if(_0x170fb8[_0x083c('0x14')]){if(_0x170fb8[_0x083c('0x14')][_0x083c('0x15')]===0x1f4){logger[_0x083c('0x14')](_0x083c('0x10'),_0x689ac8,_0x170fb8[_0x083c('0x14')][_0x083c('0x16')]);return _0x3c8426(_0x170fb8['error'][_0x083c('0x16')]);}logger[_0x083c('0x14')](_0x083c('0x10'),_0x689ac8,_0x170fb8['error'][_0x083c('0x16')]);return _0x42302d(_0x170fb8[_0x083c('0x14')]['message']);}else{logger[_0x083c('0xf')](_0x083c('0x10'),_0x689ac8,_0x083c('0x11'));_0x42302d(_0x170fb8['result'][_0x083c('0x16')]);}})['catch'](function(_0x5a1f2d){logger[_0x083c('0x14')](_0x083c('0x10'),_0x689ac8,_0x5a1f2d);_0x3c8426(_0x5a1f2d);});});}exports[_0x083c('0x17')]=function(_0x36cf20){var _0x4536e9=this;return new Promise(function(_0x3d6123,_0x4003af){return db['SquareRecording'][_0x083c('0x18')](_0x36cf20[_0x083c('0x19')],{'raw':_0x36cf20[_0x083c('0x1a')]?_0x36cf20['options'][_0x083c('0x1b')]===undefined?!![]:![]:!![]})['then'](function(_0x1b87d5){logger[_0x083c('0xf')](_0x083c('0x17'),_0x36cf20);logger[_0x083c('0x12')](_0x083c('0x17'),_0x36cf20,JSON[_0x083c('0x13')](_0x1b87d5));_0x3d6123(_0x1b87d5);})['catch'](function(_0x5539d8){logger['error'](_0x083c('0x17'),_0x5539d8[_0x083c('0x16')],_0x36cf20);_0x4003af(_0x4536e9['error'](0x1f4,_0x5539d8[_0x083c('0x16')]));});});};