ef35350f5bd4d03a05e8be9d299edc655a6261b2
[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 _0xdcce=['request','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','UserChatQueue,\x20%s,\x20%s,\x20%s','error','code','message','catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http'];(function(_0x10df5c,_0x14c714){var _0x9fcba6=function(_0x4d4554){while(--_0x4d4554){_0x10df5c['push'](_0x10df5c['shift']());}};_0x9fcba6(++_0x14c714);}(_0xdcce,0xfb));var _0xedcc=function(_0x81e6f,_0x40c197){_0x81e6f=_0x81e6f-0x0;var _0x522ab3=_0xdcce[_0x81e6f];return _0x522ab3;};'use strict';var _=require('lodash');var util=require(_0xedcc('0x0'));var moment=require(_0xedcc('0x1'));var BPromise=require(_0xedcc('0x2'));var rs=require(_0xedcc('0x3'));var fs=require('fs');var Redis=require(_0xedcc('0x4'));var db=require(_0xedcc('0x5'))['db'];var utils=require(_0xedcc('0x6'));var logger=require(_0xedcc('0x7'))(_0xedcc('0x8'));var config=require(_0xedcc('0x9'));var jayson=require(_0xedcc('0xa'));var client=jayson[_0xedcc('0xb')][_0xedcc('0xc')]({'port':0x232a});function respondWithRpcPromise(_0xc184b2,_0x4f414d,_0x266cb7){return new BPromise(function(_0x752811,_0x441e0e){return client[_0xedcc('0xd')](_0xc184b2,_0x266cb7)['then'](function(_0x4523bf){logger['info'](_0xedcc('0xe'),_0x4f414d,_0xedcc('0xf'));logger[_0xedcc('0x10')](_0xedcc('0x11'),_0x4f414d,_0xedcc('0xf'),JSON['stringify'](_0x4523bf));if(_0x4523bf[_0xedcc('0x12')]){if(_0x4523bf['error'][_0xedcc('0x13')]===0x1f4){logger['error'](_0xedcc('0xe'),_0x4f414d,_0x4523bf[_0xedcc('0x12')][_0xedcc('0x14')]);return _0x441e0e(_0x4523bf[_0xedcc('0x12')][_0xedcc('0x14')]);}logger[_0xedcc('0x12')](_0xedcc('0xe'),_0x4f414d,_0x4523bf[_0xedcc('0x12')][_0xedcc('0x14')]);return _0x752811(_0x4523bf['error']['message']);}else{logger['info'](_0xedcc('0xe'),_0x4f414d,_0xedcc('0xf'));_0x752811(_0x4523bf['result']['message']);}})[_0xedcc('0x15')](function(_0x5a815a){logger['error'](_0xedcc('0xe'),_0x4f414d,_0x5a815a);_0x441e0e(_0x5a815a);});});}