22f1182cf9a37a9de9df1829468081e7ac69f7e9
[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 _0xc555=['../../mysqldb','../../config/utils','../../config/logger','jayson/promise','client','http','request','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','error','code','message','info','lodash','moment','bluebird','randomstring','ioredis'];(function(_0x5216e0,_0x4f8cb9){var _0x5b3f40=function(_0x30c832){while(--_0x30c832){_0x5216e0['push'](_0x5216e0['shift']());}};_0x5b3f40(++_0x4f8cb9);}(_0xc555,0x80));var _0x5c55=function(_0x4b2436,_0x452299){_0x4b2436=_0x4b2436-0x0;var _0x4f5ab2=_0xc555[_0x4b2436];return _0x4f5ab2;};'use strict';var _=require(_0x5c55('0x0'));var util=require('util');var moment=require(_0x5c55('0x1'));var BPromise=require(_0x5c55('0x2'));var rs=require(_0x5c55('0x3'));var fs=require('fs');var Redis=require(_0x5c55('0x4'));var db=require(_0x5c55('0x5'))['db'];var utils=require(_0x5c55('0x6'));var logger=require(_0x5c55('0x7'))('rpc');var config=require('../../config/environment');var jayson=require(_0x5c55('0x8'));var client=jayson[_0x5c55('0x9')][_0x5c55('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x2cc287,_0x1f511f,_0x92fbd5){return new BPromise(function(_0x57f24f,_0x25f88c){return client[_0x5c55('0xb')](_0x2cc287,_0x92fbd5)['then'](function(_0x352b31){logger['info'](_0x5c55('0xc'),_0x1f511f,_0x5c55('0xd'));logger[_0x5c55('0xe')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x1f511f,'request\x20sent',JSON['stringify'](_0x352b31));if(_0x352b31[_0x5c55('0xf')]){if(_0x352b31[_0x5c55('0xf')][_0x5c55('0x10')]===0x1f4){logger['error']('UserVoiceQueue,\x20%s,\x20%s',_0x1f511f,_0x352b31[_0x5c55('0xf')][_0x5c55('0x11')]);return _0x25f88c(_0x352b31['error'][_0x5c55('0x11')]);}logger[_0x5c55('0xf')](_0x5c55('0xc'),_0x1f511f,_0x352b31['error'][_0x5c55('0x11')]);return _0x57f24f(_0x352b31[_0x5c55('0xf')][_0x5c55('0x11')]);}else{logger[_0x5c55('0x12')](_0x5c55('0xc'),_0x1f511f,_0x5c55('0xd'));_0x57f24f(_0x352b31['result'][_0x5c55('0x11')]);}})['catch'](function(_0x442be1){logger[_0x5c55('0xf')](_0x5c55('0xc'),_0x1f511f,_0x442be1);_0x25f88c(_0x442be1);});});}