Built motion from commit (unavailable).|2.5.31
[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 _0xa424=['moment','randomstring','../../mysqldb','../../config/logger','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util'];(function(_0x3ab51d,_0x2fa01d){var _0x29a04e=function(_0x7807b0){while(--_0x7807b0){_0x3ab51d['push'](_0x3ab51d['shift']());}};_0x29a04e(++_0x2fa01d);}(_0xa424,0x6c));var _0x4a42=function(_0xf67c5c,_0x374781){_0xf67c5c=_0xf67c5c-0x0;var _0x2d5e24=_0xa424[_0xf67c5c];return _0x2d5e24;};'use strict';var _=require(_0x4a42('0x0'));var util=require(_0x4a42('0x1'));var moment=require(_0x4a42('0x2'));var BPromise=require('bluebird');var rs=require(_0x4a42('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x4a42('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x4a42('0x5'))('rpc');var config=require('../../config/environment');var jayson=require(_0x4a42('0x6'));var client=jayson[_0x4a42('0x7')][_0x4a42('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x4a51af,_0x3276ba,_0x3d5940){return new BPromise(function(_0x3fefe1,_0x3a0e88){return client[_0x4a42('0x9')](_0x4a51af,_0x3d5940)[_0x4a42('0xa')](function(_0x58615f){logger[_0x4a42('0xb')](_0x4a42('0xc'),_0x3276ba,_0x4a42('0xd'));logger[_0x4a42('0xe')](_0x4a42('0xf'),_0x3276ba,_0x4a42('0xd'),JSON[_0x4a42('0x10')](_0x58615f));if(_0x58615f[_0x4a42('0x11')]){if(_0x58615f[_0x4a42('0x11')][_0x4a42('0x12')]===0x1f4){logger[_0x4a42('0x11')](_0x4a42('0xc'),_0x3276ba,_0x58615f[_0x4a42('0x11')]['message']);return _0x3a0e88(_0x58615f[_0x4a42('0x11')][_0x4a42('0x13')]);}logger[_0x4a42('0x11')](_0x4a42('0xc'),_0x3276ba,_0x58615f[_0x4a42('0x11')]['message']);return _0x3fefe1(_0x58615f['error'][_0x4a42('0x13')]);}else{logger[_0x4a42('0xb')](_0x4a42('0xc'),_0x3276ba,_0x4a42('0xd'));_0x3fefe1(_0x58615f[_0x4a42('0x14')][_0x4a42('0x13')]);}})[_0x4a42('0x15')](function(_0x52cbfe){logger[_0x4a42('0x11')]('Condition,\x20%s,\x20%s',_0x3276ba,_0x52cbfe);_0x3a0e88(_0x52cbfe);});});}