Built motion from commit (unavailable).|2.5.22
[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 _0x20b4=['http','then','info','UserChatQueue,\x20%s,\x20%s','request\x20sent','error','code','message','result','catch','lodash','util','moment','bluebird','randomstring','ioredis','../../config/logger','rpc','jayson/promise','client'];(function(_0x13d7e3,_0x39bbc0){var _0xd079f5=function(_0xdcf129){while(--_0xdcf129){_0x13d7e3['push'](_0x13d7e3['shift']());}};_0xd079f5(++_0x39bbc0);}(_0x20b4,0x136));var _0x420b=function(_0x39580c,_0x22425c){_0x39580c=_0x39580c-0x0;var _0x1a4cd8=_0x20b4[_0x39580c];return _0x1a4cd8;};'use strict';var _=require(_0x420b('0x0'));var util=require(_0x420b('0x1'));var moment=require(_0x420b('0x2'));var BPromise=require(_0x420b('0x3'));var rs=require(_0x420b('0x4'));var fs=require('fs');var Redis=require(_0x420b('0x5'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x420b('0x6'))(_0x420b('0x7'));var config=require('../../config/environment');var jayson=require(_0x420b('0x8'));var client=jayson[_0x420b('0x9')][_0x420b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x1dee54,_0x2c4f94,_0x5220b4){return new BPromise(function(_0x148bbf,_0x52c062){return client['request'](_0x1dee54,_0x5220b4)[_0x420b('0xb')](function(_0x112272){logger[_0x420b('0xc')](_0x420b('0xd'),_0x2c4f94,_0x420b('0xe'));logger['debug']('UserChatQueue,\x20%s,\x20%s,\x20%s',_0x2c4f94,_0x420b('0xe'),JSON['stringify'](_0x112272));if(_0x112272[_0x420b('0xf')]){if(_0x112272[_0x420b('0xf')][_0x420b('0x10')]===0x1f4){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2c4f94,_0x112272[_0x420b('0xf')]['message']);return _0x52c062(_0x112272[_0x420b('0xf')][_0x420b('0x11')]);}logger[_0x420b('0xf')](_0x420b('0xd'),_0x2c4f94,_0x112272[_0x420b('0xf')][_0x420b('0x11')]);return _0x148bbf(_0x112272[_0x420b('0xf')][_0x420b('0x11')]);}else{logger['info']('UserChatQueue,\x20%s,\x20%s',_0x2c4f94,_0x420b('0xe'));_0x148bbf(_0x112272[_0x420b('0x12')][_0x420b('0x11')]);}})[_0x420b('0x13')](function(_0x1d99f3){logger['error']('UserChatQueue,\x20%s,\x20%s',_0x2c4f94,_0x1d99f3);_0x52c062(_0x1d99f3);});});}