53a8d2b98012b2f2f4738e5f467c031d5e95a430
[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 _0xc329=['bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','result','catch','lodash','util','moment'];(function(_0x18dc34,_0x205f71){var _0x4ab15b=function(_0x50572f){while(--_0x50572f){_0x18dc34['push'](_0x18dc34['shift']());}};_0x4ab15b(++_0x205f71);}(_0xc329,0x105));var _0x9c32=function(_0x4eaa4c,_0x2f7422){_0x4eaa4c=_0x4eaa4c-0x0;var _0x15aec6=_0xc329[_0x4eaa4c];return _0x15aec6;};'use strict';var _=require(_0x9c32('0x0'));var util=require(_0x9c32('0x1'));var moment=require(_0x9c32('0x2'));var BPromise=require(_0x9c32('0x3'));var rs=require(_0x9c32('0x4'));var fs=require('fs');var Redis=require(_0x9c32('0x5'));var db=require(_0x9c32('0x6'))['db'];var utils=require(_0x9c32('0x7'));var logger=require(_0x9c32('0x8'))(_0x9c32('0x9'));var config=require(_0x9c32('0xa'));var jayson=require(_0x9c32('0xb'));var client=jayson[_0x9c32('0xc')][_0x9c32('0xd')]({'port':0x232a});function respondWithRpcPromise(_0x366200,_0x16203a,_0x57219b){return new BPromise(function(_0x4ef77c,_0x206912){return client[_0x9c32('0xe')](_0x366200,_0x57219b)['then'](function(_0x3976e0){logger[_0x9c32('0xf')](_0x9c32('0x10'),_0x16203a,_0x9c32('0x11'));logger[_0x9c32('0x12')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x16203a,_0x9c32('0x11'),JSON['stringify'](_0x3976e0));if(_0x3976e0['error']){if(_0x3976e0[_0x9c32('0x13')][_0x9c32('0x14')]===0x1f4){logger['error'](_0x9c32('0x10'),_0x16203a,_0x3976e0[_0x9c32('0x13')][_0x9c32('0x15')]);return _0x206912(_0x3976e0[_0x9c32('0x13')]['message']);}logger['error'](_0x9c32('0x10'),_0x16203a,_0x3976e0[_0x9c32('0x13')][_0x9c32('0x15')]);return _0x4ef77c(_0x3976e0[_0x9c32('0x13')][_0x9c32('0x15')]);}else{logger[_0x9c32('0xf')](_0x9c32('0x10'),_0x16203a,_0x9c32('0x11'));_0x4ef77c(_0x3976e0[_0x9c32('0x16')][_0x9c32('0x15')]);}})[_0x9c32('0x17')](function(_0xcd14df){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x16203a,_0xcd14df);_0x206912(_0xcd14df);});});}