d3c0338196568c6c691635f7e0ec93c122efbff8
[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 _0x5165=['ioredis','../../config/utils','../../config/logger','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','info','result','catch','lodash','util','moment','bluebird','randomstring'];(function(_0x27fd9e,_0x4cb1ed){var _0xc2fe24=function(_0x451486){while(--_0x451486){_0x27fd9e['push'](_0x27fd9e['shift']());}};_0xc2fe24(++_0x4cb1ed);}(_0x5165,0x1c9));var _0x5516=function(_0x49cf30,_0x56ff7c){_0x49cf30=_0x49cf30-0x0;var _0x2fff22=_0x5165[_0x49cf30];return _0x2fff22;};'use strict';var _=require(_0x5516('0x0'));var util=require(_0x5516('0x1'));var moment=require(_0x5516('0x2'));var BPromise=require(_0x5516('0x3'));var rs=require(_0x5516('0x4'));var fs=require('fs');var Redis=require(_0x5516('0x5'));var db=require('../../mysqldb')['db'];var utils=require(_0x5516('0x6'));var logger=require(_0x5516('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5516('0x8'));var client=jayson[_0x5516('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x23ef0f,_0x543de8,_0x5bc738){return new BPromise(function(_0x4f8e40,_0xfca5ff){return client[_0x5516('0xa')](_0x23ef0f,_0x5bc738)[_0x5516('0xb')](function(_0x1ac793){logger['info'](_0x5516('0xc'),_0x543de8,'request\x20sent');logger[_0x5516('0xd')](_0x5516('0xe'),_0x543de8,_0x5516('0xf'),JSON['stringify'](_0x1ac793));if(_0x1ac793[_0x5516('0x10')]){if(_0x1ac793[_0x5516('0x10')]['code']===0x1f4){logger[_0x5516('0x10')](_0x5516('0xc'),_0x543de8,_0x1ac793[_0x5516('0x10')][_0x5516('0x11')]);return _0xfca5ff(_0x1ac793[_0x5516('0x10')][_0x5516('0x11')]);}logger[_0x5516('0x10')](_0x5516('0xc'),_0x543de8,_0x1ac793[_0x5516('0x10')]['message']);return _0x4f8e40(_0x1ac793[_0x5516('0x10')][_0x5516('0x11')]);}else{logger[_0x5516('0x12')](_0x5516('0xc'),_0x543de8,_0x5516('0xf'));_0x4f8e40(_0x1ac793[_0x5516('0x13')][_0x5516('0x11')]);}})[_0x5516('0x14')](function(_0x45c28f){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x543de8,_0x45c28f);_0xfca5ff(_0x45c28f);});});}