Built motion from commit 97f2f211.|2.6.31
[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 _0x3aa7=['request\x20sent','stringify','error','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','request','info','Condition,\x20%s,\x20%s'];(function(_0x4699d3,_0x2db166){var _0x1afa83=function(_0x10c92d){while(--_0x10c92d){_0x4699d3['push'](_0x4699d3['shift']());}};_0x1afa83(++_0x2db166);}(_0x3aa7,0xa7));var _0x73aa=function(_0x4061db,_0x34f65b){_0x4061db=_0x4061db-0x0;var _0x10fc85=_0x3aa7[_0x4061db];return _0x10fc85;};'use strict';var _=require(_0x73aa('0x0'));var util=require(_0x73aa('0x1'));var moment=require(_0x73aa('0x2'));var BPromise=require(_0x73aa('0x3'));var rs=require(_0x73aa('0x4'));var fs=require('fs');var Redis=require(_0x73aa('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x73aa('0x6'));var logger=require(_0x73aa('0x7'))(_0x73aa('0x8'));var config=require(_0x73aa('0x9'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x46214d,_0x5bac82,_0x1e25fb){return new BPromise(function(_0x2f345e,_0x2e1776){return client[_0x73aa('0xa')](_0x46214d,_0x1e25fb)['then'](function(_0x2acdb5){logger[_0x73aa('0xb')](_0x73aa('0xc'),_0x5bac82,'request\x20sent');logger['debug']('Condition,\x20%s,\x20%s,\x20%s',_0x5bac82,_0x73aa('0xd'),JSON[_0x73aa('0xe')](_0x2acdb5));if(_0x2acdb5[_0x73aa('0xf')]){if(_0x2acdb5[_0x73aa('0xf')]['code']===0x1f4){logger['error'](_0x73aa('0xc'),_0x5bac82,_0x2acdb5['error']['message']);return _0x2e1776(_0x2acdb5[_0x73aa('0xf')][_0x73aa('0x10')]);}logger[_0x73aa('0xf')](_0x73aa('0xc'),_0x5bac82,_0x2acdb5[_0x73aa('0xf')][_0x73aa('0x10')]);return _0x2f345e(_0x2acdb5[_0x73aa('0xf')][_0x73aa('0x10')]);}else{logger[_0x73aa('0xb')]('Condition,\x20%s,\x20%s',_0x5bac82,_0x73aa('0xd'));_0x2f345e(_0x2acdb5[_0x73aa('0x11')][_0x73aa('0x10')]);}})['catch'](function(_0x2ef88c){logger[_0x73aa('0xf')](_0x73aa('0xc'),_0x5bac82,_0x2ef88c);_0x2e1776(_0x2ef88c);});});}