6060381b022b53ba9921ecaab1e9b4f5846a13dc
[motion2.git] / server / api / jscriptyProject / jscriptyProject.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 _0xbc1f=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','request','then','info','request\x20sent','JscriptyProject,\x20%s,\x20%s,\x20%s','stringify','error','code','message','JscriptyProject,\x20%s,\x20%s','result','catch'];(function(_0x32dc2f,_0x427b7e){var _0x59da9a=function(_0x4de4a5){while(--_0x4de4a5){_0x32dc2f['push'](_0x32dc2f['shift']());}};_0x59da9a(++_0x427b7e);}(_0xbc1f,0x18f));var _0xfbc1=function(_0x426ffd,_0x26644e){_0x426ffd=_0x426ffd-0x0;var _0x505173=_0xbc1f[_0x426ffd];return _0x505173;};'use strict';var _=require('lodash');var util=require(_0xfbc1('0x0'));var moment=require(_0xfbc1('0x1'));var BPromise=require(_0xfbc1('0x2'));var rs=require(_0xfbc1('0x3'));var fs=require('fs');var Redis=require(_0xfbc1('0x4'));var db=require(_0xfbc1('0x5'))['db'];var utils=require(_0xfbc1('0x6'));var logger=require(_0xfbc1('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xfbc1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4a28e0,_0x4cf0f7,_0x1603b8){return new BPromise(function(_0x5fcda8,_0x404de0){return client[_0xfbc1('0x9')](_0x4a28e0,_0x1603b8)[_0xfbc1('0xa')](function(_0x2a8369){logger[_0xfbc1('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0xfbc1('0xc'));logger['debug'](_0xfbc1('0xd'),_0x4cf0f7,'request\x20sent',JSON[_0xfbc1('0xe')](_0x2a8369));if(_0x2a8369['error']){if(_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x10')]===0x1f4){logger[_0xfbc1('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);return _0x404de0(_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);}logger[_0xfbc1('0xf')](_0xfbc1('0x12'),_0x4cf0f7,_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);return _0x5fcda8(_0x2a8369[_0xfbc1('0xf')][_0xfbc1('0x11')]);}else{logger[_0xfbc1('0xb')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0xfbc1('0xc'));_0x5fcda8(_0x2a8369[_0xfbc1('0x13')][_0xfbc1('0x11')]);}})[_0xfbc1('0x14')](function(_0x23a7fb){logger[_0xfbc1('0xf')]('JscriptyProject,\x20%s,\x20%s',_0x4cf0f7,_0x23a7fb);_0x404de0(_0x23a7fb);});});}