Built motion from commit da617fac.|2.6.6
[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 _0x8a41=['http','then','info','debug','Condition,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','Condition,\x20%s,\x20%s','result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x3a0380,_0x4014c8){var _0x162bbb=function(_0x59178c){while(--_0x59178c){_0x3a0380['push'](_0x3a0380['shift']());}};_0x162bbb(++_0x4014c8);}(_0x8a41,0xfc));var _0x18a4=function(_0x525067,_0x128b80){_0x525067=_0x525067-0x0;var _0x21ab1a=_0x8a41[_0x525067];return _0x21ab1a;};'use strict';var _=require(_0x18a4('0x0'));var util=require(_0x18a4('0x1'));var moment=require(_0x18a4('0x2'));var BPromise=require(_0x18a4('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x18a4('0x4'));var db=require(_0x18a4('0x5'))['db'];var utils=require(_0x18a4('0x6'));var logger=require('../../config/logger')('rpc');var config=require(_0x18a4('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x18a4('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x53533c,_0x58eb3d,_0x3fd42f){return new BPromise(function(_0x2900ea,_0x335c14){return client['request'](_0x53533c,_0x3fd42f)[_0x18a4('0x9')](function(_0x3efabf){logger[_0x18a4('0xa')]('Condition,\x20%s,\x20%s',_0x58eb3d,'request\x20sent');logger[_0x18a4('0xb')](_0x18a4('0xc'),_0x58eb3d,_0x18a4('0xd'),JSON['stringify'](_0x3efabf));if(_0x3efabf[_0x18a4('0xe')]){if(_0x3efabf[_0x18a4('0xe')][_0x18a4('0xf')]===0x1f4){logger[_0x18a4('0xe')]('Condition,\x20%s,\x20%s',_0x58eb3d,_0x3efabf[_0x18a4('0xe')][_0x18a4('0x10')]);return _0x335c14(_0x3efabf[_0x18a4('0xe')][_0x18a4('0x10')]);}logger['error'](_0x18a4('0x11'),_0x58eb3d,_0x3efabf[_0x18a4('0xe')][_0x18a4('0x10')]);return _0x2900ea(_0x3efabf[_0x18a4('0xe')][_0x18a4('0x10')]);}else{logger[_0x18a4('0xa')]('Condition,\x20%s,\x20%s',_0x58eb3d,_0x18a4('0xd'));_0x2900ea(_0x3efabf[_0x18a4('0x12')][_0x18a4('0x10')]);}})[_0x18a4('0x13')](function(_0xff6afe){logger[_0x18a4('0xe')](_0x18a4('0x11'),_0x58eb3d,_0xff6afe);_0x335c14(_0xff6afe);});});}