ca0113b696952eb2f506738008da7846c3bb0708
[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 _0x6476=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','catch','util','moment','bluebird','randomstring','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug'];(function(_0x4e44d1,_0x15d7f6){var _0x527095=function(_0x43f17f){while(--_0x43f17f){_0x4e44d1['push'](_0x4e44d1['shift']());}};_0x527095(++_0x15d7f6);}(_0x6476,0xf9));var _0x6647=function(_0x54d4fe,_0x55e869){_0x54d4fe=_0x54d4fe-0x0;var _0x1ab5bb=_0x6476[_0x54d4fe];return _0x1ab5bb;};'use strict';var _=require('lodash');var util=require(_0x6647('0x0'));var moment=require(_0x6647('0x1'));var BPromise=require(_0x6647('0x2'));var rs=require(_0x6647('0x3'));var fs=require('fs');var Redis=require(_0x6647('0x4'));var db=require('../../mysqldb')['db'];var utils=require(_0x6647('0x5'));var logger=require(_0x6647('0x6'))(_0x6647('0x7'));var config=require(_0x6647('0x8'));var jayson=require(_0x6647('0x9'));var client=jayson[_0x6647('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x587714,_0x141745,_0x4db61f){return new BPromise(function(_0x318a96,_0x31e3b3){return client['request'](_0x587714,_0x4db61f)[_0x6647('0xb')](function(_0x31d4bc){logger['info'](_0x6647('0xc'),_0x141745,_0x6647('0xd'));logger[_0x6647('0xe')](_0x6647('0xf'),_0x141745,_0x6647('0xd'),JSON[_0x6647('0x10')](_0x31d4bc));if(_0x31d4bc['error']){if(_0x31d4bc[_0x6647('0x11')]['code']===0x1f4){logger[_0x6647('0x11')](_0x6647('0xc'),_0x141745,_0x31d4bc['error'][_0x6647('0x12')]);return _0x31e3b3(_0x31d4bc[_0x6647('0x11')][_0x6647('0x12')]);}logger[_0x6647('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x141745,_0x31d4bc['error'][_0x6647('0x12')]);return _0x318a96(_0x31d4bc[_0x6647('0x11')]['message']);}else{logger[_0x6647('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x141745,'request\x20sent');_0x318a96(_0x31d4bc[_0x6647('0x14')][_0x6647('0x12')]);}})[_0x6647('0x15')](function(_0x782577){logger[_0x6647('0x11')](_0x6647('0xc'),_0x141745,_0x782577);_0x31e3b3(_0x782577);});});}