b43304f637aa9ec5f65ea4ee9ad1d17ebd2f02bc
[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 _0x24db=['catch','util','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','client','http','then','info','VoiceQueuesLog,\x20%s,\x20%s','request\x20sent','debug','VoiceQueuesLog,\x20%s,\x20%s,\x20%s','error','message','result'];(function(_0x3024e5,_0x3261ac){var _0x4d988a=function(_0x90d571){while(--_0x90d571){_0x3024e5['push'](_0x3024e5['shift']());}};_0x4d988a(++_0x3261ac);}(_0x24db,0x17d));var _0xb24d=function(_0x3dd15e,_0x1f0015){_0x3dd15e=_0x3dd15e-0x0;var _0x231fd0=_0x24db[_0x3dd15e];return _0x231fd0;};'use strict';var _=require('lodash');var util=require(_0xb24d('0x0'));var moment=require(_0xb24d('0x1'));var BPromise=require(_0xb24d('0x2'));var rs=require(_0xb24d('0x3'));var fs=require('fs');var Redis=require(_0xb24d('0x4'));var db=require(_0xb24d('0x5'))['db'];var utils=require(_0xb24d('0x6'));var logger=require(_0xb24d('0x7'))('rpc');var config=require('../../config/environment');var jayson=require('jayson/promise');var client=jayson[_0xb24d('0x8')][_0xb24d('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x37754f,_0x477ed8,_0x13158c){return new BPromise(function(_0x99799c,_0xd0ab81){return client['request'](_0x37754f,_0x13158c)[_0xb24d('0xa')](function(_0x3bdaeb){logger[_0xb24d('0xb')](_0xb24d('0xc'),_0x477ed8,_0xb24d('0xd'));logger[_0xb24d('0xe')](_0xb24d('0xf'),_0x477ed8,'request\x20sent',JSON['stringify'](_0x3bdaeb));if(_0x3bdaeb['error']){if(_0x3bdaeb[_0xb24d('0x10')]['code']===0x1f4){logger[_0xb24d('0x10')](_0xb24d('0xc'),_0x477ed8,_0x3bdaeb[_0xb24d('0x10')][_0xb24d('0x11')]);return _0xd0ab81(_0x3bdaeb[_0xb24d('0x10')]['message']);}logger[_0xb24d('0x10')](_0xb24d('0xc'),_0x477ed8,_0x3bdaeb[_0xb24d('0x10')]['message']);return _0x99799c(_0x3bdaeb['error']['message']);}else{logger[_0xb24d('0xb')](_0xb24d('0xc'),_0x477ed8,_0xb24d('0xd'));_0x99799c(_0x3bdaeb[_0xb24d('0x12')][_0xb24d('0x11')]);}})[_0xb24d('0x13')](function(_0x366390){logger[_0xb24d('0x10')](_0xb24d('0xc'),_0x477ed8,_0x366390);_0xd0ab81(_0x366390);});});}