Built motion from commit e38a297d.|2.6.18
[motion2.git] / server / api / condition / condition.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 _0x9b85=['request','then','info','Condition,\x20%s,\x20%s','debug','request\x20sent','stringify','error','code','message','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','client','http'];(function(_0x293096,_0x309098){var _0x1caea4=function(_0x185e2a){while(--_0x185e2a){_0x293096['push'](_0x293096['shift']());}};_0x1caea4(++_0x309098);}(_0x9b85,0xd3));var _0x59b8=function(_0x432682,_0x253044){_0x432682=_0x432682-0x0;var _0x463d05=_0x9b85[_0x432682];return _0x463d05;};'use strict';var _=require(_0x59b8('0x0'));var util=require(_0x59b8('0x1'));var moment=require(_0x59b8('0x2'));var BPromise=require(_0x59b8('0x3'));var rs=require(_0x59b8('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x59b8('0x5'))['db'];var utils=require(_0x59b8('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x59b8('0x7')][_0x59b8('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x3c2781,_0x55e1cd,_0x29daac){return new BPromise(function(_0x53b292,_0x35be6b){return client[_0x59b8('0x9')](_0x3c2781,_0x29daac)[_0x59b8('0xa')](function(_0x2e4177){logger[_0x59b8('0xb')](_0x59b8('0xc'),_0x55e1cd,'request\x20sent');logger[_0x59b8('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x55e1cd,_0x59b8('0xe'),JSON[_0x59b8('0xf')](_0x2e4177));if(_0x2e4177[_0x59b8('0x10')]){if(_0x2e4177[_0x59b8('0x10')][_0x59b8('0x11')]===0x1f4){logger[_0x59b8('0x10')]('Condition,\x20%s,\x20%s',_0x55e1cd,_0x2e4177[_0x59b8('0x10')][_0x59b8('0x12')]);return _0x35be6b(_0x2e4177[_0x59b8('0x10')][_0x59b8('0x12')]);}logger[_0x59b8('0x10')](_0x59b8('0xc'),_0x55e1cd,_0x2e4177[_0x59b8('0x10')][_0x59b8('0x12')]);return _0x53b292(_0x2e4177['error'][_0x59b8('0x12')]);}else{logger[_0x59b8('0xb')](_0x59b8('0xc'),_0x55e1cd,_0x59b8('0xe'));_0x53b292(_0x2e4177[_0x59b8('0x13')][_0x59b8('0x12')]);}})['catch'](function(_0x1b58b7){logger[_0x59b8('0x10')](_0x59b8('0xc'),_0x55e1cd,_0x1b58b7);_0x35be6b(_0x1b58b7);});});}