8e553f742db88ef030b32113feb460b1f0b1516e
[motion2.git] / server / api / teamVoiceQueue / teamVoiceQueue.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 _0xa952=['moment','bluebird','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','TeamVoiceQueue,\x20%s,\x20%s','message','catch','lodash','util'];(function(_0x1f678d,_0x437f07){var _0x17f8c8=function(_0x12e56e){while(--_0x12e56e){_0x1f678d['push'](_0x1f678d['shift']());}};_0x17f8c8(++_0x437f07);}(_0xa952,0x7c));var _0x2a95=function(_0x9da886,_0x4ad4fa){_0x9da886=_0x9da886-0x0;var _0x279f29=_0xa952[_0x9da886];return _0x279f29;};'use strict';var _=require(_0x2a95('0x0'));var util=require(_0x2a95('0x1'));var moment=require(_0x2a95('0x2'));var BPromise=require(_0x2a95('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2a95('0x4'));var db=require(_0x2a95('0x5'))['db'];var utils=require(_0x2a95('0x6'));var logger=require('../../config/logger')(_0x2a95('0x7'));var config=require(_0x2a95('0x8'));var jayson=require(_0x2a95('0x9'));var client=jayson[_0x2a95('0xa')][_0x2a95('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x104a49,_0x11469a,_0x582c29){return new BPromise(function(_0x574567,_0x10c102){return client['request'](_0x104a49,_0x582c29)['then'](function(_0x294eac){logger[_0x2a95('0xc')]('TeamVoiceQueue,\x20%s,\x20%s',_0x11469a,_0x2a95('0xd'));logger['debug'](_0x2a95('0xe'),_0x11469a,_0x2a95('0xd'),JSON[_0x2a95('0xf')](_0x294eac));if(_0x294eac[_0x2a95('0x10')]){if(_0x294eac[_0x2a95('0x10')][_0x2a95('0x11')]===0x1f4){logger[_0x2a95('0x10')](_0x2a95('0x12'),_0x11469a,_0x294eac[_0x2a95('0x10')][_0x2a95('0x13')]);return _0x10c102(_0x294eac[_0x2a95('0x10')]['message']);}logger[_0x2a95('0x10')](_0x2a95('0x12'),_0x11469a,_0x294eac[_0x2a95('0x10')][_0x2a95('0x13')]);return _0x574567(_0x294eac[_0x2a95('0x10')][_0x2a95('0x13')]);}else{logger[_0x2a95('0xc')](_0x2a95('0x12'),_0x11469a,_0x2a95('0xd'));_0x574567(_0x294eac['result'][_0x2a95('0x13')]);}})[_0x2a95('0x14')](function(_0x1c21ca){logger['error'](_0x2a95('0x12'),_0x11469a,_0x1c21ca);_0x10c102(_0x1c21ca);});});}