2297fe461e22041f34178c830bbd36473d198339
[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 _0xb81e=['../../config/logger','rpc','../../config/environment','client','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','ioredis'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0xb81e,0x94));var _0xeb81=function(_0x42931b,_0x527b9e){_0x42931b=_0x42931b-0x0;var _0x3c0ad7=_0xb81e[_0x42931b];return _0x3c0ad7;};'use strict';var _=require(_0xeb81('0x0'));var util=require(_0xeb81('0x1'));var moment=require(_0xeb81('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xeb81('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0xeb81('0x4'))(_0xeb81('0x5'));var config=require(_0xeb81('0x6'));var jayson=require('jayson/promise');var client=jayson[_0xeb81('0x7')][_0xeb81('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x9eb48c,_0x487368,_0x4df85c){return new BPromise(function(_0x23e61d,_0x448d4c){return client['request'](_0x9eb48c,_0x4df85c)['then'](function(_0x5b569f){logger[_0xeb81('0x9')](_0xeb81('0xa'),_0x487368,_0xeb81('0xb'));logger[_0xeb81('0xc')](_0xeb81('0xd'),_0x487368,_0xeb81('0xb'),JSON['stringify'](_0x5b569f));if(_0x5b569f[_0xeb81('0xe')]){if(_0x5b569f[_0xeb81('0xe')][_0xeb81('0xf')]===0x1f4){logger[_0xeb81('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x487368,_0x5b569f[_0xeb81('0xe')][_0xeb81('0x10')]);return _0x448d4c(_0x5b569f[_0xeb81('0xe')][_0xeb81('0x10')]);}logger[_0xeb81('0xe')](_0xeb81('0xa'),_0x487368,_0x5b569f['error'][_0xeb81('0x10')]);return _0x23e61d(_0x5b569f[_0xeb81('0xe')][_0xeb81('0x10')]);}else{logger[_0xeb81('0x9')]('UserVoiceQueue,\x20%s,\x20%s',_0x487368,_0xeb81('0xb'));_0x23e61d(_0x5b569f[_0xeb81('0x11')]['message']);}})[_0xeb81('0x12')](function(_0xa95ac4){logger[_0xeb81('0xe')](_0xeb81('0xa'),_0x487368,_0xa95ac4);_0x448d4c(_0xa95ac4);});});}