Built motion from commit a679711e.|2.6.15
[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 _0xc3e3=['ioredis','../../config/logger','rpc','client','http','info','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code','message','catch','lodash','util','bluebird'];(function(_0x4e2f8e,_0x33b2e8){var _0x48571a=function(_0x1ec704){while(--_0x1ec704){_0x4e2f8e['push'](_0x4e2f8e['shift']());}};_0x48571a(++_0x33b2e8);}(_0xc3e3,0x151));var _0x3c3e=function(_0x5c0b22,_0x56d46a){_0x5c0b22=_0x5c0b22-0x0;var _0x16a8a6=_0xc3e3[_0x5c0b22];return _0x16a8a6;};'use strict';var _=require(_0x3c3e('0x0'));var util=require(_0x3c3e('0x1'));var moment=require('moment');var BPromise=require(_0x3c3e('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x3c3e('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require(_0x3c3e('0x4'))(_0x3c3e('0x5'));var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0x3c3e('0x6')][_0x3c3e('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x2ecb47,_0x1f7479,_0x54800d){return new BPromise(function(_0x3ede1b,_0x29c255){return client['request'](_0x2ecb47,_0x54800d)['then'](function(_0x4f2043){logger[_0x3c3e('0x8')](_0x3c3e('0x9'),_0x1f7479,_0x3c3e('0xa'));logger['debug'](_0x3c3e('0xb'),_0x1f7479,_0x3c3e('0xa'),JSON[_0x3c3e('0xc')](_0x4f2043));if(_0x4f2043[_0x3c3e('0xd')]){if(_0x4f2043['error'][_0x3c3e('0xe')]===0x1f4){logger['error'](_0x3c3e('0x9'),_0x1f7479,_0x4f2043[_0x3c3e('0xd')][_0x3c3e('0xf')]);return _0x29c255(_0x4f2043[_0x3c3e('0xd')][_0x3c3e('0xf')]);}logger['error'](_0x3c3e('0x9'),_0x1f7479,_0x4f2043[_0x3c3e('0xd')][_0x3c3e('0xf')]);return _0x3ede1b(_0x4f2043[_0x3c3e('0xd')][_0x3c3e('0xf')]);}else{logger['info'](_0x3c3e('0x9'),_0x1f7479,_0x3c3e('0xa'));_0x3ede1b(_0x4f2043['result']['message']);}})[_0x3c3e('0x10')](function(_0x2b2f01){logger[_0x3c3e('0xd')](_0x3c3e('0x9'),_0x1f7479,_0x2b2f01);_0x29c255(_0x2b2f01);});});}