263ffffe5c7e74f07d6892fdd7741331d2f6191f
[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 _0x5988=['ioredis','../../mysqldb','../../config/utils','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','catch','moment','bluebird','randomstring'];(function(_0x4b6fad,_0x2c9f02){var _0x18f75e=function(_0x16a20e){while(--_0x16a20e){_0x4b6fad['push'](_0x4b6fad['shift']());}};_0x18f75e(++_0x2c9f02);}(_0x5988,0x1bf));var _0x8598=function(_0x45b034,_0x3a57dd){_0x45b034=_0x45b034-0x0;var _0x509cb0=_0x5988[_0x45b034];return _0x509cb0;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x8598('0x0'));var BPromise=require(_0x8598('0x1'));var rs=require(_0x8598('0x2'));var fs=require('fs');var Redis=require(_0x8598('0x3'));var db=require(_0x8598('0x4'))['db'];var utils=require(_0x8598('0x5'));var logger=require('../../config/logger')('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson['client'][_0x8598('0x6')]({'port':0x232a});function respondWithRpcPromise(_0x17c8ed,_0x1270c3,_0xbbfa74){return new BPromise(function(_0x1cd249,_0x32635c){return client[_0x8598('0x7')](_0x17c8ed,_0xbbfa74)[_0x8598('0x8')](function(_0x2c5785){logger[_0x8598('0x9')](_0x8598('0xa'),_0x1270c3,'request\x20sent');logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x1270c3,_0x8598('0xb'),JSON[_0x8598('0xc')](_0x2c5785));if(_0x2c5785[_0x8598('0xd')]){if(_0x2c5785[_0x8598('0xd')][_0x8598('0xe')]===0x1f4){logger[_0x8598('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x1270c3,_0x2c5785['error'][_0x8598('0xf')]);return _0x32635c(_0x2c5785[_0x8598('0xd')][_0x8598('0xf')]);}logger[_0x8598('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x1270c3,_0x2c5785[_0x8598('0xd')]['message']);return _0x1cd249(_0x2c5785[_0x8598('0xd')]['message']);}else{logger[_0x8598('0x9')](_0x8598('0xa'),_0x1270c3,_0x8598('0xb'));_0x1cd249(_0x2c5785[_0x8598('0x10')][_0x8598('0xf')]);}})[_0x8598('0x11')](function(_0x402271){logger['error'](_0x8598('0xa'),_0x1270c3,_0x402271);_0x32635c(_0x402271);});});}