75bff09f685e76924702893bcb1420e2898c4bf9
[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 _0x52bf=['result','catch','lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','message'];(function(_0x1c7889,_0x24cd26){var _0x2f14e5=function(_0x9ae1b1){while(--_0x9ae1b1){_0x1c7889['push'](_0x1c7889['shift']());}};_0x2f14e5(++_0x24cd26);}(_0x52bf,0xbf));var _0xf52b=function(_0xd618ba,_0x4f7d17){_0xd618ba=_0xd618ba-0x0;var _0x237e4c=_0x52bf[_0xd618ba];return _0x237e4c;};'use strict';var _=require(_0xf52b('0x0'));var util=require(_0xf52b('0x1'));var moment=require(_0xf52b('0x2'));var BPromise=require(_0xf52b('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf52b('0x4'));var db=require(_0xf52b('0x5'))['db'];var utils=require(_0xf52b('0x6'));var logger=require(_0xf52b('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0xf52b('0x8'));var client=jayson[_0xf52b('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x182acf,_0x45c643,_0x51038e){return new BPromise(function(_0x93607d,_0x261e33){return client[_0xf52b('0xa')](_0x182acf,_0x51038e)[_0xf52b('0xb')](function(_0xe8301){logger[_0xf52b('0xc')](_0xf52b('0xd'),_0x45c643,_0xf52b('0xe'));logger[_0xf52b('0xf')](_0xf52b('0x10'),_0x45c643,'request\x20sent',JSON['stringify'](_0xe8301));if(_0xe8301[_0xf52b('0x11')]){if(_0xe8301['error']['code']===0x1f4){logger['error'](_0xf52b('0xd'),_0x45c643,_0xe8301[_0xf52b('0x11')]['message']);return _0x261e33(_0xe8301[_0xf52b('0x11')][_0xf52b('0x12')]);}logger[_0xf52b('0x11')](_0xf52b('0xd'),_0x45c643,_0xe8301['error'][_0xf52b('0x12')]);return _0x93607d(_0xe8301[_0xf52b('0x11')][_0xf52b('0x12')]);}else{logger[_0xf52b('0xc')](_0xf52b('0xd'),_0x45c643,_0xf52b('0xe'));_0x93607d(_0xe8301[_0xf52b('0x13')][_0xf52b('0x12')]);}})[_0xf52b('0x14')](function(_0xd58565){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x45c643,_0xd58565);_0x261e33(_0xd58565);});});}