a5bf15dadd74fa8aadd7d4c1c2ce074aef99dd9c
[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 _0x05a2=['../../config/logger','rpc','../../config/environment','jayson/promise','request','info','UserVoiceQueue,\x20%s,\x20%s','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','code','error','message','request\x20sent','result','lodash','util','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils'];(function(_0x462cce,_0x259961){var _0x420ff8=function(_0x57485c){while(--_0x57485c){_0x462cce['push'](_0x462cce['shift']());}};_0x420ff8(++_0x259961);}(_0x05a2,0x12d));var _0x205a=function(_0x304c01,_0x41a9db){_0x304c01=_0x304c01-0x0;var _0x4551b6=_0x05a2[_0x304c01];return _0x4551b6;};'use strict';var _=require(_0x205a('0x0'));var util=require(_0x205a('0x1'));var moment=require('moment');var BPromise=require(_0x205a('0x2'));var rs=require(_0x205a('0x3'));var fs=require('fs');var Redis=require(_0x205a('0x4'));var db=require(_0x205a('0x5'))['db'];var utils=require(_0x205a('0x6'));var logger=require(_0x205a('0x7'))(_0x205a('0x8'));var config=require(_0x205a('0x9'));var jayson=require(_0x205a('0xa'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0xf1daa,_0x1fb102,_0x4d0597){return new BPromise(function(_0x3079db,_0x1000f8){return client[_0x205a('0xb')](_0xf1daa,_0x4d0597)['then'](function(_0x5609ef){logger[_0x205a('0xc')](_0x205a('0xd'),_0x1fb102,'request\x20sent');logger[_0x205a('0xe')](_0x205a('0xf'),_0x1fb102,'request\x20sent',JSON[_0x205a('0x10')](_0x5609ef));if(_0x5609ef['error']){if(_0x5609ef['error'][_0x205a('0x11')]===0x1f4){logger[_0x205a('0x12')](_0x205a('0xd'),_0x1fb102,_0x5609ef['error'][_0x205a('0x13')]);return _0x1000f8(_0x5609ef[_0x205a('0x12')][_0x205a('0x13')]);}logger['error'](_0x205a('0xd'),_0x1fb102,_0x5609ef[_0x205a('0x12')]['message']);return _0x3079db(_0x5609ef[_0x205a('0x12')]['message']);}else{logger[_0x205a('0xc')](_0x205a('0xd'),_0x1fb102,_0x205a('0x14'));_0x3079db(_0x5609ef[_0x205a('0x15')][_0x205a('0x13')]);}})['catch'](function(_0x5002da){logger['error'](_0x205a('0xd'),_0x1fb102,_0x5002da);_0x1000f8(_0x5002da);});});}