6992dbd36f92b33298fcb29c98c8fffcd11028a4
[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 _0x6d18=['jayson/promise','client','http','request','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','result','lodash','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc'];(function(_0x54b1cb,_0x3bc18e){var _0x4ec375=function(_0x3a286a){while(--_0x3a286a){_0x54b1cb['push'](_0x54b1cb['shift']());}};_0x4ec375(++_0x3bc18e);}(_0x6d18,0x7e));var _0x86d1=function(_0x24c377,_0x246ccc){_0x24c377=_0x24c377-0x0;var _0xd98d96=_0x6d18[_0x24c377];return _0xd98d96;};'use strict';var _=require(_0x86d1('0x0'));var util=require('util');var moment=require(_0x86d1('0x1'));var BPromise=require(_0x86d1('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x86d1('0x3'));var db=require(_0x86d1('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x86d1('0x5'))(_0x86d1('0x6'));var config=require('../../config/environment');var jayson=require(_0x86d1('0x7'));var client=jayson[_0x86d1('0x8')][_0x86d1('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x2a096f,_0x3cf818,_0x181e67){return new BPromise(function(_0x2dcdbb,_0x1e40eb){return client[_0x86d1('0xa')](_0x2a096f,_0x181e67)['then'](function(_0x33f2c5){logger[_0x86d1('0xb')](_0x86d1('0xc'),_0x3cf818,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x3cf818,_0x86d1('0xd'),JSON[_0x86d1('0xe')](_0x33f2c5));if(_0x33f2c5[_0x86d1('0xf')]){if(_0x33f2c5[_0x86d1('0xf')][_0x86d1('0x10')]===0x1f4){logger[_0x86d1('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x3cf818,_0x33f2c5[_0x86d1('0xf')]['message']);return _0x1e40eb(_0x33f2c5[_0x86d1('0xf')][_0x86d1('0x11')]);}logger[_0x86d1('0xf')]('UserVoiceQueue,\x20%s,\x20%s',_0x3cf818,_0x33f2c5[_0x86d1('0xf')][_0x86d1('0x11')]);return _0x2dcdbb(_0x33f2c5[_0x86d1('0xf')][_0x86d1('0x11')]);}else{logger['info']('UserVoiceQueue,\x20%s,\x20%s',_0x3cf818,_0x86d1('0xd'));_0x2dcdbb(_0x33f2c5[_0x86d1('0x12')][_0x86d1('0x11')]);}})['catch'](function(_0xddede0){logger[_0x86d1('0xf')](_0x86d1('0xc'),_0x3cf818,_0xddede0);_0x1e40eb(_0xddede0);});});}