00cb4dadcb2b6ec6643fc11be485843741d917eb
[motion2.git] / server / api / voiceChanSpy / voiceChanSpy.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 _0x3388=['request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','request','then','info'];(function(_0x44ae1e,_0x366674){var _0x3ef63d=function(_0x2535d4){while(--_0x2535d4){_0x44ae1e['push'](_0x44ae1e['shift']());}};_0x3ef63d(++_0x366674);}(_0x3388,0x134));var _0x8338=function(_0x392483,_0x1c1273){_0x392483=_0x392483-0x0;var _0x41b4b4=_0x3388[_0x392483];return _0x41b4b4;};'use strict';var _=require('lodash');var util=require(_0x8338('0x0'));var moment=require(_0x8338('0x1'));var BPromise=require(_0x8338('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x8338('0x3'));var db=require(_0x8338('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0x8338('0x5'))(_0x8338('0x6'));var config=require(_0x8338('0x7'));var jayson=require(_0x8338('0x8'));var client=jayson['client']['http']({'port':0x232a});function respondWithRpcPromise(_0x2054ac,_0x45f115,_0x453700){return new BPromise(function(_0x587e9e,_0x107e20){return client[_0x8338('0x9')](_0x2054ac,_0x453700)[_0x8338('0xa')](function(_0x4a543e){logger[_0x8338('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x45f115,_0x8338('0xc'));logger['debug'](_0x8338('0xd'),_0x45f115,_0x8338('0xc'),JSON[_0x8338('0xe')](_0x4a543e));if(_0x4a543e[_0x8338('0xf')]){if(_0x4a543e[_0x8338('0xf')][_0x8338('0x10')]===0x1f4){logger['error'](_0x8338('0x11'),_0x45f115,_0x4a543e[_0x8338('0xf')][_0x8338('0x12')]);return _0x107e20(_0x4a543e[_0x8338('0xf')]['message']);}logger[_0x8338('0xf')](_0x8338('0x11'),_0x45f115,_0x4a543e['error']['message']);return _0x587e9e(_0x4a543e['error'][_0x8338('0x12')]);}else{logger[_0x8338('0xb')]('VoiceChanSpy,\x20%s,\x20%s',_0x45f115,_0x8338('0xc'));_0x587e9e(_0x4a543e['result'][_0x8338('0x12')]);}})[_0x8338('0x13')](function(_0x10c0dc){logger[_0x8338('0xf')]('VoiceChanSpy,\x20%s,\x20%s',_0x45f115,_0x10c0dc);_0x107e20(_0x10c0dc);});});}