Built motion from commit (unavailable).|2.5.31
[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 _0xa340=['error','message','UserChatQueue,\x20%s,\x20%s','result','lodash','util','moment','randomstring','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','info','request\x20sent','stringify','code'];(function(_0x3edd51,_0x387ddd){var _0x451ffe=function(_0x55d2f4){while(--_0x55d2f4){_0x3edd51['push'](_0x3edd51['shift']());}};_0x451ffe(++_0x387ddd);}(_0xa340,0xcc));var _0x0a34=function(_0x1e7c47,_0x477935){_0x1e7c47=_0x1e7c47-0x0;var _0x4f2d50=_0xa340[_0x1e7c47];return _0x4f2d50;};'use strict';var _=require(_0x0a34('0x0'));var util=require(_0x0a34('0x1'));var moment=require(_0x0a34('0x2'));var BPromise=require('bluebird');var rs=require(_0x0a34('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0a34('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x0a34('0x5'))(_0x0a34('0x6'));var config=require(_0x0a34('0x7'));var jayson=require(_0x0a34('0x8'));var client=jayson[_0x0a34('0x9')]['http']({'port':0x232a});function respondWithRpcPromise(_0x407718,_0x224f9b,_0x11be3c){return new BPromise(function(_0x549cc7,_0x1a30be){return client[_0x0a34('0xa')](_0x407718,_0x11be3c)[_0x0a34('0xb')](function(_0x42ab3d){logger[_0x0a34('0xc')]('UserChatQueue,\x20%s,\x20%s',_0x224f9b,_0x0a34('0xd'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x224f9b,'request\x20sent',JSON[_0x0a34('0xe')](_0x42ab3d));if(_0x42ab3d['error']){if(_0x42ab3d['error'][_0x0a34('0xf')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x224f9b,_0x42ab3d['error']['message']);return _0x1a30be(_0x42ab3d[_0x0a34('0x10')]['message']);}logger[_0x0a34('0x10')]('UserChatQueue,\x20%s,\x20%s',_0x224f9b,_0x42ab3d[_0x0a34('0x10')][_0x0a34('0x11')]);return _0x549cc7(_0x42ab3d['error'][_0x0a34('0x11')]);}else{logger[_0x0a34('0xc')](_0x0a34('0x12'),_0x224f9b,'request\x20sent');_0x549cc7(_0x42ab3d[_0x0a34('0x13')][_0x0a34('0x11')]);}})['catch'](function(_0x2336c0){logger[_0x0a34('0x10')](_0x0a34('0x12'),_0x224f9b,_0x2336c0);_0x1a30be(_0x2336c0);});});}