Built motion from commit (unavailable).|2.5.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 _0x2318=['request\x20sent','error','code','message','result','catch','util','bluebird','randomstring','ioredis','../../config/utils','rpc','jayson/promise','client','request','then','info','UserChatQueue,\x20%s,\x20%s'];(function(_0xbb091,_0x3fe7ee){var _0x467a04=function(_0x3a978d){while(--_0x3a978d){_0xbb091['push'](_0xbb091['shift']());}};_0x467a04(++_0x3fe7ee);}(_0x2318,0x1b6));var _0x8231=function(_0x23b94a,_0x1b4a33){_0x23b94a=_0x23b94a-0x0;var _0x27dd14=_0x2318[_0x23b94a];return _0x27dd14;};'use strict';var _=require('lodash');var util=require(_0x8231('0x0'));var moment=require('moment');var BPromise=require(_0x8231('0x1'));var rs=require(_0x8231('0x2'));var fs=require('fs');var Redis=require(_0x8231('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x8231('0x4'));var logger=require('../../config/logger')(_0x8231('0x5'));var config=require('../../config/environment');var jayson=require(_0x8231('0x6'));var client=jayson[_0x8231('0x7')]['http']({'port':0x232a});function respondWithRpcPromise(_0x35a7c6,_0x298cdf,_0x25a388){return new BPromise(function(_0xb11c7a,_0x75a7ab){return client[_0x8231('0x8')](_0x35a7c6,_0x25a388)[_0x8231('0x9')](function(_0x1d26e4){logger[_0x8231('0xa')](_0x8231('0xb'),_0x298cdf,'request\x20sent');logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x298cdf,_0x8231('0xc'),JSON['stringify'](_0x1d26e4));if(_0x1d26e4[_0x8231('0xd')]){if(_0x1d26e4[_0x8231('0xd')][_0x8231('0xe')]===0x1f4){logger[_0x8231('0xd')](_0x8231('0xb'),_0x298cdf,_0x1d26e4[_0x8231('0xd')][_0x8231('0xf')]);return _0x75a7ab(_0x1d26e4['error'][_0x8231('0xf')]);}logger[_0x8231('0xd')]('UserChatQueue,\x20%s,\x20%s',_0x298cdf,_0x1d26e4[_0x8231('0xd')][_0x8231('0xf')]);return _0xb11c7a(_0x1d26e4[_0x8231('0xd')][_0x8231('0xf')]);}else{logger['info'](_0x8231('0xb'),_0x298cdf,_0x8231('0xc'));_0xb11c7a(_0x1d26e4[_0x8231('0x10')][_0x8231('0xf')]);}})[_0x8231('0x11')](function(_0x440b6c){logger[_0x8231('0xd')](_0x8231('0xb'),_0x298cdf,_0x440b6c);_0x75a7ab(_0x440b6c);});});}