5216cefcdad4fa6edb49e8475f176575904727c4
[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 _0x0e5d=['rpc','../../config/environment','http','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','stringify','error','code','message','info','result','lodash','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x47b58b,_0x41a189){var _0x46bebe=function(_0x22bbfa){while(--_0x22bbfa){_0x47b58b['push'](_0x47b58b['shift']());}};_0x46bebe(++_0x41a189);}(_0x0e5d,0x1c0));var _0xd0e5=function(_0x14d38a,_0x57f85d){_0x14d38a=_0x14d38a-0x0;var _0x35e2c2=_0x0e5d[_0x14d38a];return _0x35e2c2;};'use strict';var _=require(_0xd0e5('0x0'));var util=require(_0xd0e5('0x1'));var moment=require(_0xd0e5('0x2'));var BPromise=require(_0xd0e5('0x3'));var rs=require(_0xd0e5('0x4'));var fs=require('fs');var Redis=require(_0xd0e5('0x5'));var db=require(_0xd0e5('0x6'))['db'];var utils=require(_0xd0e5('0x7'));var logger=require('../../config/logger')(_0xd0e5('0x8'));var config=require(_0xd0e5('0x9'));var jayson=require('jayson/promise');var client=jayson['client'][_0xd0e5('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x5ad865,_0x548da2,_0x2d6941){return new BPromise(function(_0x41cab8,_0x5369ad){return client['request'](_0x5ad865,_0x2d6941)['then'](function(_0xbc9207){logger['info'](_0xd0e5('0xb'),_0x548da2,'request\x20sent');logger['debug']('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x548da2,_0xd0e5('0xc'),JSON[_0xd0e5('0xd')](_0xbc9207));if(_0xbc9207[_0xd0e5('0xe')]){if(_0xbc9207[_0xd0e5('0xe')][_0xd0e5('0xf')]===0x1f4){logger[_0xd0e5('0xe')]('UserVoiceQueue,\x20%s,\x20%s',_0x548da2,_0xbc9207[_0xd0e5('0xe')][_0xd0e5('0x10')]);return _0x5369ad(_0xbc9207['error'][_0xd0e5('0x10')]);}logger['error'](_0xd0e5('0xb'),_0x548da2,_0xbc9207[_0xd0e5('0xe')]['message']);return _0x41cab8(_0xbc9207['error'][_0xd0e5('0x10')]);}else{logger[_0xd0e5('0x11')](_0xd0e5('0xb'),_0x548da2,'request\x20sent');_0x41cab8(_0xbc9207[_0xd0e5('0x12')][_0xd0e5('0x10')]);}})['catch'](function(_0x2959f3){logger[_0xd0e5('0xe')](_0xd0e5('0xb'),_0x548da2,_0x2959f3);_0x5369ad(_0x2959f3);});});}