Built motion from commit 5ae82ce5.|2.6.7
[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 _0xdb46=['../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','moment','randomstring','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x40197b,_0x4e763f){var _0x3b9c2f=function(_0x41c34f){while(--_0x41c34f){_0x40197b['push'](_0x40197b['shift']());}};_0x3b9c2f(++_0x4e763f);}(_0xdb46,0x1f1));var _0x6db4=function(_0x318840,_0x561b1e){_0x318840=_0x318840-0x0;var _0x223da4=_0xdb46[_0x318840];return _0x223da4;};'use strict';var _=require(_0x6db4('0x0'));var util=require('util');var moment=require(_0x6db4('0x1'));var BPromise=require('bluebird');var rs=require(_0x6db4('0x2'));var fs=require('fs');var Redis=require(_0x6db4('0x3'));var db=require(_0x6db4('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6db4('0x5'))(_0x6db4('0x6'));var config=require(_0x6db4('0x7'));var jayson=require(_0x6db4('0x8'));var client=jayson[_0x6db4('0x9')][_0x6db4('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x245671,_0xefb0f3,_0x2586ed){return new BPromise(function(_0x4acc5d,_0x170019){return client[_0x6db4('0xb')](_0x245671,_0x2586ed)[_0x6db4('0xc')](function(_0x361b75){logger[_0x6db4('0xd')]('Condition,\x20%s,\x20%s',_0xefb0f3,_0x6db4('0xe'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0xefb0f3,_0x6db4('0xe'),JSON['stringify'](_0x361b75));if(_0x361b75[_0x6db4('0xf')]){if(_0x361b75[_0x6db4('0xf')][_0x6db4('0x10')]===0x1f4){logger[_0x6db4('0xf')](_0x6db4('0x11'),_0xefb0f3,_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);return _0x170019(_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);}logger['error'](_0x6db4('0x11'),_0xefb0f3,_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);return _0x4acc5d(_0x361b75[_0x6db4('0xf')][_0x6db4('0x12')]);}else{logger['info'](_0x6db4('0x11'),_0xefb0f3,'request\x20sent');_0x4acc5d(_0x361b75[_0x6db4('0x13')]['message']);}})[_0x6db4('0x14')](function(_0x40e003){logger[_0x6db4('0xf')]('Condition,\x20%s,\x20%s',_0xefb0f3,_0x40e003);_0x170019(_0x40e003);});});}