3ba8d016a72d61a07023663539ed13b73d84cc5a
[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 _0x8812=['rpc','../../config/environment','jayson/promise','client','request','then','info','debug','TeamVoiceQueue,\x20%s,\x20%s,\x20%s','request\x20sent','stringify','error','message','TeamVoiceQueue,\x20%s,\x20%s','result','catch','lodash','util','moment','ioredis','../../mysqldb','../../config/utils','../../config/logger'];(function(_0x1ad926,_0x3e1fed){var _0x1b81dc=function(_0x506f83){while(--_0x506f83){_0x1ad926['push'](_0x1ad926['shift']());}};_0x1b81dc(++_0x3e1fed);}(_0x8812,0x169));var _0x2881=function(_0x4b8968,_0x5c9b44){_0x4b8968=_0x4b8968-0x0;var _0x3a0ab7=_0x8812[_0x4b8968];return _0x3a0ab7;};'use strict';var _=require(_0x2881('0x0'));var util=require(_0x2881('0x1'));var moment=require(_0x2881('0x2'));var BPromise=require('bluebird');var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x2881('0x3'));var db=require(_0x2881('0x4'))['db'];var utils=require(_0x2881('0x5'));var logger=require(_0x2881('0x6'))(_0x2881('0x7'));var config=require(_0x2881('0x8'));var jayson=require(_0x2881('0x9'));var client=jayson[_0x2881('0xa')]['http']({'port':0x232a});function respondWithRpcPromise(_0x5ebb38,_0x3c322c,_0xd549c4){return new BPromise(function(_0x455ffb,_0x270cfc){return client[_0x2881('0xb')](_0x5ebb38,_0xd549c4)[_0x2881('0xc')](function(_0x83aecc){logger[_0x2881('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3c322c,'request\x20sent');logger[_0x2881('0xe')](_0x2881('0xf'),_0x3c322c,_0x2881('0x10'),JSON[_0x2881('0x11')](_0x83aecc));if(_0x83aecc[_0x2881('0x12')]){if(_0x83aecc[_0x2881('0x12')]['code']===0x1f4){logger[_0x2881('0x12')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3c322c,_0x83aecc[_0x2881('0x12')]['message']);return _0x270cfc(_0x83aecc[_0x2881('0x12')][_0x2881('0x13')]);}logger[_0x2881('0x12')](_0x2881('0x14'),_0x3c322c,_0x83aecc[_0x2881('0x12')][_0x2881('0x13')]);return _0x455ffb(_0x83aecc[_0x2881('0x12')][_0x2881('0x13')]);}else{logger[_0x2881('0xd')]('TeamVoiceQueue,\x20%s,\x20%s',_0x3c322c,_0x2881('0x10'));_0x455ffb(_0x83aecc[_0x2881('0x15')]['message']);}})[_0x2881('0x16')](function(_0x417431){logger[_0x2881('0x12')](_0x2881('0x14'),_0x3c322c,_0x417431);_0x270cfc(_0x417431);});});}