d34e287fe4fd5dd77f24d0bda05f0c33c2827e44
[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 _0xd21d=['message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','request\x20sent','stringify','error','code','Condition,\x20%s,\x20%s'];(function(_0x26899a,_0x26c333){var _0xdc18d9=function(_0x3da640){while(--_0x3da640){_0x26899a['push'](_0x26899a['shift']());}};_0xdc18d9(++_0x26c333);}(_0xd21d,0x173));var _0xdd21=function(_0xcaf223,_0xd39f07){_0xcaf223=_0xcaf223-0x0;var _0x17e00d=_0xd21d[_0xcaf223];return _0x17e00d;};'use strict';var _=require(_0xdd21('0x0'));var util=require(_0xdd21('0x1'));var moment=require(_0xdd21('0x2'));var BPromise=require(_0xdd21('0x3'));var rs=require(_0xdd21('0x4'));var fs=require('fs');var Redis=require(_0xdd21('0x5'));var db=require(_0xdd21('0x6'))['db'];var utils=require(_0xdd21('0x7'));var logger=require(_0xdd21('0x8'))(_0xdd21('0x9'));var config=require('../../config/environment');var jayson=require(_0xdd21('0xa'));var client=jayson[_0xdd21('0xb')][_0xdd21('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xfed97d,_0x593843,_0x5ec0ec){return new BPromise(function(_0x9b0b75,_0x3a9b87){return client[_0xdd21('0xd')](_0xfed97d,_0x5ec0ec)[_0xdd21('0xe')](function(_0x161655){logger['info']('Condition,\x20%s,\x20%s',_0x593843,_0xdd21('0xf'));logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x593843,_0xdd21('0xf'),JSON[_0xdd21('0x10')](_0x161655));if(_0x161655['error']){if(_0x161655[_0xdd21('0x11')][_0xdd21('0x12')]===0x1f4){logger['error'](_0xdd21('0x13'),_0x593843,_0x161655[_0xdd21('0x11')]['message']);return _0x3a9b87(_0x161655[_0xdd21('0x11')][_0xdd21('0x14')]);}logger['error'](_0xdd21('0x13'),_0x593843,_0x161655['error'][_0xdd21('0x14')]);return _0x9b0b75(_0x161655[_0xdd21('0x11')][_0xdd21('0x14')]);}else{logger[_0xdd21('0x15')](_0xdd21('0x13'),_0x593843,_0xdd21('0xf'));_0x9b0b75(_0x161655['result']['message']);}})[_0xdd21('0x16')](function(_0x234dd5){logger['error'](_0xdd21('0x13'),_0x593843,_0x234dd5);_0x3a9b87(_0x234dd5);});});}