b47e5e09430b3323088e3475580e19d36d4e995f
[motion2.git] / server / api / userVoiceQueue / userVoiceQueue.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 _0xf318=['rpc','jayson/promise','client','http','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','lodash','util','moment','ioredis','../../mysqldb','../../config/logger'];(function(_0x4cd8e1,_0x3fb58a){var _0x5e7ec4=function(_0x2c7d0f){while(--_0x2c7d0f){_0x4cd8e1['push'](_0x4cd8e1['shift']());}};_0x5e7ec4(++_0x3fb58a);}(_0xf318,0x13a));var _0x8f31=function(_0x53ab0f,_0x237c80){_0x53ab0f=_0x53ab0f-0x0;var _0x1713da=_0xf318[_0x53ab0f];return _0x1713da;};'use strict';var _=require(_0x8f31('0x0'));var util=require(_0x8f31('0x1'));var moment=require(_0x8f31('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8f31('0x3'));var db=require(_0x8f31('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8f31('0x5'))(_0x8f31('0x6'));var config=require('../../config/environment');var jayson=require(_0x8f31('0x7'));var client=jayson[_0x8f31('0x8')][_0x8f31('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4d16a5,_0x589d44,_0x1e5def){return new BPromise(function(_0x2be5e6,_0x483b0e){return client['request'](_0x4d16a5,_0x1e5def)[_0x8f31('0xa')](function(_0x30296d){logger['info'](_0x8f31('0xb'),_0x589d44,_0x8f31('0xc'));logger[_0x8f31('0xd')](_0x8f31('0xe'),_0x589d44,_0x8f31('0xc'),JSON[_0x8f31('0xf')](_0x30296d));if(_0x30296d['error']){if(_0x30296d[_0x8f31('0x10')][_0x8f31('0x11')]===0x1f4){logger[_0x8f31('0x10')](_0x8f31('0xb'),_0x589d44,_0x30296d[_0x8f31('0x10')][_0x8f31('0x12')]);return _0x483b0e(_0x30296d[_0x8f31('0x10')]['message']);}logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x589d44,_0x30296d[_0x8f31('0x10')][_0x8f31('0x12')]);return _0x2be5e6(_0x30296d['error'][_0x8f31('0x12')]);}else{logger[_0x8f31('0x13')](_0x8f31('0xb'),_0x589d44,_0x8f31('0xc'));_0x2be5e6(_0x30296d['result']['message']);}})['catch'](function(_0x2d8069){logger[_0x8f31('0x10')]('UserVoiceQueue,\x20%s,\x20%s',_0x589d44,_0x2d8069);_0x483b0e(_0x2d8069);});});}