Built motion from commit 192134f6.|2.6.25
[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 _0x168f=['then','info','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','message','Condition,\x20%s,\x20%s','result','lodash','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0x33bcf4,_0xf1dcb7){var _0x25f19e=function(_0x1080af){while(--_0x1080af){_0x33bcf4['push'](_0x33bcf4['shift']());}};_0x25f19e(++_0xf1dcb7);}(_0x168f,0x79));var _0xf168=function(_0x562f3b,_0x4c65ae){_0x562f3b=_0x562f3b-0x0;var _0x1edd55=_0x168f[_0x562f3b];return _0x1edd55;};'use strict';var _=require(_0xf168('0x0'));var util=require(_0xf168('0x1'));var moment=require(_0xf168('0x2'));var BPromise=require(_0xf168('0x3'));var rs=require(_0xf168('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0xf168('0x5'))['db'];var utils=require(_0xf168('0x6'));var logger=require(_0xf168('0x7'))(_0xf168('0x8'));var config=require(_0xf168('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x40c0fd,_0x5455f6,_0x5b8cb4){return new BPromise(function(_0x5cf7c0,_0x4c187f){return client[_0xf168('0xa')](_0x40c0fd,_0x5b8cb4)[_0xf168('0xb')](function(_0x5b14ef){logger[_0xf168('0xc')]('Condition,\x20%s,\x20%s',_0x5455f6,_0xf168('0xd'));logger[_0xf168('0xe')](_0xf168('0xf'),_0x5455f6,'request\x20sent',JSON[_0xf168('0x10')](_0x5b14ef));if(_0x5b14ef[_0xf168('0x11')]){if(_0x5b14ef[_0xf168('0x11')][_0xf168('0x12')]===0x1f4){logger[_0xf168('0x11')]('Condition,\x20%s,\x20%s',_0x5455f6,_0x5b14ef[_0xf168('0x11')][_0xf168('0x13')]);return _0x4c187f(_0x5b14ef['error'][_0xf168('0x13')]);}logger[_0xf168('0x11')](_0xf168('0x14'),_0x5455f6,_0x5b14ef[_0xf168('0x11')]['message']);return _0x5cf7c0(_0x5b14ef[_0xf168('0x11')][_0xf168('0x13')]);}else{logger['info'](_0xf168('0x14'),_0x5455f6,'request\x20sent');_0x5cf7c0(_0x5b14ef[_0xf168('0x15')][_0xf168('0x13')]);}})['catch'](function(_0x13e8f3){logger[_0xf168('0x11')](_0xf168('0x14'),_0x5455f6,_0x13e8f3);_0x4c187f(_0x13e8f3);});});}