3fa7629ab08a04885ba21ade0f9a8f9de96fa93c
[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 _0x8aff=['bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','UserChatQueue,\x20%s,\x20%s','request\x20sent','UserChatQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','info','result','lodash','util','moment'];(function(_0x5e1e6b,_0x25d886){var _0x22d3b9=function(_0x52b92e){while(--_0x52b92e){_0x5e1e6b['push'](_0x5e1e6b['shift']());}};_0x22d3b9(++_0x25d886);}(_0x8aff,0x11b));var _0xf8af=function(_0x122ef9,_0x451d2a){_0x122ef9=_0x122ef9-0x0;var _0x42fba0=_0x8aff[_0x122ef9];return _0x42fba0;};'use strict';var _=require(_0xf8af('0x0'));var util=require(_0xf8af('0x1'));var moment=require(_0xf8af('0x2'));var BPromise=require(_0xf8af('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf8af('0x4'));var db=require(_0xf8af('0x5'))['db'];var utils=require(_0xf8af('0x6'));var logger=require(_0xf8af('0x7'))(_0xf8af('0x8'));var config=require(_0xf8af('0x9'));var jayson=require('jayson/promise');var client=jayson[_0xf8af('0xa')][_0xf8af('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x2e1a45,_0x44fe89,_0x24511d){return new BPromise(function(_0x1fc252,_0x3f3e94){return client[_0xf8af('0xc')](_0x2e1a45,_0x24511d)[_0xf8af('0xd')](function(_0x4d7b05){logger['info'](_0xf8af('0xe'),_0x44fe89,_0xf8af('0xf'));logger['debug'](_0xf8af('0x10'),_0x44fe89,'request\x20sent',JSON[_0xf8af('0x11')](_0x4d7b05));if(_0x4d7b05[_0xf8af('0x12')]){if(_0x4d7b05[_0xf8af('0x12')]['code']===0x1f4){logger[_0xf8af('0x12')]('UserChatQueue,\x20%s,\x20%s',_0x44fe89,_0x4d7b05[_0xf8af('0x12')]['message']);return _0x3f3e94(_0x4d7b05[_0xf8af('0x12')]['message']);}logger[_0xf8af('0x12')](_0xf8af('0xe'),_0x44fe89,_0x4d7b05[_0xf8af('0x12')][_0xf8af('0x13')]);return _0x1fc252(_0x4d7b05[_0xf8af('0x12')][_0xf8af('0x13')]);}else{logger[_0xf8af('0x14')](_0xf8af('0xe'),_0x44fe89,_0xf8af('0xf'));_0x1fc252(_0x4d7b05[_0xf8af('0x15')]['message']);}})['catch'](function(_0x7aba1){logger[_0xf8af('0x12')](_0xf8af('0xe'),_0x44fe89,_0x7aba1);_0x3f3e94(_0x7aba1);});});}