5a84214480ab5f2c6729fe2feb6070532dc96584
[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 _0x64e1=['error','code','message','result','util','moment','bluebird','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x40a045,_0x516f0e){var _0x1a687c=function(_0x48c9fe){while(--_0x48c9fe){_0x40a045['push'](_0x40a045['shift']());}};_0x1a687c(++_0x516f0e);}(_0x64e1,0x97));var _0x164e=function(_0x5860a8,_0x568756){_0x5860a8=_0x5860a8-0x0;var _0x539dab=_0x64e1[_0x5860a8];return _0x539dab;};'use strict';var _=require('lodash');var util=require(_0x164e('0x0'));var moment=require(_0x164e('0x1'));var BPromise=require(_0x164e('0x2'));var rs=require(_0x164e('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x164e('0x4'))['db'];var utils=require(_0x164e('0x5'));var logger=require(_0x164e('0x6'))(_0x164e('0x7'));var config=require('../../config/environment');var jayson=require(_0x164e('0x8'));var client=jayson[_0x164e('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x269dac,_0x275df9,_0x5e5538){return new BPromise(function(_0x493f2a,_0x2e49f5){return client[_0x164e('0xa')](_0x269dac,_0x5e5538)[_0x164e('0xb')](function(_0x45b295){logger['info'](_0x164e('0xc'),_0x275df9,_0x164e('0xd'));logger[_0x164e('0xe')](_0x164e('0xf'),_0x275df9,_0x164e('0xd'),JSON[_0x164e('0x10')](_0x45b295));if(_0x45b295['error']){if(_0x45b295[_0x164e('0x11')][_0x164e('0x12')]===0x1f4){logger[_0x164e('0x11')](_0x164e('0xc'),_0x275df9,_0x45b295[_0x164e('0x11')]['message']);return _0x2e49f5(_0x45b295['error'][_0x164e('0x13')]);}logger['error'](_0x164e('0xc'),_0x275df9,_0x45b295[_0x164e('0x11')][_0x164e('0x13')]);return _0x493f2a(_0x45b295[_0x164e('0x11')][_0x164e('0x13')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x275df9,_0x164e('0xd'));_0x493f2a(_0x45b295[_0x164e('0x14')][_0x164e('0x13')]);}})['catch'](function(_0x3cecea){logger[_0x164e('0x11')](_0x164e('0xc'),_0x275df9,_0x3cecea);_0x2e49f5(_0x3cecea);});});}