fd097ef6915f15511de8fb965f6d4822d67cf7fd
[motion2.git] / server / api / userChatQueue / userChatQueue.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 _0x62d8=['ioredis','../../config/logger','rpc','jayson/promise','client','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring'];(function(_0x421584,_0x2f0b95){var _0xa37ccb=function(_0x24926c){while(--_0x24926c){_0x421584['push'](_0x421584['shift']());}};_0xa37ccb(++_0x2f0b95);}(_0x62d8,0x13b));var _0x862d=function(_0x3947c9,_0x4d6c97){_0x3947c9=_0x3947c9-0x0;var _0x2e7871=_0x62d8[_0x3947c9];return _0x2e7871;};'use strict';var _=require(_0x862d('0x0'));var util=require(_0x862d('0x1'));var moment=require(_0x862d('0x2'));var BPromise=require(_0x862d('0x3'));var rs=require(_0x862d('0x4'));var fs=require('fs');var Redis=require(_0x862d('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x862d('0x6'))(_0x862d('0x7'));var config=require('../../config/environment');var jayson=require(_0x862d('0x8'));var client=jayson[_0x862d('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x3327bb,_0xf99bd4,_0xbd81f5){return new BPromise(function(_0x18de24,_0x388864){return client['request'](_0x3327bb,_0xbd81f5)[_0x862d('0xa')](function(_0x408e04){logger['info'](_0x862d('0xb'),_0xf99bd4,_0x862d('0xc'));logger[_0x862d('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0xf99bd4,_0x862d('0xc'),JSON[_0x862d('0xe')](_0x408e04));if(_0x408e04['error']){if(_0x408e04[_0x862d('0xf')][_0x862d('0x10')]===0x1f4){logger[_0x862d('0xf')]('UserChatQueue,\x20%s,\x20%s',_0xf99bd4,_0x408e04[_0x862d('0xf')][_0x862d('0x11')]);return _0x388864(_0x408e04[_0x862d('0xf')][_0x862d('0x11')]);}logger[_0x862d('0xf')](_0x862d('0xb'),_0xf99bd4,_0x408e04[_0x862d('0xf')]['message']);return _0x18de24(_0x408e04['error'][_0x862d('0x11')]);}else{logger[_0x862d('0x12')]('UserChatQueue,\x20%s,\x20%s',_0xf99bd4,_0x862d('0xc'));_0x18de24(_0x408e04[_0x862d('0x13')][_0x862d('0x11')]);}})['catch'](function(_0x34baf4){logger[_0x862d('0xf')](_0x862d('0xb'),_0xf99bd4,_0x34baf4);_0x388864(_0x34baf4);});});}