Built motion from commit (unavailable).|2.4.21
[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 _0x58e6=['moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','request\x20sent','debug','stringify','error','code','Condition,\x20%s,\x20%s','message','info','result','catch','lodash','util'];(function(_0x451a55,_0xd6ad0){var _0x2a87aa=function(_0xdf2ada){while(--_0xdf2ada){_0x451a55['push'](_0x451a55['shift']());}};_0x2a87aa(++_0xd6ad0);}(_0x58e6,0x163));var _0x658e=function(_0x17055c,_0x424184){_0x17055c=_0x17055c-0x0;var _0x4a8a09=_0x58e6[_0x17055c];return _0x4a8a09;};'use strict';var _=require(_0x658e('0x0'));var util=require(_0x658e('0x1'));var moment=require(_0x658e('0x2'));var BPromise=require(_0x658e('0x3'));var rs=require(_0x658e('0x4'));var fs=require('fs');var Redis=require(_0x658e('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x658e('0x6'));var logger=require(_0x658e('0x7'))('rpc');var config=require(_0x658e('0x8'));var jayson=require(_0x658e('0x9'));var client=jayson[_0x658e('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x10191c,_0x2ac481,_0x885d41){return new BPromise(function(_0x5cfdab,_0x1c56b4){return client['request'](_0x10191c,_0x885d41)['then'](function(_0x166f07){logger['info']('Condition,\x20%s,\x20%s',_0x2ac481,_0x658e('0xb'));logger[_0x658e('0xc')]('Condition,\x20%s,\x20%s,\x20%s',_0x2ac481,_0x658e('0xb'),JSON[_0x658e('0xd')](_0x166f07));if(_0x166f07[_0x658e('0xe')]){if(_0x166f07[_0x658e('0xe')][_0x658e('0xf')]===0x1f4){logger['error'](_0x658e('0x10'),_0x2ac481,_0x166f07[_0x658e('0xe')][_0x658e('0x11')]);return _0x1c56b4(_0x166f07[_0x658e('0xe')][_0x658e('0x11')]);}logger[_0x658e('0xe')](_0x658e('0x10'),_0x2ac481,_0x166f07[_0x658e('0xe')][_0x658e('0x11')]);return _0x5cfdab(_0x166f07[_0x658e('0xe')][_0x658e('0x11')]);}else{logger[_0x658e('0x12')](_0x658e('0x10'),_0x2ac481,_0x658e('0xb'));_0x5cfdab(_0x166f07[_0x658e('0x13')][_0x658e('0x11')]);}})[_0x658e('0x14')](function(_0x3817ce){logger['error'](_0x658e('0x10'),_0x2ac481,_0x3817ce);_0x1c56b4(_0x3817ce);});});}