c5d98f7741818b13aff2d35a72a8395b599fdb29
[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 _0xb5e2=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','info','result','util','bluebird','randomstring','ioredis','../../mysqldb','rpc','jayson/promise','http','then','request\x20sent'];(function(_0x4d90ae,_0x5b5b41){var _0x4603db=function(_0x5da1d3){while(--_0x5da1d3){_0x4d90ae['push'](_0x4d90ae['shift']());}};_0x4603db(++_0x5b5b41);}(_0xb5e2,0xe0));var _0x2b5e=function(_0x2b9c4f,_0x33abc9){_0x2b9c4f=_0x2b9c4f-0x0;var _0x42a8c8=_0xb5e2[_0x2b9c4f];return _0x42a8c8;};'use strict';var _=require('lodash');var util=require(_0x2b5e('0x0'));var moment=require('moment');var BPromise=require(_0x2b5e('0x1'));var rs=require(_0x2b5e('0x2'));var fs=require('fs');var Redis=require(_0x2b5e('0x3'));var db=require(_0x2b5e('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')(_0x2b5e('0x5'));var config=require('../../config/environment');var jayson=require(_0x2b5e('0x6'));var client=jayson['client'][_0x2b5e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x3b9b78,_0x1244c4,_0xdc7e3){return new BPromise(function(_0x3792af,_0x9e1ffd){return client['request'](_0x3b9b78,_0xdc7e3)[_0x2b5e('0x8')](function(_0x42eeac){logger['info']('UserChatQueue,\x20%s,\x20%s',_0x1244c4,_0x2b5e('0x9'));logger['debug'](_0x2b5e('0xa'),_0x1244c4,_0x2b5e('0x9'),JSON[_0x2b5e('0xb')](_0x42eeac));if(_0x42eeac['error']){if(_0x42eeac[_0x2b5e('0xc')][_0x2b5e('0xd')]===0x1f4){logger[_0x2b5e('0xc')](_0x2b5e('0xe'),_0x1244c4,_0x42eeac[_0x2b5e('0xc')][_0x2b5e('0xf')]);return _0x9e1ffd(_0x42eeac[_0x2b5e('0xc')]['message']);}logger[_0x2b5e('0xc')](_0x2b5e('0xe'),_0x1244c4,_0x42eeac[_0x2b5e('0xc')]['message']);return _0x3792af(_0x42eeac[_0x2b5e('0xc')][_0x2b5e('0xf')]);}else{logger[_0x2b5e('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x1244c4,'request\x20sent');_0x3792af(_0x42eeac[_0x2b5e('0x11')]['message']);}})['catch'](function(_0x9cea9c){logger[_0x2b5e('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x1244c4,_0x9cea9c);_0x9e1ffd(_0x9cea9c);});});}