Built motion from commit (unavailable).|2.5.22
[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 _0x651b=['../../config/environment','jayson/promise','client','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x43226d,_0x51695c){var _0x1fa4dc=function(_0x57b000){while(--_0x57b000){_0x43226d['push'](_0x43226d['shift']());}};_0x1fa4dc(++_0x51695c);}(_0x651b,0x148));var _0xb651=function(_0x7d579a,_0x1580b){_0x7d579a=_0x7d579a-0x0;var _0x3b06cb=_0x651b[_0x7d579a];return _0x3b06cb;};'use strict';var _=require(_0xb651('0x0'));var util=require(_0xb651('0x1'));var moment=require('moment');var BPromise=require(_0xb651('0x2'));var rs=require(_0xb651('0x3'));var fs=require('fs');var Redis=require(_0xb651('0x4'));var db=require(_0xb651('0x5'))['db'];var utils=require(_0xb651('0x6'));var logger=require(_0xb651('0x7'))('rpc');var config=require(_0xb651('0x8'));var jayson=require(_0xb651('0x9'));var client=jayson[_0xb651('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x1b0a30,_0x894885,_0x3ea64f){return new BPromise(function(_0x3b091d,_0x39fd87){return client[_0xb651('0xb')](_0x1b0a30,_0x3ea64f)[_0xb651('0xc')](function(_0x5428e8){logger[_0xb651('0xd')](_0xb651('0xe'),_0x894885,_0xb651('0xf'));logger[_0xb651('0x10')]('Condition,\x20%s,\x20%s,\x20%s',_0x894885,'request\x20sent',JSON[_0xb651('0x11')](_0x5428e8));if(_0x5428e8['error']){if(_0x5428e8[_0xb651('0x12')]['code']===0x1f4){logger[_0xb651('0x12')](_0xb651('0xe'),_0x894885,_0x5428e8[_0xb651('0x12')][_0xb651('0x13')]);return _0x39fd87(_0x5428e8[_0xb651('0x12')][_0xb651('0x13')]);}logger['error']('Condition,\x20%s,\x20%s',_0x894885,_0x5428e8[_0xb651('0x12')][_0xb651('0x13')]);return _0x3b091d(_0x5428e8[_0xb651('0x12')][_0xb651('0x13')]);}else{logger[_0xb651('0xd')](_0xb651('0xe'),_0x894885,_0xb651('0xf'));_0x3b091d(_0x5428e8['result']['message']);}})[_0xb651('0x14')](function(_0x367c1c){logger[_0xb651('0x12')]('Condition,\x20%s,\x20%s',_0x894885,_0x367c1c);_0x39fd87(_0x367c1c);});});}