50d35589d94cce90240bd79abbd6a5ee31543975
[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 _0x35ee=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','Condition,\x20%s,\x20%s','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis'];(function(_0x1527f2,_0x3226b3){var _0x2bcb37=function(_0x236170){while(--_0x236170){_0x1527f2['push'](_0x1527f2['shift']());}};_0x2bcb37(++_0x3226b3);}(_0x35ee,0xf8));var _0xe35e=function(_0x549a8c,_0x4ba95f){_0x549a8c=_0x549a8c-0x0;var _0x1ccf40=_0x35ee[_0x549a8c];return _0x1ccf40;};'use strict';var _=require('lodash');var util=require(_0xe35e('0x0'));var moment=require('moment');var BPromise=require(_0xe35e('0x1'));var rs=require(_0xe35e('0x2'));var fs=require('fs');var Redis=require(_0xe35e('0x3'));var db=require(_0xe35e('0x4'))['db'];var utils=require(_0xe35e('0x5'));var logger=require(_0xe35e('0x6'))(_0xe35e('0x7'));var config=require(_0xe35e('0x8'));var jayson=require('jayson/promise');var client=jayson[_0xe35e('0x9')][_0xe35e('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x111f17,_0x5a04d1,_0x1dd814){return new BPromise(function(_0x52ea84,_0x510e7a){return client[_0xe35e('0xb')](_0x111f17,_0x1dd814)['then'](function(_0x4378a7){logger['info'](_0xe35e('0xc'),_0x5a04d1,'request\x20sent');logger['debug'](_0xe35e('0xd'),_0x5a04d1,'request\x20sent',JSON[_0xe35e('0xe')](_0x4378a7));if(_0x4378a7['error']){if(_0x4378a7[_0xe35e('0xf')][_0xe35e('0x10')]===0x1f4){logger[_0xe35e('0xf')](_0xe35e('0xc'),_0x5a04d1,_0x4378a7[_0xe35e('0xf')][_0xe35e('0x11')]);return _0x510e7a(_0x4378a7['error'][_0xe35e('0x11')]);}logger[_0xe35e('0xf')]('Condition,\x20%s,\x20%s',_0x5a04d1,_0x4378a7[_0xe35e('0xf')][_0xe35e('0x11')]);return _0x52ea84(_0x4378a7[_0xe35e('0xf')]['message']);}else{logger[_0xe35e('0x12')](_0xe35e('0xc'),_0x5a04d1,'request\x20sent');_0x52ea84(_0x4378a7[_0xe35e('0x13')][_0xe35e('0x11')]);}})[_0xe35e('0x14')](function(_0x331280){logger[_0xe35e('0xf')](_0xe35e('0xc'),_0x5a04d1,_0x331280);_0x510e7a(_0x331280);});});}