Built motion from commit d5e4af8c.|2.6.23
[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 _0x403e=['debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','info','Condition,\x20%s,\x20%s','request\x20sent'];(function(_0x44a573,_0x1e6efc){var _0x4babc6=function(_0x5495aa){while(--_0x5495aa){_0x44a573['push'](_0x44a573['shift']());}};_0x4babc6(++_0x1e6efc);}(_0x403e,0xa7));var _0xe403=function(_0x2906dd,_0xd7dc72){_0x2906dd=_0x2906dd-0x0;var _0xe9e2f0=_0x403e[_0x2906dd];return _0xe9e2f0;};'use strict';var _=require(_0xe403('0x0'));var util=require(_0xe403('0x1'));var moment=require(_0xe403('0x2'));var BPromise=require(_0xe403('0x3'));var rs=require(_0xe403('0x4'));var fs=require('fs');var Redis=require(_0xe403('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0xe403('0x6'));var logger=require(_0xe403('0x7'))(_0xe403('0x8'));var config=require(_0xe403('0x9'));var jayson=require(_0xe403('0xa'));var client=jayson[_0xe403('0xb')][_0xe403('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x261f8f,_0x117bc9,_0x4cbb69){return new BPromise(function(_0x4ee264,_0x14d79d){return client['request'](_0x261f8f,_0x4cbb69)[_0xe403('0xd')](function(_0x4105dc){logger[_0xe403('0xe')](_0xe403('0xf'),_0x117bc9,_0xe403('0x10'));logger[_0xe403('0x11')](_0xe403('0x12'),_0x117bc9,_0xe403('0x10'),JSON[_0xe403('0x13')](_0x4105dc));if(_0x4105dc[_0xe403('0x14')]){if(_0x4105dc[_0xe403('0x14')]['code']===0x1f4){logger[_0xe403('0x14')]('Condition,\x20%s,\x20%s',_0x117bc9,_0x4105dc['error'][_0xe403('0x15')]);return _0x14d79d(_0x4105dc[_0xe403('0x14')][_0xe403('0x15')]);}logger[_0xe403('0x14')](_0xe403('0xf'),_0x117bc9,_0x4105dc['error'][_0xe403('0x15')]);return _0x4ee264(_0x4105dc[_0xe403('0x14')][_0xe403('0x15')]);}else{logger[_0xe403('0xe')](_0xe403('0xf'),_0x117bc9,'request\x20sent');_0x4ee264(_0x4105dc[_0xe403('0x16')]['message']);}})['catch'](function(_0x3debd6){logger['error'](_0xe403('0xf'),_0x117bc9,_0x3debd6);_0x14d79d(_0x3debd6);});});}