7520d54bed6f18d81d03da28dbcfc62cf9f5f12f
[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 _0xe410=['../../config/environment','jayson/promise','client','request','then','request\x20sent','error','code','Condition,\x20%s,\x20%s','message','info','result','lodash','moment','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc'];(function(_0x4099ee,_0x38495a){var _0x1b7bfc=function(_0x5f5388){while(--_0x5f5388){_0x4099ee['push'](_0x4099ee['shift']());}};_0x1b7bfc(++_0x38495a);}(_0xe410,0x188));var _0x0e41=function(_0x234577,_0x3b9004){_0x234577=_0x234577-0x0;var _0x28fea6=_0xe410[_0x234577];return _0x28fea6;};'use strict';var _=require(_0x0e41('0x0'));var util=require('util');var moment=require(_0x0e41('0x1'));var BPromise=require('bluebird');var rs=require(_0x0e41('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0e41('0x3'))['db'];var utils=require(_0x0e41('0x4'));var logger=require(_0x0e41('0x5'))(_0x0e41('0x6'));var config=require(_0x0e41('0x7'));var jayson=require(_0x0e41('0x8'));var client=jayson[_0x0e41('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3cbdbb,_0x495d24,_0x54c2ef){return new BPromise(function(_0x5e4af3,_0x31e3d8){return client[_0x0e41('0xa')](_0x3cbdbb,_0x54c2ef)[_0x0e41('0xb')](function(_0x3e7b3d){logger['info']('Condition,\x20%s,\x20%s',_0x495d24,_0x0e41('0xc'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x495d24,_0x0e41('0xc'),JSON['stringify'](_0x3e7b3d));if(_0x3e7b3d[_0x0e41('0xd')]){if(_0x3e7b3d[_0x0e41('0xd')][_0x0e41('0xe')]===0x1f4){logger['error'](_0x0e41('0xf'),_0x495d24,_0x3e7b3d[_0x0e41('0xd')][_0x0e41('0x10')]);return _0x31e3d8(_0x3e7b3d['error'][_0x0e41('0x10')]);}logger['error'](_0x0e41('0xf'),_0x495d24,_0x3e7b3d['error'][_0x0e41('0x10')]);return _0x5e4af3(_0x3e7b3d[_0x0e41('0xd')]['message']);}else{logger[_0x0e41('0x11')](_0x0e41('0xf'),_0x495d24,_0x0e41('0xc'));_0x5e4af3(_0x3e7b3d[_0x0e41('0x12')][_0x0e41('0x10')]);}})['catch'](function(_0x376cec){logger[_0x0e41('0xd')]('Condition,\x20%s,\x20%s',_0x495d24,_0x376cec);_0x31e3d8(_0x376cec);});});}