2076571bdaecadd5032e928915511a26e9292580
[motion2.git] / server / api / teamVoiceQueue / teamVoiceQueue.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 _0x4fdc=['ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','client','http','request','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','result','catch','lodash','util','moment'];(function(_0xe49085,_0xf5d78b){var _0x3226af=function(_0x5a6fa0){while(--_0x5a6fa0){_0xe49085['push'](_0xe49085['shift']());}};_0x3226af(++_0xf5d78b);}(_0x4fdc,0xf9));var _0xc4fd=function(_0x3198b2,_0x3d85b0){_0x3198b2=_0x3198b2-0x0;var _0x27bc48=_0x4fdc[_0x3198b2];return _0x27bc48;};'use strict';var _=require(_0xc4fd('0x0'));var util=require(_0xc4fd('0x1'));var moment=require(_0xc4fd('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xc4fd('0x3'));var db=require(_0xc4fd('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xc4fd('0x5'))(_0xc4fd('0x6'));var config=require(_0xc4fd('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xc4fd('0x8')][_0xc4fd('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x348ede,_0x517ffd,_0x4204f0){return new BPromise(function(_0xf60880,_0x346d46){return client[_0xc4fd('0xa')](_0x348ede,_0x4204f0)['then'](function(_0x4eaeeb){logger[_0xc4fd('0xb')](_0xc4fd('0xc'),_0x517ffd,_0xc4fd('0xd'));logger[_0xc4fd('0xe')]('TeamVoiceQueue,\x20%s,\x20%s,\x20%s',_0x517ffd,'request\x20sent',JSON[_0xc4fd('0xf')](_0x4eaeeb));if(_0x4eaeeb[_0xc4fd('0x10')]){if(_0x4eaeeb['error'][_0xc4fd('0x11')]===0x1f4){logger['error']('TeamVoiceQueue,\x20%s,\x20%s',_0x517ffd,_0x4eaeeb[_0xc4fd('0x10')][_0xc4fd('0x12')]);return _0x346d46(_0x4eaeeb[_0xc4fd('0x10')][_0xc4fd('0x12')]);}logger[_0xc4fd('0x10')](_0xc4fd('0xc'),_0x517ffd,_0x4eaeeb[_0xc4fd('0x10')][_0xc4fd('0x12')]);return _0xf60880(_0x4eaeeb[_0xc4fd('0x10')]['message']);}else{logger[_0xc4fd('0xb')](_0xc4fd('0xc'),_0x517ffd,'request\x20sent');_0xf60880(_0x4eaeeb[_0xc4fd('0x13')]['message']);}})[_0xc4fd('0x14')](function(_0x4d0407){logger[_0xc4fd('0x10')](_0xc4fd('0xc'),_0x517ffd,_0x4d0407);_0x346d46(_0x4d0407);});});}