Built motion from commit ae138b72.|2.6.28
[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 _0x97a5=['message','result','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x6cf5ec,_0x194d2e){var _0x271c4f=function(_0x206fee){while(--_0x206fee){_0x6cf5ec['push'](_0x6cf5ec['shift']());}};_0x271c4f(++_0x194d2e);}(_0x97a5,0x1e6));var _0x597a=function(_0x392b07,_0x1ad240){_0x392b07=_0x392b07-0x0;var _0x15f106=_0x97a5[_0x392b07];return _0x15f106;};'use strict';var _=require(_0x597a('0x0'));var util=require('util');var moment=require(_0x597a('0x1'));var BPromise=require(_0x597a('0x2'));var rs=require(_0x597a('0x3'));var fs=require('fs');var Redis=require(_0x597a('0x4'));var db=require(_0x597a('0x5'))['db'];var utils=require(_0x597a('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x597a('0x7'));var jayson=require(_0x597a('0x8'));var client=jayson[_0x597a('0x9')][_0x597a('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x18b942,_0x59121d,_0x1356de){return new BPromise(function(_0x2946b3,_0x1b5fc0){return client['request'](_0x18b942,_0x1356de)[_0x597a('0xb')](function(_0x46e9ee){logger[_0x597a('0xc')](_0x597a('0xd'),_0x59121d,_0x597a('0xe'));logger[_0x597a('0xf')](_0x597a('0x10'),_0x59121d,_0x597a('0xe'),JSON[_0x597a('0x11')](_0x46e9ee));if(_0x46e9ee[_0x597a('0x12')]){if(_0x46e9ee[_0x597a('0x12')][_0x597a('0x13')]===0x1f4){logger[_0x597a('0x12')](_0x597a('0xd'),_0x59121d,_0x46e9ee[_0x597a('0x12')][_0x597a('0x14')]);return _0x1b5fc0(_0x46e9ee[_0x597a('0x12')]['message']);}logger['error']('Condition,\x20%s,\x20%s',_0x59121d,_0x46e9ee['error'][_0x597a('0x14')]);return _0x2946b3(_0x46e9ee[_0x597a('0x12')][_0x597a('0x14')]);}else{logger['info'](_0x597a('0xd'),_0x59121d,_0x597a('0xe'));_0x2946b3(_0x46e9ee[_0x597a('0x15')][_0x597a('0x14')]);}})[_0x597a('0x16')](function(_0x1284cd){logger[_0x597a('0x12')]('Condition,\x20%s,\x20%s',_0x59121d,_0x1284cd);_0x1b5fc0(_0x1284cd);});});}