Built motion from commit 87cd5f02.|2.5.48
[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 _0x8338=['lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','jayson/promise','request','then','UserChatQueue,\x20%s,\x20%s','debug','request\x20sent','error','code','message','result','catch'];(function(_0x11ccd2,_0x4d37fc){var _0x1fb694=function(_0x35836b){while(--_0x35836b){_0x11ccd2['push'](_0x11ccd2['shift']());}};_0x1fb694(++_0x4d37fc);}(_0x8338,0x190));var _0x8833=function(_0x57a576,_0x6f0ba){_0x57a576=_0x57a576-0x0;var _0x392cb3=_0x8338[_0x57a576];return _0x392cb3;};'use strict';var _=require(_0x8833('0x0'));var util=require(_0x8833('0x1'));var moment=require(_0x8833('0x2'));var BPromise=require(_0x8833('0x3'));var rs=require(_0x8833('0x4'));var fs=require('fs');var Redis=require(_0x8833('0x5'));var db=require(_0x8833('0x6'))['db'];var utils=require('../../config/utils');var logger=require(_0x8833('0x7'))(_0x8833('0x8'));var config=require('../../config/environment');var jayson=require(_0x8833('0x9'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x661b4,_0x3a72ec,_0x19f218){return new BPromise(function(_0x24e026,_0x228be0){return client[_0x8833('0xa')](_0x661b4,_0x19f218)[_0x8833('0xb')](function(_0x31abb6){logger['info'](_0x8833('0xc'),_0x3a72ec,'request\x20sent');logger[_0x8833('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x3a72ec,_0x8833('0xe'),JSON['stringify'](_0x31abb6));if(_0x31abb6[_0x8833('0xf')]){if(_0x31abb6[_0x8833('0xf')][_0x8833('0x10')]===0x1f4){logger[_0x8833('0xf')](_0x8833('0xc'),_0x3a72ec,_0x31abb6[_0x8833('0xf')][_0x8833('0x11')]);return _0x228be0(_0x31abb6[_0x8833('0xf')][_0x8833('0x11')]);}logger[_0x8833('0xf')](_0x8833('0xc'),_0x3a72ec,_0x31abb6[_0x8833('0xf')][_0x8833('0x11')]);return _0x24e026(_0x31abb6[_0x8833('0xf')][_0x8833('0x11')]);}else{logger['info'](_0x8833('0xc'),_0x3a72ec,_0x8833('0xe'));_0x24e026(_0x31abb6[_0x8833('0x12')][_0x8833('0x11')]);}})[_0x8833('0x13')](function(_0x6765bb){logger[_0x8833('0xf')](_0x8833('0xc'),_0x3a72ec,_0x6765bb);_0x228be0(_0x6765bb);});});}