Built motion from commit (unavailable).|2.4.4
[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 _0xb468=['then','info','Tag,\x20%s,\x20%s','request\x20sent','error','code','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','request'];(function(_0xe75d70,_0x384127){var _0x4177e0=function(_0x17f3bb){while(--_0x17f3bb){_0xe75d70['push'](_0xe75d70['shift']());}};_0x4177e0(++_0x384127);}(_0xb468,0x15c));var _0x8b46=function(_0x5f0089,_0x227e2c){_0x5f0089=_0x5f0089-0x0;var _0x193892=_0xb468[_0x5f0089];return _0x193892;};'use strict';var _=require(_0x8b46('0x0'));var util=require(_0x8b46('0x1'));var moment=require(_0x8b46('0x2'));var BPromise=require(_0x8b46('0x3'));var rs=require(_0x8b46('0x4'));var fs=require('fs');var Redis=require(_0x8b46('0x5'));var db=require(_0x8b46('0x6'))['db'];var utils=require(_0x8b46('0x7'));var logger=require(_0x8b46('0x8'))(_0x8b46('0x9'));var config=require(_0x8b46('0xa'));var jayson=require('jayson/promise');var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x13a4df,_0x78a75c,_0x4d293d){return new BPromise(function(_0x42423c,_0x600ee9){return client[_0x8b46('0xb')](_0x13a4df,_0x4d293d)[_0x8b46('0xc')](function(_0x4d03b9){logger[_0x8b46('0xd')](_0x8b46('0xe'),_0x78a75c,_0x8b46('0xf'));logger['debug']('Tag,\x20%s,\x20%s,\x20%s',_0x78a75c,'request\x20sent',JSON['stringify'](_0x4d03b9));if(_0x4d03b9[_0x8b46('0x10')]){if(_0x4d03b9['error'][_0x8b46('0x11')]===0x1f4){logger['error'](_0x8b46('0xe'),_0x78a75c,_0x4d03b9[_0x8b46('0x10')][_0x8b46('0x12')]);return _0x600ee9(_0x4d03b9[_0x8b46('0x10')]['message']);}logger[_0x8b46('0x10')](_0x8b46('0xe'),_0x78a75c,_0x4d03b9['error'][_0x8b46('0x12')]);return _0x42423c(_0x4d03b9[_0x8b46('0x10')][_0x8b46('0x12')]);}else{logger[_0x8b46('0xd')]('Tag,\x20%s,\x20%s',_0x78a75c,_0x8b46('0xf'));_0x42423c(_0x4d03b9[_0x8b46('0x13')][_0x8b46('0x12')]);}})['catch'](function(_0x3184b3){logger['error'](_0x8b46('0xe'),_0x78a75c,_0x3184b3);_0x600ee9(_0x3184b3);});});}