Built motion from commit e1760111.|2.6.18
[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 _0x2356=['then','info','Tag,\x20%s,\x20%s','debug','Tag,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','util','moment','ioredis','../../mysqldb','rpc','client','http'];(function(_0x390e41,_0xde62e7){var _0x5f3381=function(_0xe86bdd){while(--_0xe86bdd){_0x390e41['push'](_0x390e41['shift']());}};_0x5f3381(++_0xde62e7);}(_0x2356,0x14f));var _0x6235=function(_0x55a1e6,_0x17c180){_0x55a1e6=_0x55a1e6-0x0;var _0x2235bb=_0x2356[_0x55a1e6];return _0x2235bb;};'use strict';var _=require('lodash');var util=require(_0x6235('0x0'));var moment=require(_0x6235('0x1'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x6235('0x2'));var db=require(_0x6235('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x6235('0x4'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x6235('0x5')][_0x6235('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x3663e7,_0x47f3a5,_0x4c15c6){return new BPromise(function(_0x547159,_0x3a5750){return client['request'](_0x3663e7,_0x4c15c6)[_0x6235('0x7')](function(_0x11d1f9){logger[_0x6235('0x8')](_0x6235('0x9'),_0x47f3a5,'request\x20sent');logger[_0x6235('0xa')](_0x6235('0xb'),_0x47f3a5,_0x6235('0xc'),JSON[_0x6235('0xd')](_0x11d1f9));if(_0x11d1f9[_0x6235('0xe')]){if(_0x11d1f9['error'][_0x6235('0xf')]===0x1f4){logger[_0x6235('0xe')](_0x6235('0x9'),_0x47f3a5,_0x11d1f9[_0x6235('0xe')]['message']);return _0x3a5750(_0x11d1f9[_0x6235('0xe')][_0x6235('0x10')]);}logger['error'](_0x6235('0x9'),_0x47f3a5,_0x11d1f9['error'][_0x6235('0x10')]);return _0x547159(_0x11d1f9[_0x6235('0xe')]['message']);}else{logger[_0x6235('0x8')](_0x6235('0x9'),_0x47f3a5,_0x6235('0xc'));_0x547159(_0x11d1f9[_0x6235('0x11')]['message']);}})[_0x6235('0x12')](function(_0x190d7c){logger[_0x6235('0xe')](_0x6235('0x9'),_0x47f3a5,_0x190d7c);_0x3a5750(_0x190d7c);});});}