Built motion from commit (unavailable).|2.5.30
[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 _0xc948=['rpc','../../config/environment','http','request','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger'];(function(_0xdc5d93,_0x594c9c){var _0x8455e7=function(_0x2e7078){while(--_0x2e7078){_0xdc5d93['push'](_0xdc5d93['shift']());}};_0x8455e7(++_0x594c9c);}(_0xc948,0x92));var _0x8c94=function(_0x56315a,_0x42f3e5){_0x56315a=_0x56315a-0x0;var _0x183bac=_0xc948[_0x56315a];return _0x183bac;};'use strict';var _=require(_0x8c94('0x0'));var util=require(_0x8c94('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x8c94('0x2'));var fs=require('fs');var Redis=require(_0x8c94('0x3'));var db=require(_0x8c94('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8c94('0x5'))(_0x8c94('0x6'));var config=require(_0x8c94('0x7'));var jayson=require('jayson/promise');var client=jayson['client'][_0x8c94('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x2cac1e,_0x34b375,_0x138920){return new BPromise(function(_0x484784,_0x21333a){return client[_0x8c94('0x9')](_0x2cac1e,_0x138920)['then'](function(_0xdbe51){logger[_0x8c94('0xa')](_0x8c94('0xb'),_0x34b375,_0x8c94('0xc'));logger[_0x8c94('0xd')]('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x34b375,_0x8c94('0xc'),JSON[_0x8c94('0xe')](_0xdbe51));if(_0xdbe51[_0x8c94('0xf')]){if(_0xdbe51[_0x8c94('0xf')][_0x8c94('0x10')]===0x1f4){logger[_0x8c94('0xf')]('UserChatQueue,\x20%s,\x20%s',_0x34b375,_0xdbe51['error'][_0x8c94('0x11')]);return _0x21333a(_0xdbe51[_0x8c94('0xf')][_0x8c94('0x11')]);}logger[_0x8c94('0xf')](_0x8c94('0xb'),_0x34b375,_0xdbe51[_0x8c94('0xf')]['message']);return _0x484784(_0xdbe51[_0x8c94('0xf')][_0x8c94('0x11')]);}else{logger['info'](_0x8c94('0xb'),_0x34b375,'request\x20sent');_0x484784(_0xdbe51['result'][_0x8c94('0x11')]);}})[_0x8c94('0x12')](function(_0x1f1bf5){logger[_0x8c94('0xf')](_0x8c94('0xb'),_0x34b375,_0x1f1bf5);_0x21333a(_0x1f1bf5);});});}