Built motion from commit (unavailable).|2.5.8
[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 _0x6de2=['randomstring','ioredis','../../config/utils','jayson/promise','http','request','then','info','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','lodash','util','moment','bluebird'];(function(_0x326165,_0x3ce23b){var _0x23cf9c=function(_0x343ace){while(--_0x343ace){_0x326165['push'](_0x326165['shift']());}};_0x23cf9c(++_0x3ce23b);}(_0x6de2,0xa4));var _0x26de=function(_0x5c9426,_0x15016e){_0x5c9426=_0x5c9426-0x0;var _0x1d2f26=_0x6de2[_0x5c9426];return _0x1d2f26;};'use strict';var _=require(_0x26de('0x0'));var util=require(_0x26de('0x1'));var moment=require(_0x26de('0x2'));var BPromise=require(_0x26de('0x3'));var rs=require(_0x26de('0x4'));var fs=require('fs');var Redis=require(_0x26de('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x26de('0x6'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require(_0x26de('0x7'));var client=jayson['client'][_0x26de('0x8')]({'port':0x232a});function respondWithRpcPromise(_0xc66e50,_0x4916bd,_0x24190e){return new BPromise(function(_0x4f1301,_0x57cdbf){return client[_0x26de('0x9')](_0xc66e50,_0x24190e)[_0x26de('0xa')](function(_0x36d469){logger[_0x26de('0xb')](_0x26de('0xc'),_0x4916bd,_0x26de('0xd'));logger[_0x26de('0xe')](_0x26de('0xf'),_0x4916bd,'request\x20sent',JSON[_0x26de('0x10')](_0x36d469));if(_0x36d469[_0x26de('0x11')]){if(_0x36d469[_0x26de('0x11')]['code']===0x1f4){logger[_0x26de('0x11')]('Condition,\x20%s,\x20%s',_0x4916bd,_0x36d469[_0x26de('0x11')][_0x26de('0x12')]);return _0x57cdbf(_0x36d469[_0x26de('0x11')][_0x26de('0x12')]);}logger[_0x26de('0x11')](_0x26de('0xc'),_0x4916bd,_0x36d469[_0x26de('0x11')]['message']);return _0x4f1301(_0x36d469[_0x26de('0x11')][_0x26de('0x12')]);}else{logger[_0x26de('0xb')](_0x26de('0xc'),_0x4916bd,'request\x20sent');_0x4f1301(_0x36d469[_0x26de('0x13')][_0x26de('0x12')]);}})[_0x26de('0x14')](function(_0x2d8434){logger[_0x26de('0x11')]('Condition,\x20%s,\x20%s',_0x4916bd,_0x2d8434);_0x57cdbf(_0x2d8434);});});}