4dcd4ca8f8cc13d34033f15661e6be9b070f60fd
[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 _0x6e32=['http','request','then','info','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','randomstring','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client'];(function(_0x3b5770,_0x528c54){var _0x366d39=function(_0x3e1214){while(--_0x3e1214){_0x3b5770['push'](_0x3b5770['shift']());}};_0x366d39(++_0x528c54);}(_0x6e32,0x14f));var _0x26e3=function(_0x2b8917,_0x51f4e6){_0x2b8917=_0x2b8917-0x0;var _0x554812=_0x6e32[_0x2b8917];return _0x554812;};'use strict';var _=require(_0x26e3('0x0'));var util=require(_0x26e3('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x26e3('0x2'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x26e3('0x3'))['db'];var utils=require(_0x26e3('0x4'));var logger=require(_0x26e3('0x5'))(_0x26e3('0x6'));var config=require(_0x26e3('0x7'));var jayson=require(_0x26e3('0x8'));var client=jayson[_0x26e3('0x9')][_0x26e3('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x564b79,_0x28f99d,_0x452162){return new BPromise(function(_0x232c25,_0x3c0db4){return client[_0x26e3('0xb')](_0x564b79,_0x452162)[_0x26e3('0xc')](function(_0x2a023b){logger[_0x26e3('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x28f99d,_0x26e3('0xe'));logger['debug'](_0x26e3('0xf'),_0x28f99d,_0x26e3('0xe'),JSON[_0x26e3('0x10')](_0x2a023b));if(_0x2a023b[_0x26e3('0x11')]){if(_0x2a023b[_0x26e3('0x11')][_0x26e3('0x12')]===0x1f4){logger['error'](_0x26e3('0x13'),_0x28f99d,_0x2a023b['error'][_0x26e3('0x14')]);return _0x3c0db4(_0x2a023b[_0x26e3('0x11')]['message']);}logger['error']('UserChatQueue,\x20%s,\x20%s',_0x28f99d,_0x2a023b[_0x26e3('0x11')][_0x26e3('0x14')]);return _0x232c25(_0x2a023b[_0x26e3('0x11')][_0x26e3('0x14')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x28f99d,_0x26e3('0xe'));_0x232c25(_0x2a023b[_0x26e3('0x15')][_0x26e3('0x14')]);}})[_0x26e3('0x16')](function(_0x5cf3c3){logger[_0x26e3('0x11')](_0x26e3('0x13'),_0x28f99d,_0x5cf3c3);_0x3c0db4(_0x5cf3c3);});});}