Built motion from commit (unavailable).|2.4.3
[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 _0xeb73=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','request','request\x20sent'];(function(_0x2929f5,_0x585578){var _0x3f460e=function(_0x18e2ad){while(--_0x18e2ad){_0x2929f5['push'](_0x2929f5['shift']());}};_0x3f460e(++_0x585578);}(_0xeb73,0x196));var _0x3eb7=function(_0x90f34f,_0x404021){_0x90f34f=_0x90f34f-0x0;var _0x4b18cf=_0xeb73[_0x90f34f];return _0x4b18cf;};'use strict';var _=require('lodash');var util=require(_0x3eb7('0x0'));var moment=require('moment');var BPromise=require(_0x3eb7('0x1'));var rs=require(_0x3eb7('0x2'));var fs=require('fs');var Redis=require(_0x3eb7('0x3'));var db=require(_0x3eb7('0x4'))['db'];var utils=require(_0x3eb7('0x5'));var logger=require('../../config/logger')(_0x3eb7('0x6'));var config=require(_0x3eb7('0x7'));var jayson=require(_0x3eb7('0x8'));var client=jayson[_0x3eb7('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x422886,_0x2b8758,_0x4d3f54){return new BPromise(function(_0xddcf35,_0x33a879){return client[_0x3eb7('0xa')](_0x422886,_0x4d3f54)['then'](function(_0x1314d2){logger['info']('Condition,\x20%s,\x20%s',_0x2b8758,_0x3eb7('0xb'));logger[_0x3eb7('0xc')](_0x3eb7('0xd'),_0x2b8758,_0x3eb7('0xb'),JSON[_0x3eb7('0xe')](_0x1314d2));if(_0x1314d2[_0x3eb7('0xf')]){if(_0x1314d2[_0x3eb7('0xf')][_0x3eb7('0x10')]===0x1f4){logger[_0x3eb7('0xf')](_0x3eb7('0x11'),_0x2b8758,_0x1314d2['error'][_0x3eb7('0x12')]);return _0x33a879(_0x1314d2[_0x3eb7('0xf')][_0x3eb7('0x12')]);}logger['error'](_0x3eb7('0x11'),_0x2b8758,_0x1314d2[_0x3eb7('0xf')]['message']);return _0xddcf35(_0x1314d2['error'][_0x3eb7('0x12')]);}else{logger[_0x3eb7('0x13')](_0x3eb7('0x11'),_0x2b8758,_0x3eb7('0xb'));_0xddcf35(_0x1314d2[_0x3eb7('0x14')][_0x3eb7('0x12')]);}})[_0x3eb7('0x15')](function(_0x14f490){logger[_0x3eb7('0xf')]('Condition,\x20%s,\x20%s',_0x2b8758,_0x14f490);_0x33a879(_0x14f490);});});}