Built motion from commit d1eab355.|2.6.28
[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 _0x6993=['../../config/environment','jayson/promise','client','http','request','info','SquareRecording,\x20%s,\x20%s','request\x20sent','debug','SquareRecording,\x20%s,\x20%s,\x20%s','stringify','error','message','CreateSquareRecording','create','body','options','then','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x2d5638,_0x48a18a){var _0x1960bd=function(_0x54ae0d){while(--_0x54ae0d){_0x2d5638['push'](_0x2d5638['shift']());}};_0x1960bd(++_0x48a18a);}(_0x6993,0x8f));var _0x3699=function(_0x3cb530,_0x170e8c){_0x3cb530=_0x3cb530-0x0;var _0x4168ea=_0x6993[_0x3cb530];return _0x4168ea;};'use strict';var _=require(_0x3699('0x0'));var util=require('util');var moment=require(_0x3699('0x1'));var BPromise=require(_0x3699('0x2'));var rs=require(_0x3699('0x3'));var fs=require('fs');var Redis=require(_0x3699('0x4'));var db=require(_0x3699('0x5'))['db'];var utils=require(_0x3699('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x3699('0x7'));var jayson=require(_0x3699('0x8'));var client=jayson[_0x3699('0x9')][_0x3699('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2b3a2c,_0x216ce7,_0x5e1c82){return new BPromise(function(_0x4334f9,_0x16dce9){return client[_0x3699('0xb')](_0x2b3a2c,_0x5e1c82)['then'](function(_0x5db459){logger[_0x3699('0xc')](_0x3699('0xd'),_0x216ce7,_0x3699('0xe'));logger[_0x3699('0xf')](_0x3699('0x10'),_0x216ce7,_0x3699('0xe'),JSON[_0x3699('0x11')](_0x5db459));if(_0x5db459[_0x3699('0x12')]){if(_0x5db459['error']['code']===0x1f4){logger[_0x3699('0x12')](_0x3699('0xd'),_0x216ce7,_0x5db459['error'][_0x3699('0x13')]);return _0x16dce9(_0x5db459[_0x3699('0x12')][_0x3699('0x13')]);}logger[_0x3699('0x12')]('SquareRecording,\x20%s,\x20%s',_0x216ce7,_0x5db459[_0x3699('0x12')][_0x3699('0x13')]);return _0x4334f9(_0x5db459['error'][_0x3699('0x13')]);}else{logger['info'](_0x3699('0xd'),_0x216ce7,_0x3699('0xe'));_0x4334f9(_0x5db459['result'][_0x3699('0x13')]);}})['catch'](function(_0x29252b){logger[_0x3699('0x12')](_0x3699('0xd'),_0x216ce7,_0x29252b);_0x16dce9(_0x29252b);});});}exports[_0x3699('0x14')]=function(_0x37a4fc){var _0x12f6d8=this;return new Promise(function(_0x361d7a,_0x260e65){return db['SquareRecording'][_0x3699('0x15')](_0x37a4fc[_0x3699('0x16')],{'raw':_0x37a4fc['options']?_0x37a4fc[_0x3699('0x17')]['raw']===undefined?!![]:![]:!![]})[_0x3699('0x18')](function(_0x2e0274){logger[_0x3699('0xc')](_0x3699('0x14'),_0x37a4fc);logger[_0x3699('0xf')](_0x3699('0x14'),_0x37a4fc,JSON[_0x3699('0x11')](_0x2e0274));_0x361d7a(_0x2e0274);})['catch'](function(_0x483317){logger[_0x3699('0x12')]('CreateSquareRecording',_0x483317[_0x3699('0x13')],_0x37a4fc);_0x260e65(_0x12f6d8['error'](0x1f4,_0x483317[_0x3699('0x13')]));});});};