Built motion from commit (unavailable).|2.5.2
[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 _0x0b03=['ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x213d39,_0xb4772a){var _0x236624=function(_0x21780d){while(--_0x21780d){_0x213d39['push'](_0x213d39['shift']());}};_0x236624(++_0xb4772a);}(_0x0b03,0x12f));var _0x30b0=function(_0x19561b,_0x5c6f0e){_0x19561b=_0x19561b-0x0;var _0x21d64c=_0x0b03[_0x19561b];return _0x21d64c;};'use strict';var _=require(_0x30b0('0x0'));var util=require(_0x30b0('0x1'));var moment=require(_0x30b0('0x2'));var BPromise=require(_0x30b0('0x3'));var rs=require(_0x30b0('0x4'));var fs=require('fs');var Redis=require(_0x30b0('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x30b0('0x6'))(_0x30b0('0x7'));var config=require(_0x30b0('0x8'));var jayson=require(_0x30b0('0x9'));var client=jayson['client'][_0x30b0('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x22ecd3,_0x3e546f,_0x228903){return new BPromise(function(_0x21eed6,_0x4ed820){return client[_0x30b0('0xb')](_0x22ecd3,_0x228903)[_0x30b0('0xc')](function(_0x34cf1d){logger['info']('Condition,\x20%s,\x20%s',_0x3e546f,_0x30b0('0xd'));logger[_0x30b0('0xe')](_0x30b0('0xf'),_0x3e546f,_0x30b0('0xd'),JSON['stringify'](_0x34cf1d));if(_0x34cf1d[_0x30b0('0x10')]){if(_0x34cf1d[_0x30b0('0x10')][_0x30b0('0x11')]===0x1f4){logger[_0x30b0('0x10')](_0x30b0('0x12'),_0x3e546f,_0x34cf1d[_0x30b0('0x10')]['message']);return _0x4ed820(_0x34cf1d['error'][_0x30b0('0x13')]);}logger[_0x30b0('0x10')](_0x30b0('0x12'),_0x3e546f,_0x34cf1d[_0x30b0('0x10')][_0x30b0('0x13')]);return _0x21eed6(_0x34cf1d[_0x30b0('0x10')]['message']);}else{logger['info'](_0x30b0('0x12'),_0x3e546f,_0x30b0('0xd'));_0x21eed6(_0x34cf1d[_0x30b0('0x14')]['message']);}})[_0x30b0('0x15')](function(_0x51d6f3){logger[_0x30b0('0x10')](_0x30b0('0x12'),_0x3e546f,_0x51d6f3);_0x4ed820(_0x51d6f3);});});}