f52ce3534683a2459939e71b14e39c85cd336a1c
[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 _0x71e4=['info','request\x20sent','debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','VoiceChanSpy,\x20%s,\x20%s','catch','lodash','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','rpc','../../config/environment','http','request','then'];(function(_0x350aeb,_0x3d265a){var _0x3c5273=function(_0x32b417){while(--_0x32b417){_0x350aeb['push'](_0x350aeb['shift']());}};_0x3c5273(++_0x3d265a);}(_0x71e4,0xd0));var _0x471e=function(_0x491082,_0x28f78b){_0x491082=_0x491082-0x0;var _0x5797d9=_0x71e4[_0x491082];return _0x5797d9;};'use strict';var _=require(_0x471e('0x0'));var util=require('util');var moment=require(_0x471e('0x1'));var BPromise=require(_0x471e('0x2'));var rs=require(_0x471e('0x3'));var fs=require('fs');var Redis=require(_0x471e('0x4'));var db=require(_0x471e('0x5'))['db'];var utils=require(_0x471e('0x6'));var logger=require('../../config/logger')(_0x471e('0x7'));var config=require(_0x471e('0x8'));var jayson=require('jayson/promise');var client=jayson['client'][_0x471e('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x27a186,_0x5948f0,_0x187929){return new BPromise(function(_0x51dc60,_0x2847c4){return client[_0x471e('0xa')](_0x27a186,_0x187929)[_0x471e('0xb')](function(_0x710142){logger[_0x471e('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x5948f0,_0x471e('0xd'));logger[_0x471e('0xe')](_0x471e('0xf'),_0x5948f0,_0x471e('0xd'),JSON[_0x471e('0x10')](_0x710142));if(_0x710142[_0x471e('0x11')]){if(_0x710142['error'][_0x471e('0x12')]===0x1f4){logger[_0x471e('0x11')]('VoiceChanSpy,\x20%s,\x20%s',_0x5948f0,_0x710142[_0x471e('0x11')][_0x471e('0x13')]);return _0x2847c4(_0x710142[_0x471e('0x11')][_0x471e('0x13')]);}logger[_0x471e('0x11')](_0x471e('0x14'),_0x5948f0,_0x710142[_0x471e('0x11')][_0x471e('0x13')]);return _0x51dc60(_0x710142[_0x471e('0x11')][_0x471e('0x13')]);}else{logger[_0x471e('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x5948f0,_0x471e('0xd'));_0x51dc60(_0x710142['result'][_0x471e('0x13')]);}})[_0x471e('0x15')](function(_0x220f3d){logger['error'](_0x471e('0x14'),_0x5948f0,_0x220f3d);_0x2847c4(_0x220f3d);});});}