e9062e74ddaa2eb1411f7eecfbd582720a6f9efa
[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 _0xb95b=['info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','message','result','catch','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','request','then'];(function(_0x5860eb,_0x1c55f1){var _0xcb2136=function(_0x11ef40){while(--_0x11ef40){_0x5860eb['push'](_0x5860eb['shift']());}};_0xcb2136(++_0x1c55f1);}(_0xb95b,0xfb));var _0xbb95=function(_0x2a8780,_0x1b5c4c){_0x2a8780=_0x2a8780-0x0;var _0x5c9dad=_0xb95b[_0x2a8780];return _0x5c9dad;};'use strict';var _=require('lodash');var util=require('util');var moment=require('moment');var BPromise=require(_0xbb95('0x0'));var rs=require(_0xbb95('0x1'));var fs=require('fs');var Redis=require(_0xbb95('0x2'));var db=require(_0xbb95('0x3'))['db'];var utils=require(_0xbb95('0x4'));var logger=require(_0xbb95('0x5'))(_0xbb95('0x6'));var config=require(_0xbb95('0x7'));var jayson=require(_0xbb95('0x8'));var client=jayson[_0xbb95('0x9')][_0xbb95('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x478935,_0x53c543,_0x5c93be){return new BPromise(function(_0x5c9e5c,_0x3b9f96){return client[_0xbb95('0xb')](_0x478935,_0x5c93be)[_0xbb95('0xc')](function(_0x312a45){logger[_0xbb95('0xd')](_0xbb95('0xe'),_0x53c543,_0xbb95('0xf'));logger['debug'](_0xbb95('0x10'),_0x53c543,'request\x20sent',JSON[_0xbb95('0x11')](_0x312a45));if(_0x312a45[_0xbb95('0x12')]){if(_0x312a45[_0xbb95('0x12')]['code']===0x1f4){logger[_0xbb95('0x12')](_0xbb95('0xe'),_0x53c543,_0x312a45[_0xbb95('0x12')][_0xbb95('0x13')]);return _0x3b9f96(_0x312a45[_0xbb95('0x12')][_0xbb95('0x13')]);}logger[_0xbb95('0x12')](_0xbb95('0xe'),_0x53c543,_0x312a45[_0xbb95('0x12')][_0xbb95('0x13')]);return _0x5c9e5c(_0x312a45[_0xbb95('0x12')]['message']);}else{logger[_0xbb95('0xd')]('UserVoiceQueue,\x20%s,\x20%s',_0x53c543,_0xbb95('0xf'));_0x5c9e5c(_0x312a45[_0xbb95('0x14')][_0xbb95('0x13')]);}})[_0xbb95('0x15')](function(_0x4eceea){logger['error'](_0xbb95('0xe'),_0x53c543,_0x4eceea);_0x3b9f96(_0x4eceea);});});}