5b34cccd0a42dcd010b76cf28c81948465830334
[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 _0x7b2a=['jayson/promise','client','http','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment'];(function(_0xd6ca7,_0xf8aca2){var _0x5f269f=function(_0x1c58b9){while(--_0x1c58b9){_0xd6ca7['push'](_0xd6ca7['shift']());}};_0x5f269f(++_0xf8aca2);}(_0x7b2a,0xf2));var _0xa7b2=function(_0x150127,_0x41c520){_0x150127=_0x150127-0x0;var _0x24b9f0=_0x7b2a[_0x150127];return _0x24b9f0;};'use strict';var _=require(_0xa7b2('0x0'));var util=require(_0xa7b2('0x1'));var moment=require(_0xa7b2('0x2'));var BPromise=require(_0xa7b2('0x3'));var rs=require(_0xa7b2('0x4'));var fs=require('fs');var Redis=require(_0xa7b2('0x5'));var db=require(_0xa7b2('0x6'))['db'];var utils=require(_0xa7b2('0x7'));var logger=require('../../config/logger')(_0xa7b2('0x8'));var config=require(_0xa7b2('0x9'));var jayson=require(_0xa7b2('0xa'));var client=jayson[_0xa7b2('0xb')][_0xa7b2('0xc')]({'port':0x232a});function respondWithRpcPromise(_0x27fe19,_0x35bef5,_0x30701e){return new BPromise(function(_0x25a959,_0x578be4){return client['request'](_0x27fe19,_0x30701e)['then'](function(_0x78cd97){logger['info'](_0xa7b2('0xd'),_0x35bef5,_0xa7b2('0xe'));logger[_0xa7b2('0xf')](_0xa7b2('0x10'),_0x35bef5,_0xa7b2('0xe'),JSON[_0xa7b2('0x11')](_0x78cd97));if(_0x78cd97[_0xa7b2('0x12')]){if(_0x78cd97['error'][_0xa7b2('0x13')]===0x1f4){logger['error'](_0xa7b2('0xd'),_0x35bef5,_0x78cd97[_0xa7b2('0x12')][_0xa7b2('0x14')]);return _0x578be4(_0x78cd97['error'][_0xa7b2('0x14')]);}logger[_0xa7b2('0x12')](_0xa7b2('0xd'),_0x35bef5,_0x78cd97[_0xa7b2('0x12')][_0xa7b2('0x14')]);return _0x25a959(_0x78cd97[_0xa7b2('0x12')][_0xa7b2('0x14')]);}else{logger['info'](_0xa7b2('0xd'),_0x35bef5,'request\x20sent');_0x25a959(_0x78cd97['result'][_0xa7b2('0x14')]);}})['catch'](function(_0x5e9fe3){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x35bef5,_0x5e9fe3);_0x578be4(_0x5e9fe3);});});}