Built motion from commit (unavailable).|2.5.21
[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 _0x19b9=['request','info','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','client','http'];(function(_0x2fa0ce,_0x1612e9){var _0x168c0=function(_0x269137){while(--_0x269137){_0x2fa0ce['push'](_0x2fa0ce['shift']());}};_0x168c0(++_0x1612e9);}(_0x19b9,0x192));var _0x919b=function(_0x474ba6,_0x529335){_0x474ba6=_0x474ba6-0x0;var _0x392bab=_0x19b9[_0x474ba6];return _0x392bab;};'use strict';var _=require(_0x919b('0x0'));var util=require(_0x919b('0x1'));var moment=require(_0x919b('0x2'));var BPromise=require(_0x919b('0x3'));var rs=require(_0x919b('0x4'));var fs=require('fs');var Redis=require(_0x919b('0x5'));var db=require(_0x919b('0x6'))['db'];var utils=require(_0x919b('0x7'));var logger=require(_0x919b('0x8'))(_0x919b('0x9'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x919b('0xa')][_0x919b('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x8f41f0,_0x10ba9f,_0x1039d9){return new BPromise(function(_0x22c149,_0x14c314){return client[_0x919b('0xc')](_0x8f41f0,_0x1039d9)['then'](function(_0xa1b144){logger[_0x919b('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x10ba9f,_0x919b('0xe'));logger[_0x919b('0xf')](_0x919b('0x10'),_0x10ba9f,'request\x20sent',JSON[_0x919b('0x11')](_0xa1b144));if(_0xa1b144[_0x919b('0x12')]){if(_0xa1b144[_0x919b('0x12')][_0x919b('0x13')]===0x1f4){logger[_0x919b('0x12')](_0x919b('0x14'),_0x10ba9f,_0xa1b144[_0x919b('0x12')]['message']);return _0x14c314(_0xa1b144[_0x919b('0x12')]['message']);}logger[_0x919b('0x12')](_0x919b('0x14'),_0x10ba9f,_0xa1b144[_0x919b('0x12')][_0x919b('0x15')]);return _0x22c149(_0xa1b144[_0x919b('0x12')][_0x919b('0x15')]);}else{logger[_0x919b('0xd')](_0x919b('0x14'),_0x10ba9f,_0x919b('0xe'));_0x22c149(_0xa1b144[_0x919b('0x16')]['message']);}})['catch'](function(_0x3f82dc){logger['error'](_0x919b('0x14'),_0x10ba9f,_0x3f82dc);_0x14c314(_0x3f82dc);});});}