Built motion from commit (unavailable).|2.5.22
[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 _0xf0bb=['UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','message','info','result','lodash','../../mysqldb','../../config/utils','rpc','jayson/promise','http','request','then'];(function(_0x2258e8,_0x396f17){var _0x539892=function(_0x5cd308){while(--_0x5cd308){_0x2258e8['push'](_0x2258e8['shift']());}};_0x539892(++_0x396f17);}(_0xf0bb,0x128));var _0xbf0b=function(_0x2dafbe,_0x5d04de){_0x2dafbe=_0x2dafbe-0x0;var _0x58a45a=_0xf0bb[_0x2dafbe];return _0x58a45a;};'use strict';var _=require(_0xbf0b('0x0'));var util=require('util');var moment=require('moment');var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0xbf0b('0x1'))['db'];var utils=require(_0xbf0b('0x2'));var logger=require('../../config/logger')(_0xbf0b('0x3'));var config=require('../../config/environment');var jayson=require(_0xbf0b('0x4'));var client=jayson['client'][_0xbf0b('0x5')]({'port':0x232a});function respondWithRpcPromise(_0x5e33f2,_0x4a3ed9,_0x5a27c8){return new BPromise(function(_0x45a0b8,_0x276806){return client[_0xbf0b('0x6')](_0x5e33f2,_0x5a27c8)[_0xbf0b('0x7')](function(_0x34d295){logger['info'](_0xbf0b('0x8'),_0x4a3ed9,_0xbf0b('0x9'));logger[_0xbf0b('0xa')]('UserVoiceQueue,\x20%s,\x20%s,\x20%s',_0x4a3ed9,_0xbf0b('0x9'),JSON[_0xbf0b('0xb')](_0x34d295));if(_0x34d295[_0xbf0b('0xc')]){if(_0x34d295[_0xbf0b('0xc')]['code']===0x1f4){logger['error'](_0xbf0b('0x8'),_0x4a3ed9,_0x34d295[_0xbf0b('0xc')]['message']);return _0x276806(_0x34d295[_0xbf0b('0xc')][_0xbf0b('0xd')]);}logger[_0xbf0b('0xc')](_0xbf0b('0x8'),_0x4a3ed9,_0x34d295['error'][_0xbf0b('0xd')]);return _0x45a0b8(_0x34d295['error'][_0xbf0b('0xd')]);}else{logger[_0xbf0b('0xe')](_0xbf0b('0x8'),_0x4a3ed9,_0xbf0b('0x9'));_0x45a0b8(_0x34d295[_0xbf0b('0xf')][_0xbf0b('0xd')]);}})['catch'](function(_0x3cca86){logger[_0xbf0b('0xc')](_0xbf0b('0x8'),_0x4a3ed9,_0x3cca86);_0x276806(_0x3cca86);});});}