7549af934e99cb0b8dae1e5ffcea612d6344d720
[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 _0x1f19=['error','message','request\x20sent','result','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','then','info','UserChatQueue,\x20%s,\x20%s','debug','stringify'];(function(_0x18a436,_0x1dbe06){var _0x5c2cf8=function(_0x4712d1){while(--_0x4712d1){_0x18a436['push'](_0x18a436['shift']());}};_0x5c2cf8(++_0x1dbe06);}(_0x1f19,0x1e0));var _0x91f1=function(_0x47b0c4,_0x590e8d){_0x47b0c4=_0x47b0c4-0x0;var _0x304bc1=_0x1f19[_0x47b0c4];return _0x304bc1;};'use strict';var _=require(_0x91f1('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0x91f1('0x1'));var rs=require(_0x91f1('0x2'));var fs=require('fs');var Redis=require(_0x91f1('0x3'));var db=require(_0x91f1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x91f1('0x5'))(_0x91f1('0x6'));var config=require(_0x91f1('0x7'));var jayson=require('jayson/promise');var client=jayson[_0x91f1('0x8')]['http']({'port':0x232a});function respondWithRpcPromise(_0x4df10c,_0x2e8d8f,_0x50715e){return new BPromise(function(_0x4077f6,_0x4131b2){return client['request'](_0x4df10c,_0x50715e)[_0x91f1('0x9')](function(_0x3f8313){logger[_0x91f1('0xa')](_0x91f1('0xb'),_0x2e8d8f,'request\x20sent');logger[_0x91f1('0xc')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2e8d8f,'request\x20sent',JSON[_0x91f1('0xd')](_0x3f8313));if(_0x3f8313[_0x91f1('0xe')]){if(_0x3f8313[_0x91f1('0xe')]['code']===0x1f4){logger[_0x91f1('0xe')](_0x91f1('0xb'),_0x2e8d8f,_0x3f8313[_0x91f1('0xe')][_0x91f1('0xf')]);return _0x4131b2(_0x3f8313['error'][_0x91f1('0xf')]);}logger[_0x91f1('0xe')](_0x91f1('0xb'),_0x2e8d8f,_0x3f8313[_0x91f1('0xe')]['message']);return _0x4077f6(_0x3f8313[_0x91f1('0xe')][_0x91f1('0xf')]);}else{logger['info'](_0x91f1('0xb'),_0x2e8d8f,_0x91f1('0x10'));_0x4077f6(_0x3f8313[_0x91f1('0x11')][_0x91f1('0xf')]);}})[_0x91f1('0x12')](function(_0x53cfcc){logger[_0x91f1('0xe')](_0x91f1('0xb'),_0x2e8d8f,_0x53cfcc);_0x4131b2(_0x53cfcc);});});}