fe85cdc5365daaf8ecaf4c69e84eb4711ea15ceb
[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 _0x38f5=['ioredis','../../mysqldb','../../config/utils','../../config/environment','jayson/promise','client','http','then','request\x20sent','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','util','moment','randomstring'];(function(_0x4a4566,_0x59b4c3){var _0x530d00=function(_0x1656f9){while(--_0x1656f9){_0x4a4566['push'](_0x4a4566['shift']());}};_0x530d00(++_0x59b4c3);}(_0x38f5,0x89));var _0x538f=function(_0x4659c6,_0x16e31c){_0x4659c6=_0x4659c6-0x0;var _0x59a9ea=_0x38f5[_0x4659c6];return _0x59a9ea;};'use strict';var _=require('lodash');var util=require(_0x538f('0x0'));var moment=require(_0x538f('0x1'));var BPromise=require('bluebird');var rs=require(_0x538f('0x2'));var fs=require('fs');var Redis=require(_0x538f('0x3'));var db=require(_0x538f('0x4'))['db'];var utils=require(_0x538f('0x5'));var logger=require('../../config/logger')('rpc');var config=require(_0x538f('0x6'));var jayson=require(_0x538f('0x7'));var client=jayson[_0x538f('0x8')][_0x538f('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x387907,_0x4f42d2,_0x45e772){return new BPromise(function(_0x6e3292,_0x5757a8){return client['request'](_0x387907,_0x45e772)[_0x538f('0xa')](function(_0x1006e6){logger['info']('TeamVoiceQueue,\x20%s,\x20%s',_0x4f42d2,_0x538f('0xb'));logger[_0x538f('0xc')](_0x538f('0xd'),_0x4f42d2,_0x538f('0xb'),JSON['stringify'](_0x1006e6));if(_0x1006e6[_0x538f('0xe')]){if(_0x1006e6[_0x538f('0xe')][_0x538f('0xf')]===0x1f4){logger[_0x538f('0xe')]('TeamVoiceQueue,\x20%s,\x20%s',_0x4f42d2,_0x1006e6[_0x538f('0xe')][_0x538f('0x10')]);return _0x5757a8(_0x1006e6[_0x538f('0xe')][_0x538f('0x10')]);}logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x4f42d2,_0x1006e6[_0x538f('0xe')][_0x538f('0x10')]);return _0x6e3292(_0x1006e6[_0x538f('0xe')][_0x538f('0x10')]);}else{logger['info'](_0x538f('0x11'),_0x4f42d2,_0x538f('0xb'));_0x6e3292(_0x1006e6[_0x538f('0x12')]['message']);}})[_0x538f('0x13')](function(_0x44670a){logger[_0x538f('0xe')](_0x538f('0x11'),_0x4f42d2,_0x44670a);_0x5757a8(_0x44670a);});});}