40f10ad7a6af16ae43909a4ce831348df3f92972
[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 _0x1339=['info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','result','catch','moment','bluebird','randomstring','ioredis','../../mysqldb','../../config/utils','../../config/logger','rpc','jayson/promise','client','http','request','then'];(function(_0x222a98,_0x5e7b6e){var _0x130daa=function(_0x25085d){while(--_0x25085d){_0x222a98['push'](_0x222a98['shift']());}};_0x130daa(++_0x5e7b6e);}(_0x1339,0x1ed));var _0x9133=function(_0x1cb4d0,_0x10d829){_0x1cb4d0=_0x1cb4d0-0x0;var _0x3d2382=_0x1339[_0x1cb4d0];return _0x3d2382;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x9133('0x0'));var BPromise=require(_0x9133('0x1'));var rs=require(_0x9133('0x2'));var fs=require('fs');var Redis=require(_0x9133('0x3'));var db=require(_0x9133('0x4'))['db'];var utils=require(_0x9133('0x5'));var logger=require(_0x9133('0x6'))(_0x9133('0x7'));var config=require('../../config/environment');var jayson=require(_0x9133('0x8'));var client=jayson[_0x9133('0x9')][_0x9133('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x539af6,_0x2758e2,_0x334dcd){return new BPromise(function(_0x3059c4,_0x431a55){return client[_0x9133('0xb')](_0x539af6,_0x334dcd)[_0x9133('0xc')](function(_0x4294b7){logger[_0x9133('0xd')](_0x9133('0xe'),_0x2758e2,_0x9133('0xf'));logger['debug'](_0x9133('0x10'),_0x2758e2,_0x9133('0xf'),JSON[_0x9133('0x11')](_0x4294b7));if(_0x4294b7[_0x9133('0x12')]){if(_0x4294b7[_0x9133('0x12')][_0x9133('0x13')]===0x1f4){logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')]['message']);return _0x431a55(_0x4294b7['error'][_0x9133('0x14')]);}logger['error'](_0x9133('0xe'),_0x2758e2,_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);return _0x3059c4(_0x4294b7[_0x9133('0x12')][_0x9133('0x14')]);}else{logger[_0x9133('0xd')]('VoiceChanSpy,\x20%s,\x20%s',_0x2758e2,_0x9133('0xf'));_0x3059c4(_0x4294b7[_0x9133('0x15')]['message']);}})[_0x9133('0x16')](function(_0xa46eb1){logger[_0x9133('0x12')](_0x9133('0xe'),_0x2758e2,_0xa46eb1);_0x431a55(_0xa46eb1);});});}