b387141baff7bc90de0c75c1fc63cb685af111cf
[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 _0x3f47=['UserVoiceQueue,\x20%s,\x20%s','message','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','info','request\x20sent','UserVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x5aa87d,_0x3857d5){var _0x451cee=function(_0x41cde3){while(--_0x41cde3){_0x5aa87d['push'](_0x5aa87d['shift']());}};_0x451cee(++_0x3857d5);}(_0x3f47,0x1e6));var _0x73f4=function(_0x418838,_0x14e382){_0x418838=_0x418838-0x0;var _0x41167e=_0x3f47[_0x418838];return _0x41167e;};'use strict';var _=require(_0x73f4('0x0'));var util=require('util');var moment=require(_0x73f4('0x1'));var BPromise=require(_0x73f4('0x2'));var rs=require(_0x73f4('0x3'));var fs=require('fs');var Redis=require(_0x73f4('0x4'));var db=require(_0x73f4('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x73f4('0x6'))(_0x73f4('0x7'));var config=require(_0x73f4('0x8'));var jayson=require(_0x73f4('0x9'));var client=jayson[_0x73f4('0xa')][_0x73f4('0xb')]({'port':0x232a});function respondWithRpcPromise(_0x5bd30f,_0x48922b,_0x18de07){return new BPromise(function(_0xa47b1c,_0x2743dc){return client['request'](_0x5bd30f,_0x18de07)['then'](function(_0x3e9000){logger[_0x73f4('0xc')]('UserVoiceQueue,\x20%s,\x20%s',_0x48922b,_0x73f4('0xd'));logger['debug'](_0x73f4('0xe'),_0x48922b,_0x73f4('0xd'),JSON[_0x73f4('0xf')](_0x3e9000));if(_0x3e9000[_0x73f4('0x10')]){if(_0x3e9000['error'][_0x73f4('0x11')]===0x1f4){logger[_0x73f4('0x10')](_0x73f4('0x12'),_0x48922b,_0x3e9000[_0x73f4('0x10')][_0x73f4('0x13')]);return _0x2743dc(_0x3e9000['error'][_0x73f4('0x13')]);}logger['error'](_0x73f4('0x12'),_0x48922b,_0x3e9000[_0x73f4('0x10')]['message']);return _0xa47b1c(_0x3e9000[_0x73f4('0x10')][_0x73f4('0x13')]);}else{logger[_0x73f4('0xc')](_0x73f4('0x12'),_0x48922b,'request\x20sent');_0xa47b1c(_0x3e9000['result'][_0x73f4('0x13')]);}})[_0x73f4('0x14')](function(_0x1ad82f){logger[_0x73f4('0x10')](_0x73f4('0x12'),_0x48922b,_0x1ad82f);_0x2743dc(_0x1ad82f);});});}