aa266ff21491ab808d13e6f09683a3927bdb21a9
[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 _0x5eb4=['../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','info','result','catch','util','bluebird','randomstring','ioredis','../../mysqldb'];(function(_0x1da04e,_0x31024b){var _0xdd8c41=function(_0x2036f9){while(--_0x2036f9){_0x1da04e['push'](_0x1da04e['shift']());}};_0xdd8c41(++_0x31024b);}(_0x5eb4,0x69));var _0x45eb=function(_0xdf638d,_0x38fce0){_0xdf638d=_0xdf638d-0x0;var _0x56d6be=_0x5eb4[_0xdf638d];return _0x56d6be;};'use strict';var _=require('lodash');var util=require(_0x45eb('0x0'));var moment=require('moment');var BPromise=require(_0x45eb('0x1'));var rs=require(_0x45eb('0x2'));var fs=require('fs');var Redis=require(_0x45eb('0x3'));var db=require(_0x45eb('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x45eb('0x5'))(_0x45eb('0x6'));var config=require(_0x45eb('0x7'));var jayson=require(_0x45eb('0x8'));var client=jayson[_0x45eb('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x12c580,_0x4b73f1,_0x16e139){return new BPromise(function(_0x1ca2e8,_0x5a8c54){return client[_0x45eb('0xa')](_0x12c580,_0x16e139)[_0x45eb('0xb')](function(_0x1a9fa7){logger['info'](_0x45eb('0xc'),_0x4b73f1,_0x45eb('0xd'));logger[_0x45eb('0xe')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x4b73f1,_0x45eb('0xd'),JSON[_0x45eb('0xf')](_0x1a9fa7));if(_0x1a9fa7[_0x45eb('0x10')]){if(_0x1a9fa7[_0x45eb('0x10')][_0x45eb('0x11')]===0x1f4){logger[_0x45eb('0x10')](_0x45eb('0xc'),_0x4b73f1,_0x1a9fa7[_0x45eb('0x10')]['message']);return _0x5a8c54(_0x1a9fa7[_0x45eb('0x10')]['message']);}logger[_0x45eb('0x10')](_0x45eb('0xc'),_0x4b73f1,_0x1a9fa7[_0x45eb('0x10')][_0x45eb('0x12')]);return _0x1ca2e8(_0x1a9fa7[_0x45eb('0x10')][_0x45eb('0x12')]);}else{logger[_0x45eb('0x13')]('UserChatQueue,\x20%s,\x20%s',_0x4b73f1,_0x45eb('0xd'));_0x1ca2e8(_0x1a9fa7[_0x45eb('0x14')][_0x45eb('0x12')]);}})[_0x45eb('0x15')](function(_0x219a86){logger[_0x45eb('0x10')](_0x45eb('0xc'),_0x4b73f1,_0x219a86);_0x5a8c54(_0x219a86);});});}