Built motion from commit da617fac.|2.6.6
[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 _0xacdf=['stringify','error','code','message','info','result','util','moment','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent'];(function(_0x2fffb2,_0x3c476f){var _0x46eb4f=function(_0x283ff2){while(--_0x283ff2){_0x2fffb2['push'](_0x2fffb2['shift']());}};_0x46eb4f(++_0x3c476f);}(_0xacdf,0x15a));var _0xfacd=function(_0x36ed3c,_0x44a00a){_0x36ed3c=_0x36ed3c-0x0;var _0x52a2e0=_0xacdf[_0x36ed3c];return _0x52a2e0;};'use strict';var _=require('lodash');var util=require(_0xfacd('0x0'));var moment=require(_0xfacd('0x1'));var BPromise=require('bluebird');var rs=require(_0xfacd('0x2'));var fs=require('fs');var Redis=require(_0xfacd('0x3'));var db=require(_0xfacd('0x4'))['db'];var utils=require(_0xfacd('0x5'));var logger=require(_0xfacd('0x6'))(_0xfacd('0x7'));var config=require(_0xfacd('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0xfacd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x5addc0,_0x5d9e7c,_0x3a796c){return new BPromise(function(_0x1677bb,_0xb09719){return client[_0xfacd('0xa')](_0x5addc0,_0x3a796c)[_0xfacd('0xb')](function(_0x3e3ae9){logger['info'](_0xfacd('0xc'),_0x5d9e7c,'request\x20sent');logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x5d9e7c,_0xfacd('0xd'),JSON[_0xfacd('0xe')](_0x3e3ae9));if(_0x3e3ae9[_0xfacd('0xf')]){if(_0x3e3ae9['error'][_0xfacd('0x10')]===0x1f4){logger[_0xfacd('0xf')](_0xfacd('0xc'),_0x5d9e7c,_0x3e3ae9['error'][_0xfacd('0x11')]);return _0xb09719(_0x3e3ae9[_0xfacd('0xf')][_0xfacd('0x11')]);}logger['error'](_0xfacd('0xc'),_0x5d9e7c,_0x3e3ae9['error'][_0xfacd('0x11')]);return _0x1677bb(_0x3e3ae9['error'][_0xfacd('0x11')]);}else{logger[_0xfacd('0x12')](_0xfacd('0xc'),_0x5d9e7c,_0xfacd('0xd'));_0x1677bb(_0x3e3ae9[_0xfacd('0x13')][_0xfacd('0x11')]);}})['catch'](function(_0x424a87){logger[_0xfacd('0xf')](_0xfacd('0xc'),_0x5d9e7c,_0x424a87);_0xb09719(_0x424a87);});});}