297eb7850dcf9dd8ea300bca114cf10f0fe6360e
[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 _0xa6c1=['../../config/environment','jayson/promise','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','info','catch','lodash','randomstring','../../mysqldb'];(function(_0x5909bc,_0x5f2492){var _0x290006=function(_0x562558){while(--_0x562558){_0x5909bc['push'](_0x5909bc['shift']());}};_0x290006(++_0x5f2492);}(_0xa6c1,0x10d));var _0x1a6c=function(_0x2d8d69,_0x8e47ff){_0x2d8d69=_0x2d8d69-0x0;var _0x39ae22=_0xa6c1[_0x2d8d69];return _0x39ae22;};'use strict';var _=require(_0x1a6c('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x1a6c('0x1'));var fs=require('fs');var Redis=require('ioredis');var db=require(_0x1a6c('0x2'))['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x1a6c('0x3'));var jayson=require(_0x1a6c('0x4'));var client=jayson['client'][_0x1a6c('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x1623ca,_0x3570a7,_0xbc7801){return new BPromise(function(_0x2b8616,_0x1c248a){return client[_0x1a6c('0x6')](_0x1623ca,_0xbc7801)[_0x1a6c('0x7')](function(_0x307251){logger['info'](_0x1a6c('0x8'),_0x3570a7,_0x1a6c('0x9'));logger[_0x1a6c('0xa')](_0x1a6c('0xb'),_0x3570a7,'request\x20sent',JSON['stringify'](_0x307251));if(_0x307251[_0x1a6c('0xc')]){if(_0x307251[_0x1a6c('0xc')][_0x1a6c('0xd')]===0x1f4){logger[_0x1a6c('0xc')](_0x1a6c('0x8'),_0x3570a7,_0x307251[_0x1a6c('0xc')]['message']);return _0x1c248a(_0x307251[_0x1a6c('0xc')][_0x1a6c('0xe')]);}logger[_0x1a6c('0xc')](_0x1a6c('0x8'),_0x3570a7,_0x307251['error'][_0x1a6c('0xe')]);return _0x2b8616(_0x307251['error'][_0x1a6c('0xe')]);}else{logger[_0x1a6c('0xf')](_0x1a6c('0x8'),_0x3570a7,'request\x20sent');_0x2b8616(_0x307251['result'][_0x1a6c('0xe')]);}})[_0x1a6c('0x10')](function(_0x21aead){logger[_0x1a6c('0xc')](_0x1a6c('0x8'),_0x3570a7,_0x21aead);_0x1c248a(_0x21aead);});});}