520dc244bce05a273787bd1c278b2e4c569fc727
[motion2.git] / server / api / voiceQueuesLog / voiceQueuesLog.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 _0x2f3a=['http','request','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code','message','catch','lodash','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','../../config/environment','client'];(function(_0x3fc5cd,_0x5cbf7b){var _0x3691bd=function(_0x271fa5){while(--_0x271fa5){_0x3fc5cd['push'](_0x3fc5cd['shift']());}};_0x3691bd(++_0x5cbf7b);}(_0x2f3a,0xfb));var _0xa2f3=function(_0x294e7c,_0x14ce99){_0x294e7c=_0x294e7c-0x0;var _0x47b001=_0x2f3a[_0x294e7c];return _0x47b001;};'use strict';var _=require(_0xa2f3('0x0'));var util=require('util');var moment=require('moment');var BPromise=require(_0xa2f3('0x1'));var rs=require(_0xa2f3('0x2'));var fs=require('fs');var Redis=require(_0xa2f3('0x3'));var db=require(_0xa2f3('0x4'))['db'];var utils=require(_0xa2f3('0x5'));var logger=require(_0xa2f3('0x6'))('rpc');var config=require(_0xa2f3('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xa2f3('0x8')][_0xa2f3('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x4db21d,_0x521ddf,_0x2faf36){return new BPromise(function(_0x3944a0,_0x4405a2){return client[_0xa2f3('0xa')](_0x4db21d,_0x2faf36)['then'](function(_0x358263){logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));logger[_0xa2f3('0xe')]('VoiceQueuesLog,\x20%s,\x20%s,\x20%s',_0x521ddf,_0xa2f3('0xd'),JSON[_0xa2f3('0xf')](_0x358263));if(_0x358263['error']){if(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x11')]===0x1f4){logger[_0xa2f3('0x10')]('VoiceQueuesLog,\x20%s,\x20%s',_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x4405a2(_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);}logger[_0xa2f3('0x10')](_0xa2f3('0xc'),_0x521ddf,_0x358263[_0xa2f3('0x10')][_0xa2f3('0x12')]);return _0x3944a0(_0x358263[_0xa2f3('0x10')]['message']);}else{logger[_0xa2f3('0xb')](_0xa2f3('0xc'),_0x521ddf,_0xa2f3('0xd'));_0x3944a0(_0x358263['result'][_0xa2f3('0x12')]);}})[_0xa2f3('0x13')](function(_0x4b138b){logger['error'](_0xa2f3('0xc'),_0x521ddf,_0x4b138b);_0x4405a2(_0x4b138b);});});}