Built motion from commit (unavailable).|2.4.3
[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 _0x356d=['UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','bluebird','ioredis','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info'];(function(_0xe6f0ef,_0x2778f7){var _0xbb19af=function(_0x13b0d0){while(--_0x13b0d0){_0xe6f0ef['push'](_0xe6f0ef['shift']());}};_0xbb19af(++_0x2778f7);}(_0x356d,0x199));var _0xd356=function(_0x105342,_0x5fb601){_0x105342=_0x105342-0x0;var _0x52b1d9=_0x356d[_0x105342];return _0x52b1d9;};'use strict';var _=require(_0xd356('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xd356('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xd356('0x2'));var db=require(_0xd356('0x3'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0xd356('0x4'));var jayson=require(_0xd356('0x5'));var client=jayson[_0xd356('0x6')][_0xd356('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x463a9e,_0x396bb8,_0x1fafb0){return new BPromise(function(_0x255e7b,_0x588586){return client[_0xd356('0x8')](_0x463a9e,_0x1fafb0)[_0xd356('0x9')](function(_0x2e86fb){logger[_0xd356('0xa')](_0xd356('0xb'),_0x396bb8,_0xd356('0xc'));logger[_0xd356('0xd')](_0xd356('0xe'),_0x396bb8,_0xd356('0xc'),JSON[_0xd356('0xf')](_0x2e86fb));if(_0x2e86fb['error']){if(_0x2e86fb[_0xd356('0x10')][_0xd356('0x11')]===0x1f4){logger[_0xd356('0x10')](_0xd356('0xb'),_0x396bb8,_0x2e86fb[_0xd356('0x10')]['message']);return _0x588586(_0x2e86fb[_0xd356('0x10')][_0xd356('0x12')]);}logger[_0xd356('0x10')](_0xd356('0xb'),_0x396bb8,_0x2e86fb[_0xd356('0x10')]['message']);return _0x255e7b(_0x2e86fb[_0xd356('0x10')][_0xd356('0x12')]);}else{logger[_0xd356('0xa')](_0xd356('0xb'),_0x396bb8,_0xd356('0xc'));_0x255e7b(_0x2e86fb['result']['message']);}})[_0xd356('0x13')](function(_0x1badc1){logger[_0xd356('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x396bb8,_0x1badc1);_0x588586(_0x1badc1);});});}