Built motion from commit b5a10faa.|2.6.13
[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 _0xe5c5=['then','Condition,\x20%s,\x20%s','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request'];(function(_0x687b49,_0x547e56){var _0x49c8f7=function(_0x592ab5){while(--_0x592ab5){_0x687b49['push'](_0x687b49['shift']());}};_0x49c8f7(++_0x547e56);}(_0xe5c5,0x1a3));var _0x5e5c=function(_0xd1f73b,_0x111f6a){_0xd1f73b=_0xd1f73b-0x0;var _0x42aa7a=_0xe5c5[_0xd1f73b];return _0x42aa7a;};'use strict';var _=require(_0x5e5c('0x0'));var util=require(_0x5e5c('0x1'));var moment=require(_0x5e5c('0x2'));var BPromise=require(_0x5e5c('0x3'));var rs=require(_0x5e5c('0x4'));var fs=require('fs');var Redis=require(_0x5e5c('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5e5c('0x6'));var logger=require(_0x5e5c('0x7'))(_0x5e5c('0x8'));var config=require(_0x5e5c('0x9'));var jayson=require('jayson/promise');var client=jayson[_0x5e5c('0xa')][_0x5e5c('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x48095c,_0x35c09c,_0x2b6db7){return new BPromise(function(_0x217367,_0x730b5f){return client[_0x5e5c('0xc')](_0x48095c,_0x2b6db7)[_0x5e5c('0xd')](function(_0x43ba2c){logger['info'](_0x5e5c('0xe'),_0x35c09c,_0x5e5c('0xf'));logger[_0x5e5c('0x10')](_0x5e5c('0x11'),_0x35c09c,'request\x20sent',JSON[_0x5e5c('0x12')](_0x43ba2c));if(_0x43ba2c[_0x5e5c('0x13')]){if(_0x43ba2c[_0x5e5c('0x13')][_0x5e5c('0x14')]===0x1f4){logger[_0x5e5c('0x13')](_0x5e5c('0xe'),_0x35c09c,_0x43ba2c[_0x5e5c('0x13')][_0x5e5c('0x15')]);return _0x730b5f(_0x43ba2c[_0x5e5c('0x13')]['message']);}logger[_0x5e5c('0x13')](_0x5e5c('0xe'),_0x35c09c,_0x43ba2c['error'][_0x5e5c('0x15')]);return _0x217367(_0x43ba2c[_0x5e5c('0x13')][_0x5e5c('0x15')]);}else{logger[_0x5e5c('0x16')](_0x5e5c('0xe'),_0x35c09c,_0x5e5c('0xf'));_0x217367(_0x43ba2c['result'][_0x5e5c('0x15')]);}})[_0x5e5c('0x17')](function(_0x1488ea){logger['error'](_0x5e5c('0xe'),_0x35c09c,_0x1488ea);_0x730b5f(_0x1488ea);});});}