954d5528cf0386f86770db30051da84a8d4f66e2
[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 _0xf300=['bluebird','randomstring','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','request','then','info','UserChatQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','code','UserChatQueue,\x20%s,\x20%s','message','result','catch','lodash','util','moment'];(function(_0x3dd15e,_0x1f0015){var _0x231fd0=function(_0x4f680a){while(--_0x4f680a){_0x3dd15e['push'](_0x3dd15e['shift']());}};_0x231fd0(++_0x1f0015);}(_0xf300,0x105));var _0x0f30=function(_0x60df74,_0x458e29){_0x60df74=_0x60df74-0x0;var _0x5ee872=_0xf300[_0x60df74];return _0x5ee872;};'use strict';var _=require(_0x0f30('0x0'));var util=require(_0x0f30('0x1'));var moment=require(_0x0f30('0x2'));var BPromise=require(_0x0f30('0x3'));var rs=require(_0x0f30('0x4'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x0f30('0x5'))['db'];var utils=require(_0x0f30('0x6'));var logger=require('../../config/logger')(_0x0f30('0x7'));var config=require(_0x0f30('0x8'));var jayson=require(_0x0f30('0x9'));var client=jayson[_0x0f30('0xa')][_0x0f30('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x4dccc1,_0x47b7fd,_0xc81f9c){return new BPromise(function(_0x4d080b,_0x3efb9b){return client[_0x0f30('0xc')](_0x4dccc1,_0xc81f9c)[_0x0f30('0xd')](function(_0x50a899){logger[_0x0f30('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x47b7fd,'request\x20sent');logger['debug'](_0x0f30('0xf'),_0x47b7fd,_0x0f30('0x10'),JSON[_0x0f30('0x11')](_0x50a899));if(_0x50a899[_0x0f30('0x12')]){if(_0x50a899[_0x0f30('0x12')][_0x0f30('0x13')]===0x1f4){logger['error'](_0x0f30('0x14'),_0x47b7fd,_0x50a899['error'][_0x0f30('0x15')]);return _0x3efb9b(_0x50a899[_0x0f30('0x12')][_0x0f30('0x15')]);}logger['error'](_0x0f30('0x14'),_0x47b7fd,_0x50a899['error'][_0x0f30('0x15')]);return _0x4d080b(_0x50a899['error'][_0x0f30('0x15')]);}else{logger[_0x0f30('0xe')]('UserChatQueue,\x20%s,\x20%s',_0x47b7fd,_0x0f30('0x10'));_0x4d080b(_0x50a899[_0x0f30('0x16')][_0x0f30('0x15')]);}})[_0x0f30('0x17')](function(_0x693fcf){logger['error'](_0x0f30('0x14'),_0x47b7fd,_0x693fcf);_0x3efb9b(_0x693fcf);});});}