Built motion from commit fa4c4286.|2.6.29
[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 _0x3285=['../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','http','request','then','request\x20sent','debug','Condition,\x20%s,\x20%s,\x20%s','stringify','error','code','Condition,\x20%s,\x20%s','message','info','result','catch','lodash','util','moment','randomstring','ioredis','../../mysqldb'];(function(_0x2f3ecd,_0x57976b){var _0xffdc44=function(_0xf21bc6){while(--_0xf21bc6){_0x2f3ecd['push'](_0x2f3ecd['shift']());}};_0xffdc44(++_0x57976b);}(_0x3285,0x1ee));var _0x5328=function(_0x413feb,_0x10477f){_0x413feb=_0x413feb-0x0;var _0x40ee88=_0x3285[_0x413feb];return _0x40ee88;};'use strict';var _=require(_0x5328('0x0'));var util=require(_0x5328('0x1'));var moment=require(_0x5328('0x2'));var BPromise=require('bluebird');var rs=require(_0x5328('0x3'));var fs=require('fs');var Redis=require(_0x5328('0x4'));var db=require(_0x5328('0x5'))['db'];var utils=require(_0x5328('0x6'));var logger=require(_0x5328('0x7'))(_0x5328('0x8'));var config=require(_0x5328('0x9'));var jayson=require(_0x5328('0xa'));var client=jayson['client'][_0x5328('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x1047a9,_0x4500a1,_0x219823){return new BPromise(function(_0x1c8549,_0x129660){return client[_0x5328('0xc')](_0x1047a9,_0x219823)[_0x5328('0xd')](function(_0x277e0b){logger['info']('Condition,\x20%s,\x20%s',_0x4500a1,_0x5328('0xe'));logger[_0x5328('0xf')](_0x5328('0x10'),_0x4500a1,_0x5328('0xe'),JSON[_0x5328('0x11')](_0x277e0b));if(_0x277e0b[_0x5328('0x12')]){if(_0x277e0b[_0x5328('0x12')][_0x5328('0x13')]===0x1f4){logger[_0x5328('0x12')](_0x5328('0x14'),_0x4500a1,_0x277e0b['error'][_0x5328('0x15')]);return _0x129660(_0x277e0b[_0x5328('0x12')]['message']);}logger[_0x5328('0x12')](_0x5328('0x14'),_0x4500a1,_0x277e0b[_0x5328('0x12')][_0x5328('0x15')]);return _0x1c8549(_0x277e0b[_0x5328('0x12')][_0x5328('0x15')]);}else{logger[_0x5328('0x16')](_0x5328('0x14'),_0x4500a1,'request\x20sent');_0x1c8549(_0x277e0b[_0x5328('0x17')][_0x5328('0x15')]);}})[_0x5328('0x18')](function(_0x5f3025){logger['error'](_0x5328('0x14'),_0x4500a1,_0x5f3025);_0x129660(_0x5f3025);});});}