7592f51cb029a7fc1f727ba71d7956aff9b8cc56
[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 _0xaa01=['UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then','info','debug'];(function(_0x411c1e,_0x2950f7){var _0x5972dc=function(_0x1e0868){while(--_0x1e0868){_0x411c1e['push'](_0x411c1e['shift']());}};_0x5972dc(++_0x2950f7);}(_0xaa01,0x106));var _0x1aa0=function(_0x3b1300,_0xd70424){_0x3b1300=_0x3b1300-0x0;var _0x5aac0c=_0xaa01[_0x3b1300];return _0x5aac0c;};'use strict';var _=require(_0x1aa0('0x0'));var util=require(_0x1aa0('0x1'));var moment=require('moment');var BPromise=require(_0x1aa0('0x2'));var rs=require(_0x1aa0('0x3'));var fs=require('fs');var Redis=require(_0x1aa0('0x4'));var db=require(_0x1aa0('0x5'))['db'];var utils=require(_0x1aa0('0x6'));var logger=require('../../config/logger')(_0x1aa0('0x7'));var config=require('../../config/environment');var jayson=require(_0x1aa0('0x8'));var client=jayson['client'][_0x1aa0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x366656,_0xdc7398,_0x71f55b){return new BPromise(function(_0x206217,_0x5e5922){return client[_0x1aa0('0xa')](_0x366656,_0x71f55b)[_0x1aa0('0xb')](function(_0x35f7e6){logger[_0x1aa0('0xc')]('UserChatQueue,\x20%s,\x20%s',_0xdc7398,'request\x20sent');logger[_0x1aa0('0xd')](_0x1aa0('0xe'),_0xdc7398,'request\x20sent',JSON[_0x1aa0('0xf')](_0x35f7e6));if(_0x35f7e6[_0x1aa0('0x10')]){if(_0x35f7e6[_0x1aa0('0x10')][_0x1aa0('0x11')]===0x1f4){logger[_0x1aa0('0x10')](_0x1aa0('0x12'),_0xdc7398,_0x35f7e6['error'][_0x1aa0('0x13')]);return _0x5e5922(_0x35f7e6[_0x1aa0('0x10')]['message']);}logger[_0x1aa0('0x10')](_0x1aa0('0x12'),_0xdc7398,_0x35f7e6['error'][_0x1aa0('0x13')]);return _0x206217(_0x35f7e6['error'][_0x1aa0('0x13')]);}else{logger[_0x1aa0('0xc')](_0x1aa0('0x12'),_0xdc7398,_0x1aa0('0x14'));_0x206217(_0x35f7e6[_0x1aa0('0x15')][_0x1aa0('0x13')]);}})[_0x1aa0('0x16')](function(_0x60fa00){logger[_0x1aa0('0x10')](_0x1aa0('0x12'),_0xdc7398,_0x60fa00);_0x5e5922(_0x60fa00);});});}