Built motion from commit e02f907f.|2.6.14
[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 _0xd5b2=['request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client','http','info','UserChatQueue,\x20%s,\x20%s'];(function(_0x3a2454,_0xed14d3){var _0x4cd64f=function(_0x1399f1){while(--_0x1399f1){_0x3a2454['push'](_0x3a2454['shift']());}};_0x4cd64f(++_0xed14d3);}(_0xd5b2,0x153));var _0x2d5b=function(_0x23e7c1,_0x35110c){_0x23e7c1=_0x23e7c1-0x0;var _0x1add43=_0xd5b2[_0x23e7c1];return _0x1add43;};'use strict';var _=require(_0x2d5b('0x0'));var util=require(_0x2d5b('0x1'));var moment=require(_0x2d5b('0x2'));var BPromise=require(_0x2d5b('0x3'));var rs=require(_0x2d5b('0x4'));var fs=require('fs');var Redis=require(_0x2d5b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x2d5b('0x6'))(_0x2d5b('0x7'));var config=require('../../config/environment');var jayson=require(_0x2d5b('0x8'));var client=jayson[_0x2d5b('0x9')][_0x2d5b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1618c1,_0x314755,_0x37faa6){return new BPromise(function(_0x4812ba,_0x56e9ce){return client['request'](_0x1618c1,_0x37faa6)['then'](function(_0x22428a){logger[_0x2d5b('0xb')](_0x2d5b('0xc'),_0x314755,_0x2d5b('0xd'));logger[_0x2d5b('0xe')](_0x2d5b('0xf'),_0x314755,_0x2d5b('0xd'),JSON[_0x2d5b('0x10')](_0x22428a));if(_0x22428a[_0x2d5b('0x11')]){if(_0x22428a[_0x2d5b('0x11')][_0x2d5b('0x12')]===0x1f4){logger[_0x2d5b('0x11')]('UserChatQueue,\x20%s,\x20%s',_0x314755,_0x22428a[_0x2d5b('0x11')][_0x2d5b('0x13')]);return _0x56e9ce(_0x22428a[_0x2d5b('0x11')][_0x2d5b('0x13')]);}logger[_0x2d5b('0x11')](_0x2d5b('0xc'),_0x314755,_0x22428a['error']['message']);return _0x4812ba(_0x22428a[_0x2d5b('0x11')]['message']);}else{logger[_0x2d5b('0xb')]('UserChatQueue,\x20%s,\x20%s',_0x314755,'request\x20sent');_0x4812ba(_0x22428a[_0x2d5b('0x14')][_0x2d5b('0x13')]);}})[_0x2d5b('0x15')](function(_0x28e294){logger['error'](_0x2d5b('0xc'),_0x314755,_0x28e294);_0x56e9ce(_0x28e294);});});}