Built motion from commit 87cd5f02.|2.5.48
[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 _0x6597=['request\x20sent','error','message','result','catch','lodash','util','moment','randomstring','../../mysqldb','../../config/environment','jayson/promise','client','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','debug'];(function(_0x20c9b2,_0x55d7b1){var _0x2c6030=function(_0x10845f){while(--_0x10845f){_0x20c9b2['push'](_0x20c9b2['shift']());}};_0x2c6030(++_0x55d7b1);}(_0x6597,0x16e));var _0x7659=function(_0x131f55,_0x19e3c5){_0x131f55=_0x131f55-0x0;var _0xec0b08=_0x6597[_0x131f55];return _0xec0b08;};'use strict';var _=require(_0x7659('0x0'));var util=require(_0x7659('0x1'));var moment=require(_0x7659('0x2'));var BPromise=require('bluebird');var rs=require(_0x7659('0x3'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x7659('0x4'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x7659('0x5'));var jayson=require(_0x7659('0x6'));var client=jayson[_0x7659('0x7')][_0x7659('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x11cb28,_0x5c4e7f,_0x5ae101){return new BPromise(function(_0x3cfb33,_0x361918){return client[_0x7659('0x9')](_0x11cb28,_0x5ae101)[_0x7659('0xa')](function(_0x597553){logger[_0x7659('0xb')](_0x7659('0xc'),_0x5c4e7f,'request\x20sent');logger[_0x7659('0xd')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x5c4e7f,_0x7659('0xe'),JSON['stringify'](_0x597553));if(_0x597553[_0x7659('0xf')]){if(_0x597553[_0x7659('0xf')]['code']===0x1f4){logger[_0x7659('0xf')](_0x7659('0xc'),_0x5c4e7f,_0x597553['error'][_0x7659('0x10')]);return _0x361918(_0x597553['error']['message']);}logger[_0x7659('0xf')](_0x7659('0xc'),_0x5c4e7f,_0x597553[_0x7659('0xf')][_0x7659('0x10')]);return _0x3cfb33(_0x597553[_0x7659('0xf')]['message']);}else{logger['info'](_0x7659('0xc'),_0x5c4e7f,_0x7659('0xe'));_0x3cfb33(_0x597553[_0x7659('0x11')][_0x7659('0x10')]);}})[_0x7659('0x12')](function(_0x26a0f0){logger['error'](_0x7659('0xc'),_0x5c4e7f,_0x26a0f0);_0x361918(_0x26a0f0);});});}