Built motion from commit b0a9a629.|2.6.33
[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 _0x398b=['lodash','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','result','catch'];(function(_0x5413f5,_0x3154c7){var _0x639288=function(_0x4b85e9){while(--_0x4b85e9){_0x5413f5['push'](_0x5413f5['shift']());}};_0x639288(++_0x3154c7);}(_0x398b,0xd2));var _0xb398=function(_0x4b43c0,_0x3a8091){_0x4b43c0=_0x4b43c0-0x0;var _0x574c13=_0x398b[_0x4b43c0];return _0x574c13;};'use strict';var _=require(_0xb398('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xb398('0x1'));var rs=require(_0xb398('0x2'));var fs=require('fs');var Redis=require(_0xb398('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xb398('0x4'));var logger=require(_0xb398('0x5'))(_0xb398('0x6'));var config=require(_0xb398('0x7'));var jayson=require(_0xb398('0x8'));var client=jayson['client'][_0xb398('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x42c530,_0x37adb4,_0xbbd96b){return new BPromise(function(_0x2a7641,_0x4b6f92){return client[_0xb398('0xa')](_0x42c530,_0xbbd96b)[_0xb398('0xb')](function(_0x281fa1){logger['info']('Condition,\x20%s,\x20%s',_0x37adb4,_0xb398('0xc'));logger[_0xb398('0xd')]('Condition,\x20%s,\x20%s,\x20%s',_0x37adb4,_0xb398('0xc'),JSON[_0xb398('0xe')](_0x281fa1));if(_0x281fa1[_0xb398('0xf')]){if(_0x281fa1[_0xb398('0xf')][_0xb398('0x10')]===0x1f4){logger['error'](_0xb398('0x11'),_0x37adb4,_0x281fa1[_0xb398('0xf')][_0xb398('0x12')]);return _0x4b6f92(_0x281fa1[_0xb398('0xf')]['message']);}logger['error'](_0xb398('0x11'),_0x37adb4,_0x281fa1[_0xb398('0xf')][_0xb398('0x12')]);return _0x2a7641(_0x281fa1['error'][_0xb398('0x12')]);}else{logger['info'](_0xb398('0x11'),_0x37adb4,'request\x20sent');_0x2a7641(_0x281fa1[_0xb398('0x13')][_0xb398('0x12')]);}})[_0xb398('0x14')](function(_0x21d929){logger['error'](_0xb398('0x11'),_0x37adb4,_0x21d929);_0x4b6f92(_0x21d929);});});}