f57bacc945cd650be0f9645615b0fbb619b58c19
[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 _0xad84=['http','request','info','UserChatQueue,\x20%s,\x20%s','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x35da42,_0x5c2610){var _0x370035=function(_0x546db5){while(--_0x546db5){_0x35da42['push'](_0x35da42['shift']());}};_0x370035(++_0x5c2610);}(_0xad84,0xf3));var _0x4ad8=function(_0x17d9e3,_0x1f969c){_0x17d9e3=_0x17d9e3-0x0;var _0x14192d=_0xad84[_0x17d9e3];return _0x14192d;};'use strict';var _=require('lodash');var util=require(_0x4ad8('0x0'));var moment=require('moment');var BPromise=require(_0x4ad8('0x1'));var rs=require(_0x4ad8('0x2'));var fs=require('fs');var Redis=require(_0x4ad8('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x4ad8('0x4'))(_0x4ad8('0x5'));var config=require(_0x4ad8('0x6'));var jayson=require(_0x4ad8('0x7'));var client=jayson[_0x4ad8('0x8')][_0x4ad8('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x11f817,_0x26a978,_0x5bb591){return new BPromise(function(_0x2e8abc,_0x2898e){return client[_0x4ad8('0xa')](_0x11f817,_0x5bb591)['then'](function(_0x42a1e1){logger[_0x4ad8('0xb')](_0x4ad8('0xc'),_0x26a978,'request\x20sent');logger[_0x4ad8('0xd')](_0x4ad8('0xe'),_0x26a978,_0x4ad8('0xf'),JSON['stringify'](_0x42a1e1));if(_0x42a1e1['error']){if(_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x11')]===0x1f4){logger['error'](_0x4ad8('0xc'),_0x26a978,_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);return _0x2898e(_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);}logger['error'](_0x4ad8('0xc'),_0x26a978,_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);return _0x2e8abc(_0x42a1e1[_0x4ad8('0x10')][_0x4ad8('0x12')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x26a978,_0x4ad8('0xf'));_0x2e8abc(_0x42a1e1[_0x4ad8('0x13')][_0x4ad8('0x12')]);}})[_0x4ad8('0x14')](function(_0x4fc99c){logger[_0x4ad8('0x10')](_0x4ad8('0xc'),_0x26a978,_0x4fc99c);_0x2898e(_0x4fc99c);});});}