4195636fbf15c39b88f5ecc23489846fc26e41e1
[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 _0x6ae0=['message','result','lodash','util','moment','bluebird','../../mysqldb','../../config/logger','../../config/environment','jayson/promise','http','request','then','info','TeamVoiceQueue,\x20%s,\x20%s','request\x20sent','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','stringify','error','code'];(function(_0x501510,_0x61caa9){var _0x1e6ee5=function(_0x32845b){while(--_0x32845b){_0x501510['push'](_0x501510['shift']());}};_0x1e6ee5(++_0x61caa9);}(_0x6ae0,0x192));var _0x06ae=function(_0x296629,_0x513ab8){_0x296629=_0x296629-0x0;var _0x15d921=_0x6ae0[_0x296629];return _0x15d921;};'use strict';var _=require(_0x06ae('0x0'));var util=require(_0x06ae('0x1'));var moment=require(_0x06ae('0x2'));var BPromise=require(_0x06ae('0x3'));var rs=require('randomstring');var fs=require('fs');var Redis=require('ioredis');var db=require(_0x06ae('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x06ae('0x5'))('rpc');var config=require(_0x06ae('0x6'));var jayson=require(_0x06ae('0x7'));var client=jayson['client'][_0x06ae('0x8')]({'port':0x232a});function respondWithRpcPromise(_0x51bac4,_0x26167c,_0x2bc2ad){return new BPromise(function(_0x591c0f,_0x269be5){return client[_0x06ae('0x9')](_0x51bac4,_0x2bc2ad)[_0x06ae('0xa')](function(_0x39f10e){logger[_0x06ae('0xb')](_0x06ae('0xc'),_0x26167c,_0x06ae('0xd'));logger['debug'](_0x06ae('0xe'),_0x26167c,_0x06ae('0xd'),JSON[_0x06ae('0xf')](_0x39f10e));if(_0x39f10e[_0x06ae('0x10')]){if(_0x39f10e[_0x06ae('0x10')][_0x06ae('0x11')]===0x1f4){logger[_0x06ae('0x10')]('TeamVoiceQueue,\x20%s,\x20%s',_0x26167c,_0x39f10e['error']['message']);return _0x269be5(_0x39f10e[_0x06ae('0x10')]['message']);}logger[_0x06ae('0x10')](_0x06ae('0xc'),_0x26167c,_0x39f10e[_0x06ae('0x10')][_0x06ae('0x12')]);return _0x591c0f(_0x39f10e['error']['message']);}else{logger[_0x06ae('0xb')]('TeamVoiceQueue,\x20%s,\x20%s',_0x26167c,_0x06ae('0xd'));_0x591c0f(_0x39f10e[_0x06ae('0x13')][_0x06ae('0x12')]);}})['catch'](function(_0x4ec020){logger['error'](_0x06ae('0xc'),_0x26167c,_0x4ec020);_0x269be5(_0x4ec020);});});}