Built motion from commit (unavailable).|2.3.1
[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 _0xc427=['code','message','lodash','util','randomstring','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','debug','request\x20sent','stringify','error'];(function(_0x48ae92,_0x26f56f){var _0x73e237=function(_0x1d1fe1){while(--_0x1d1fe1){_0x48ae92['push'](_0x48ae92['shift']());}};_0x73e237(++_0x26f56f);}(_0xc427,0xd3));var _0x7c42=function(_0x20e25a,_0x1de63d){_0x20e25a=_0x20e25a-0x0;var _0x74e40c=_0xc427[_0x20e25a];return _0x74e40c;};'use strict';var _=require(_0x7c42('0x0'));var util=require(_0x7c42('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x7c42('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require('../../mysqldb')['db'];var utils=require(_0x7c42('0x3'));var logger=require(_0x7c42('0x4'))('rpc');var config=require(_0x7c42('0x5'));var jayson=require(_0x7c42('0x6'));var client=jayson[_0x7c42('0x7')][_0x7c42('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x5ab0e9,_0x1471bd,_0x469dea){return new BPromise(function(_0x442eac,_0x75265a){return client[_0x7c42('0x9')](_0x5ab0e9,_0x469dea)[_0x7c42('0xa')](function(_0x57c5dd){logger[_0x7c42('0xb')](_0x7c42('0xc'),_0x1471bd,'request\x20sent');logger[_0x7c42('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x1471bd,_0x7c42('0xe'),JSON[_0x7c42('0xf')](_0x57c5dd));if(_0x57c5dd[_0x7c42('0x10')]){if(_0x57c5dd[_0x7c42('0x10')][_0x7c42('0x11')]===0x1f4){logger[_0x7c42('0x10')](_0x7c42('0xc'),_0x1471bd,_0x57c5dd[_0x7c42('0x10')]['message']);return _0x75265a(_0x57c5dd[_0x7c42('0x10')]['message']);}logger['error'](_0x7c42('0xc'),_0x1471bd,_0x57c5dd['error'][_0x7c42('0x12')]);return _0x442eac(_0x57c5dd[_0x7c42('0x10')][_0x7c42('0x12')]);}else{logger[_0x7c42('0xb')](_0x7c42('0xc'),_0x1471bd,_0x7c42('0xe'));_0x442eac(_0x57c5dd['result'][_0x7c42('0x12')]);}})['catch'](function(_0x3af08d){logger[_0x7c42('0x10')](_0x7c42('0xc'),_0x1471bd,_0x3af08d);_0x75265a(_0x3af08d);});});}