82cf2f5c7df7840f1d709e31c49e3e7e662429e7
[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 _0x8f38=['util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','then','info','request\x20sent','stringify','error','code','message','UserChatQueue,\x20%s,\x20%s','catch','lodash'];(function(_0x43e042,_0x1223f9){var _0x2ee198=function(_0x18adce){while(--_0x18adce){_0x43e042['push'](_0x43e042['shift']());}};_0x2ee198(++_0x1223f9);}(_0x8f38,0x7d));var _0x88f3=function(_0x277fa3,_0x3b2dde){_0x277fa3=_0x277fa3-0x0;var _0x2e4520=_0x8f38[_0x277fa3];return _0x2e4520;};'use strict';var _=require(_0x88f3('0x0'));var util=require(_0x88f3('0x1'));var moment=require(_0x88f3('0x2'));var BPromise=require(_0x88f3('0x3'));var rs=require(_0x88f3('0x4'));var fs=require('fs');var Redis=require(_0x88f3('0x5'));var db=require(_0x88f3('0x6'))['db'];var utils=require(_0x88f3('0x7'));var logger=require('../../config/logger')(_0x88f3('0x8'));var config=require(_0x88f3('0x9'));var jayson=require(_0x88f3('0xa'));var client=jayson[_0x88f3('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x103579,_0x5632a9,_0x1e2aca){return new BPromise(function(_0xf71b95,_0x5eb0ab){return client['request'](_0x103579,_0x1e2aca)[_0x88f3('0xc')](function(_0x348c5c){logger[_0x88f3('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x5632a9,_0x88f3('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x5632a9,_0x88f3('0xe'),JSON[_0x88f3('0xf')](_0x348c5c));if(_0x348c5c[_0x88f3('0x10')]){if(_0x348c5c[_0x88f3('0x10')][_0x88f3('0x11')]===0x1f4){logger[_0x88f3('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x5632a9,_0x348c5c[_0x88f3('0x10')]['message']);return _0x5eb0ab(_0x348c5c[_0x88f3('0x10')][_0x88f3('0x12')]);}logger[_0x88f3('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x5632a9,_0x348c5c[_0x88f3('0x10')][_0x88f3('0x12')]);return _0xf71b95(_0x348c5c[_0x88f3('0x10')]['message']);}else{logger['info'](_0x88f3('0x13'),_0x5632a9,_0x88f3('0xe'));_0xf71b95(_0x348c5c['result'][_0x88f3('0x12')]);}})[_0x88f3('0x14')](function(_0x21b489){logger['error'](_0x88f3('0x13'),_0x5632a9,_0x21b489);_0x5eb0ab(_0x21b489);});});}