b8eae72ea329a10fe27c968754e904cbcf4f1c46
[motion2.git] / server / api / userOpenchannelQueue / userOpenchannelQueue.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 _0x8a09=['result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','jayson/promise','client','http','request','then','info','UserOpenchannelQueue,\x20%s,\x20%s','request\x20sent','debug','UserOpenchannelQueue,\x20%s,\x20%s,\x20%s','error','code','message'];(function(_0xdea41a,_0x552987){var _0x15d0d8=function(_0x1e0d0b){while(--_0x1e0d0b){_0xdea41a['push'](_0xdea41a['shift']());}};_0x15d0d8(++_0x552987);}(_0x8a09,0x1ba));var _0x98a0=function(_0x57b54c,_0x54ce0d){_0x57b54c=_0x57b54c-0x0;var _0x59cc19=_0x8a09[_0x57b54c];return _0x59cc19;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x98a0('0x0'));var BPromise=require(_0x98a0('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x98a0('0x2'));var db=require(_0x98a0('0x3'))['db'];var utils=require(_0x98a0('0x4'));var logger=require(_0x98a0('0x5'))('rpc');var config=require(_0x98a0('0x6'));var jayson=require(_0x98a0('0x7'));var client=jayson[_0x98a0('0x8')][_0x98a0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4c3c82,_0x5f2232,_0x3e71fe){return new BPromise(function(_0x2990b8,_0x251d99){return client[_0x98a0('0xa')](_0x4c3c82,_0x3e71fe)[_0x98a0('0xb')](function(_0x1c5ba2){logger[_0x98a0('0xc')](_0x98a0('0xd'),_0x5f2232,_0x98a0('0xe'));logger[_0x98a0('0xf')](_0x98a0('0x10'),_0x5f2232,_0x98a0('0xe'),JSON['stringify'](_0x1c5ba2));if(_0x1c5ba2[_0x98a0('0x11')]){if(_0x1c5ba2[_0x98a0('0x11')][_0x98a0('0x12')]===0x1f4){logger['error']('UserOpenchannelQueue,\x20%s,\x20%s',_0x5f2232,_0x1c5ba2[_0x98a0('0x11')][_0x98a0('0x13')]);return _0x251d99(_0x1c5ba2[_0x98a0('0x11')][_0x98a0('0x13')]);}logger[_0x98a0('0x11')](_0x98a0('0xd'),_0x5f2232,_0x1c5ba2[_0x98a0('0x11')][_0x98a0('0x13')]);return _0x2990b8(_0x1c5ba2[_0x98a0('0x11')]['message']);}else{logger[_0x98a0('0xc')](_0x98a0('0xd'),_0x5f2232,_0x98a0('0xe'));_0x2990b8(_0x1c5ba2[_0x98a0('0x14')][_0x98a0('0x13')]);}})['catch'](function(_0x25ac11){logger[_0x98a0('0x11')](_0x98a0('0xd'),_0x5f2232,_0x25ac11);_0x251d99(_0x25ac11);});});}