Built motion from commit 497d3d92.|2.5.43
[motion2.git] / server / api / tag / tag.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 _0xb717=['../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','Tag,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','result','catch','lodash','moment','randomstring','ioredis'];(function(_0x3a3608,_0xdb73a7){var _0x1dae4f=function(_0x5f0a16){while(--_0x5f0a16){_0x3a3608['push'](_0x3a3608['shift']());}};_0x1dae4f(++_0xdb73a7);}(_0xb717,0x1b4));var _0x7b71=function(_0x3b3fbb,_0x1ca949){_0x3b3fbb=_0x3b3fbb-0x0;var _0x161936=_0xb717[_0x3b3fbb];return _0x161936;};'use strict';var _=require(_0x7b71('0x0'));var util=require('util');var moment=require(_0x7b71('0x1'));var BPromise=require('bluebird');var rs=require(_0x7b71('0x2'));var fs=require('fs');var Redis=require(_0x7b71('0x3'));var db=require(_0x7b71('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x7b71('0x5'))(_0x7b71('0x6'));var config=require(_0x7b71('0x7'));var jayson=require(_0x7b71('0x8'));var client=jayson[_0x7b71('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x217efe,_0x27b060,_0xd81a5c){return new BPromise(function(_0x4238f6,_0xc46853){return client['request'](_0x217efe,_0xd81a5c)[_0x7b71('0xa')](function(_0x3e13a1){logger['info'](_0x7b71('0xb'),_0x27b060,_0x7b71('0xc'));logger[_0x7b71('0xd')]('Tag,\x20%s,\x20%s,\x20%s',_0x27b060,_0x7b71('0xc'),JSON['stringify'](_0x3e13a1));if(_0x3e13a1[_0x7b71('0xe')]){if(_0x3e13a1['error'][_0x7b71('0xf')]===0x1f4){logger[_0x7b71('0xe')](_0x7b71('0xb'),_0x27b060,_0x3e13a1[_0x7b71('0xe')][_0x7b71('0x10')]);return _0xc46853(_0x3e13a1['error'][_0x7b71('0x10')]);}logger['error'](_0x7b71('0xb'),_0x27b060,_0x3e13a1[_0x7b71('0xe')]['message']);return _0x4238f6(_0x3e13a1[_0x7b71('0xe')][_0x7b71('0x10')]);}else{logger[_0x7b71('0x11')]('Tag,\x20%s,\x20%s',_0x27b060,'request\x20sent');_0x4238f6(_0x3e13a1[_0x7b71('0x12')][_0x7b71('0x10')]);}})[_0x7b71('0x13')](function(_0x1b5d57){logger['error'](_0x7b71('0xb'),_0x27b060,_0x1b5d57);_0xc46853(_0x1b5d57);});});}