Built motion from commit da617fac.|2.6.6
[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 _0xa581=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','rpc','../../config/environment','jayson/promise','client','http','then','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash'];(function(_0x1d1854,_0x4a83b1){var _0x5b2acb=function(_0x29ae13){while(--_0x29ae13){_0x1d1854['push'](_0x1d1854['shift']());}};_0x5b2acb(++_0x4a83b1);}(_0xa581,0x18b));var _0x1a58=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0xa581[_0x3dd15e];return _0x231fd0;};'use strict';var _=require(_0x1a58('0x0'));var util=require(_0x1a58('0x1'));var moment=require(_0x1a58('0x2'));var BPromise=require(_0x1a58('0x3'));var rs=require(_0x1a58('0x4'));var fs=require('fs');var Redis=require(_0x1a58('0x5'));var db=require(_0x1a58('0x6'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x1a58('0x7'));var config=require(_0x1a58('0x8'));var jayson=require(_0x1a58('0x9'));var client=jayson[_0x1a58('0xa')][_0x1a58('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x70d26d,_0x19f71a,_0x5721cf){return new BPromise(function(_0x4570fc,_0xd4657){return client['request'](_0x70d26d,_0x5721cf)[_0x1a58('0xc')](function(_0xa57d9f){logger['info'](_0x1a58('0xd'),_0x19f71a,'request\x20sent');logger['debug'](_0x1a58('0xe'),_0x19f71a,_0x1a58('0xf'),JSON[_0x1a58('0x10')](_0xa57d9f));if(_0xa57d9f[_0x1a58('0x11')]){if(_0xa57d9f['error'][_0x1a58('0x12')]===0x1f4){logger[_0x1a58('0x11')](_0x1a58('0xd'),_0x19f71a,_0xa57d9f[_0x1a58('0x11')]['message']);return _0xd4657(_0xa57d9f['error'][_0x1a58('0x13')]);}logger['error'](_0x1a58('0xd'),_0x19f71a,_0xa57d9f['error'][_0x1a58('0x13')]);return _0x4570fc(_0xa57d9f[_0x1a58('0x11')][_0x1a58('0x13')]);}else{logger[_0x1a58('0x14')](_0x1a58('0xd'),_0x19f71a,_0x1a58('0xf'));_0x4570fc(_0xa57d9f[_0x1a58('0x15')]['message']);}})['catch'](function(_0x1f3270){logger['error'](_0x1a58('0xd'),_0x19f71a,_0x1f3270);_0xd4657(_0x1f3270);});});}