34dc7f6f94babdf5831edf3edaa91bc5f9e86099
[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 _0x6e67=['TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','error','message','result','lodash','util','bluebird','ioredis','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s'];(function(_0x3c59fc,_0x10dbd2){var _0x2b78d4=function(_0x5f161a){while(--_0x5f161a){_0x3c59fc['push'](_0x3c59fc['shift']());}};_0x2b78d4(++_0x10dbd2);}(_0x6e67,0x1f3));var _0x76e6=function(_0x42fd67,_0x5dbdfd){_0x42fd67=_0x42fd67-0x0;var _0x3293f5=_0x6e67[_0x42fd67];return _0x3293f5;};'use strict';var _=require(_0x76e6('0x0'));var util=require(_0x76e6('0x1'));var moment=require('moment');var BPromise=require(_0x76e6('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x76e6('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0x76e6('0x4'));var logger=require(_0x76e6('0x5'))(_0x76e6('0x6'));var config=require('../../config/environment');var jayson=require(_0x76e6('0x7'));var client=jayson[_0x76e6('0x8')][_0x76e6('0x9')]({'port':0x232a});function respondWithRpcPromise(_0xa7d3e3,_0x56b1cb,_0x286e7b){return new BPromise(function(_0x1e35e0,_0x2fb1e3){return client[_0x76e6('0xa')](_0xa7d3e3,_0x286e7b)[_0x76e6('0xb')](function(_0x1af919){logger[_0x76e6('0xc')](_0x76e6('0xd'),_0x56b1cb,'request\x20sent');logger['debug'](_0x76e6('0xe'),_0x56b1cb,_0x76e6('0xf'),JSON['stringify'](_0x1af919));if(_0x1af919[_0x76e6('0x10')]){if(_0x1af919[_0x76e6('0x10')]['code']===0x1f4){logger[_0x76e6('0x10')](_0x76e6('0xd'),_0x56b1cb,_0x1af919[_0x76e6('0x10')][_0x76e6('0x11')]);return _0x2fb1e3(_0x1af919['error']['message']);}logger['error'](_0x76e6('0xd'),_0x56b1cb,_0x1af919['error'][_0x76e6('0x11')]);return _0x1e35e0(_0x1af919[_0x76e6('0x10')]['message']);}else{logger['info'](_0x76e6('0xd'),_0x56b1cb,_0x76e6('0xf'));_0x1e35e0(_0x1af919[_0x76e6('0x12')][_0x76e6('0x11')]);}})['catch'](function(_0x28ef7d){logger[_0x76e6('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x56b1cb,_0x28ef7d);_0x2fb1e3(_0x28ef7d);});});}