Built motion from commit e1760111.|2.6.18
[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 _0xce22=['rpc','../../config/environment','jayson/promise','then','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils'];(function(_0x1969a7,_0x5a133a){var _0x3d665f=function(_0x39c64b){while(--_0x39c64b){_0x1969a7['push'](_0x1969a7['shift']());}};_0x3d665f(++_0x5a133a);}(_0xce22,0x1c2));var _0x2ce2=function(_0x22ac78,_0xea761e){_0x22ac78=_0x22ac78-0x0;var _0x4587c2=_0xce22[_0x22ac78];return _0x4587c2;};'use strict';var _=require('lodash');var util=require(_0x2ce2('0x0'));var moment=require(_0x2ce2('0x1'));var BPromise=require(_0x2ce2('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2ce2('0x3'));var db=require(_0x2ce2('0x4'))['db'];var utils=require(_0x2ce2('0x5'));var logger=require('../../config/logger')(_0x2ce2('0x6'));var config=require(_0x2ce2('0x7'));var jayson=require(_0x2ce2('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x442bf0,_0x1fe255,_0x803758){return new BPromise(function(_0x56283c,_0x2f2d07){return client['request'](_0x442bf0,_0x803758)[_0x2ce2('0x9')](function(_0x23611d){logger['info'](_0x2ce2('0xa'),_0x1fe255,'request\x20sent');logger[_0x2ce2('0xb')](_0x2ce2('0xc'),_0x1fe255,_0x2ce2('0xd'),JSON[_0x2ce2('0xe')](_0x23611d));if(_0x23611d[_0x2ce2('0xf')]){if(_0x23611d[_0x2ce2('0xf')][_0x2ce2('0x10')]===0x1f4){logger[_0x2ce2('0xf')](_0x2ce2('0xa'),_0x1fe255,_0x23611d[_0x2ce2('0xf')][_0x2ce2('0x11')]);return _0x2f2d07(_0x23611d[_0x2ce2('0xf')][_0x2ce2('0x11')]);}logger[_0x2ce2('0xf')](_0x2ce2('0xa'),_0x1fe255,_0x23611d[_0x2ce2('0xf')]['message']);return _0x56283c(_0x23611d[_0x2ce2('0xf')][_0x2ce2('0x11')]);}else{logger['info'](_0x2ce2('0xa'),_0x1fe255,'request\x20sent');_0x56283c(_0x23611d['result'][_0x2ce2('0x11')]);}})[_0x2ce2('0x12')](function(_0x513dad){logger['error'](_0x2ce2('0xa'),_0x1fe255,_0x513dad);_0x2f2d07(_0x513dad);});});}