912553462121ab02a06dcf29e8eadc31e41b425a
[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 _0xd685=['../../mysqldb','../../config/logger','rpc','jayson/promise','client','http','request','then','UserVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','UserVoiceQueue,\x20%s,\x20%s,\x20%s','error','code','message','result','catch','lodash','util','moment','randomstring','ioredis'];(function(_0x54fa2,_0x3bc36c){var _0x1d8ce8=function(_0x26f8dc){while(--_0x26f8dc){_0x54fa2['push'](_0x54fa2['shift']());}};_0x1d8ce8(++_0x3bc36c);}(_0xd685,0x15b));var _0x5d68=function(_0x500652,_0x5dbac0){_0x500652=_0x500652-0x0;var _0x363e87=_0xd685[_0x500652];return _0x363e87;};'use strict';var _=require(_0x5d68('0x0'));var util=require(_0x5d68('0x1'));var moment=require(_0x5d68('0x2'));var BPromise=require('bluebird');var rs=require(_0x5d68('0x3'));var fs=require('fs');var Redis=require(_0x5d68('0x4'));var db=require(_0x5d68('0x5'))['db'];var utils=require('../../config/utils');var logger=require(_0x5d68('0x6'))(_0x5d68('0x7'));var config=require('../../config/environment');var jayson=require(_0x5d68('0x8'));var client=jayson[_0x5d68('0x9')][_0x5d68('0xa')]({'port':0x232a});function respondWithRpcPromise(_0xfa9c55,_0x343a47,_0x3db957){return new BPromise(function(_0x2fc806,_0x2a1848){return client[_0x5d68('0xb')](_0xfa9c55,_0x3db957)[_0x5d68('0xc')](function(_0x255229){logger['info'](_0x5d68('0xd'),_0x343a47,_0x5d68('0xe'));logger[_0x5d68('0xf')](_0x5d68('0x10'),_0x343a47,_0x5d68('0xe'),JSON['stringify'](_0x255229));if(_0x255229[_0x5d68('0x11')]){if(_0x255229[_0x5d68('0x11')][_0x5d68('0x12')]===0x1f4){logger['error'](_0x5d68('0xd'),_0x343a47,_0x255229[_0x5d68('0x11')][_0x5d68('0x13')]);return _0x2a1848(_0x255229[_0x5d68('0x11')]['message']);}logger[_0x5d68('0x11')](_0x5d68('0xd'),_0x343a47,_0x255229['error']['message']);return _0x2fc806(_0x255229[_0x5d68('0x11')][_0x5d68('0x13')]);}else{logger['info'](_0x5d68('0xd'),_0x343a47,_0x5d68('0xe'));_0x2fc806(_0x255229[_0x5d68('0x14')]['message']);}})[_0x5d68('0x15')](function(_0x14828a){logger[_0x5d68('0x11')](_0x5d68('0xd'),_0x343a47,_0x14828a);_0x2a1848(_0x14828a);});});}