Built motion from commit 1fa89557.|2.6.10
[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 _0x9a39=['../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','request\x20sent','Condition,\x20%s,\x20%s,\x20%s','error','code','Condition,\x20%s,\x20%s','message','result','catch','lodash','util','bluebird','randomstring','../../mysqldb','../../config/utils'];(function(_0x50cc06,_0x4639b4){var _0x58424c=function(_0x38b55c){while(--_0x38b55c){_0x50cc06['push'](_0x50cc06['shift']());}};_0x58424c(++_0x4639b4);}(_0x9a39,0x19c));var _0x99a3=function(_0x4dfc19,_0x372f28){_0x4dfc19=_0x4dfc19-0x0;var _0x24f686=_0x9a39[_0x4dfc19];return _0x24f686;};'use strict';var _=require(_0x99a3('0x0'));var util=require(_0x99a3('0x1'));var moment=require('moment');var BPromise=require(_0x99a3('0x2'));var rs=require(_0x99a3('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x99a3('0x4'))['db'];var utils=require(_0x99a3('0x5'));var logger=require(_0x99a3('0x6'))('rpc');var config=require(_0x99a3('0x7'));var jayson=require(_0x99a3('0x8'));var client=jayson[_0x99a3('0x9')][_0x99a3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x28f5c5,_0x2222cf,_0x47567b){return new BPromise(function(_0x595721,_0x349551){return client[_0x99a3('0xb')](_0x28f5c5,_0x47567b)[_0x99a3('0xc')](function(_0x4b71b1){logger[_0x99a3('0xd')]('Condition,\x20%s,\x20%s',_0x2222cf,_0x99a3('0xe'));logger['debug'](_0x99a3('0xf'),_0x2222cf,_0x99a3('0xe'),JSON['stringify'](_0x4b71b1));if(_0x4b71b1[_0x99a3('0x10')]){if(_0x4b71b1[_0x99a3('0x10')][_0x99a3('0x11')]===0x1f4){logger['error'](_0x99a3('0x12'),_0x2222cf,_0x4b71b1[_0x99a3('0x10')][_0x99a3('0x13')]);return _0x349551(_0x4b71b1['error'][_0x99a3('0x13')]);}logger[_0x99a3('0x10')]('Condition,\x20%s,\x20%s',_0x2222cf,_0x4b71b1[_0x99a3('0x10')][_0x99a3('0x13')]);return _0x595721(_0x4b71b1[_0x99a3('0x10')]['message']);}else{logger[_0x99a3('0xd')](_0x99a3('0x12'),_0x2222cf,_0x99a3('0xe'));_0x595721(_0x4b71b1[_0x99a3('0x14')][_0x99a3('0x13')]);}})[_0x99a3('0x15')](function(_0x41f9ae){logger[_0x99a3('0x10')](_0x99a3('0x12'),_0x2222cf,_0x41f9ae);_0x349551(_0x41f9ae);});});}