e730a8413f9df7b62f1831746b463604e679ab02
[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 _0x3986=['message','result','catch','lodash','util','randomstring','ioredis','../../mysqldb','../../config/logger','../../config/environment','client','http','request','then','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5446db,_0x14ec09){var _0x4fb491=function(_0x529c60){while(--_0x529c60){_0x5446db['push'](_0x5446db['shift']());}};_0x4fb491(++_0x14ec09);}(_0x3986,0x1e7));var _0x6398=function(_0xd49ec8,_0x557496){_0xd49ec8=_0xd49ec8-0x0;var _0x9c80ad=_0x3986[_0xd49ec8];return _0x9c80ad;};'use strict';var _=require(_0x6398('0x0'));var util=require(_0x6398('0x1'));var moment=require('moment');var BPromise=require('bluebird');var rs=require(_0x6398('0x2'));var fs=require('fs');var Redis=require(_0x6398('0x3'));var db=require(_0x6398('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x6398('0x5'))('rpc');var config=require(_0x6398('0x6'));var jayson=require('jayson/promise');var client=jayson[_0x6398('0x7')][_0x6398('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x1b4424,_0x27a5d0,_0x2e1138){return new BPromise(function(_0x86d5b7,_0x497485){return client[_0x6398('0x9')](_0x1b4424,_0x2e1138)[_0x6398('0xa')](function(_0x44fb30){logger[_0x6398('0xb')](_0x6398('0xc'),_0x27a5d0,_0x6398('0xd'));logger[_0x6398('0xe')](_0x6398('0xf'),_0x27a5d0,_0x6398('0xd'),JSON[_0x6398('0x10')](_0x44fb30));if(_0x44fb30[_0x6398('0x11')]){if(_0x44fb30['error'][_0x6398('0x12')]===0x1f4){logger[_0x6398('0x11')](_0x6398('0xc'),_0x27a5d0,_0x44fb30[_0x6398('0x11')][_0x6398('0x13')]);return _0x497485(_0x44fb30[_0x6398('0x11')]['message']);}logger[_0x6398('0x11')](_0x6398('0xc'),_0x27a5d0,_0x44fb30[_0x6398('0x11')][_0x6398('0x13')]);return _0x86d5b7(_0x44fb30[_0x6398('0x11')][_0x6398('0x13')]);}else{logger[_0x6398('0xb')](_0x6398('0xc'),_0x27a5d0,'request\x20sent');_0x86d5b7(_0x44fb30[_0x6398('0x14')][_0x6398('0x13')]);}})[_0x6398('0x15')](function(_0x16315d){logger[_0x6398('0x11')]('UserVoiceQueue,\x20%s,\x20%s',_0x27a5d0,_0x16315d);_0x497485(_0x16315d);});});}