Built motion from commit 37e1ed56.|2.6.29
[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 _0xf554=['lodash','util','moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch'];(function(_0x150e2e,_0x4ee6e8){var _0x4cd254=function(_0x1ea07e){while(--_0x1ea07e){_0x150e2e['push'](_0x150e2e['shift']());}};_0x4cd254(++_0x4ee6e8);}(_0xf554,0xfd));var _0x4f55=function(_0x1d25a2,_0x5e8f2f){_0x1d25a2=_0x1d25a2-0x0;var _0x596fed=_0xf554[_0x1d25a2];return _0x596fed;};'use strict';var _=require(_0x4f55('0x0'));var util=require(_0x4f55('0x1'));var moment=require(_0x4f55('0x2'));var BPromise=require(_0x4f55('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x4f55('0x4'));var db=require(_0x4f55('0x5'))['db'];var utils=require(_0x4f55('0x6'));var logger=require('../../config/logger')(_0x4f55('0x7'));var config=require(_0x4f55('0x8'));var jayson=require('jayson/promise');var client=jayson[_0x4f55('0x9')][_0x4f55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x37a6a5,_0x53d1d0,_0x41010d){return new BPromise(function(_0x157fce,_0x49ad21){return client[_0x4f55('0xb')](_0x37a6a5,_0x41010d)[_0x4f55('0xc')](function(_0x469b73){logger[_0x4f55('0xd')](_0x4f55('0xe'),_0x53d1d0,_0x4f55('0xf'));logger['debug'](_0x4f55('0x10'),_0x53d1d0,'request\x20sent',JSON[_0x4f55('0x11')](_0x469b73));if(_0x469b73[_0x4f55('0x12')]){if(_0x469b73[_0x4f55('0x12')][_0x4f55('0x13')]===0x1f4){logger[_0x4f55('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x53d1d0,_0x469b73[_0x4f55('0x12')][_0x4f55('0x14')]);return _0x49ad21(_0x469b73[_0x4f55('0x12')][_0x4f55('0x14')]);}logger[_0x4f55('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x53d1d0,_0x469b73[_0x4f55('0x12')][_0x4f55('0x14')]);return _0x157fce(_0x469b73[_0x4f55('0x12')][_0x4f55('0x14')]);}else{logger[_0x4f55('0xd')](_0x4f55('0xe'),_0x53d1d0,'request\x20sent');_0x157fce(_0x469b73[_0x4f55('0x15')][_0x4f55('0x14')]);}})[_0x4f55('0x16')](function(_0x2686ad){logger['error'](_0x4f55('0xe'),_0x53d1d0,_0x2686ad);_0x49ad21(_0x2686ad);});});}