83c1ad31198cb0df3a2cd374873139df94d8c755
[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 _0x3b2b=['Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','lodash','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then','info','Condition,\x20%s,\x20%s','debug'];(function(_0x5d8e11,_0x1b2574){var _0x25fa53=function(_0x5376ce){while(--_0x5376ce){_0x5d8e11['push'](_0x5d8e11['shift']());}};_0x25fa53(++_0x1b2574);}(_0x3b2b,0x116));var _0xb3b2=function(_0x4ae625,_0xf396d0){_0x4ae625=_0x4ae625-0x0;var _0x31accf=_0x3b2b[_0x4ae625];return _0x31accf;};'use strict';var _=require(_0xb3b2('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb3b2('0x1'));var rs=require(_0xb3b2('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xb3b2('0x3'))['db'];var utils=require(_0xb3b2('0x4'));var logger=require(_0xb3b2('0x5'))(_0xb3b2('0x6'));var config=require(_0xb3b2('0x7'));var jayson=require(_0xb3b2('0x8'));var client=jayson[_0xb3b2('0x9')][_0xb3b2('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2a42d4,_0x5b7dab,_0xf6fa84){return new BPromise(function(_0x3b3542,_0x17ddb5){return client[_0xb3b2('0xb')](_0x2a42d4,_0xf6fa84)[_0xb3b2('0xc')](function(_0x3e6e48){logger[_0xb3b2('0xd')](_0xb3b2('0xe'),_0x5b7dab,'request\x20sent');logger[_0xb3b2('0xf')](_0xb3b2('0x10'),_0x5b7dab,_0xb3b2('0x11'),JSON['stringify'](_0x3e6e48));if(_0x3e6e48[_0xb3b2('0x12')]){if(_0x3e6e48[_0xb3b2('0x12')][_0xb3b2('0x13')]===0x1f4){logger[_0xb3b2('0x12')](_0xb3b2('0xe'),_0x5b7dab,_0x3e6e48[_0xb3b2('0x12')]['message']);return _0x17ddb5(_0x3e6e48[_0xb3b2('0x12')][_0xb3b2('0x14')]);}logger[_0xb3b2('0x12')](_0xb3b2('0xe'),_0x5b7dab,_0x3e6e48[_0xb3b2('0x12')][_0xb3b2('0x14')]);return _0x3b3542(_0x3e6e48[_0xb3b2('0x12')][_0xb3b2('0x14')]);}else{logger['info'](_0xb3b2('0xe'),_0x5b7dab,'request\x20sent');_0x3b3542(_0x3e6e48['result'][_0xb3b2('0x14')]);}})['catch'](function(_0x3d98da){logger[_0xb3b2('0x12')](_0xb3b2('0xe'),_0x5b7dab,_0x3d98da);_0x17ddb5(_0x3d98da);});});}