5a8e8cd52a93af08a3b16edf602e98ec3354a3d9
[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 _0xac0c=['debug','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','VoiceChanSpy,\x20%s,\x20%s','message','request\x20sent','result','catch','lodash','moment','bluebird','ioredis','../../config/utils','../../config/logger','rpc','../../config/environment','client','http','request','then','info'];(function(_0x39096d,_0x51f8a0){var _0x13da4f=function(_0x11e6b2){while(--_0x11e6b2){_0x39096d['push'](_0x39096d['shift']());}};_0x13da4f(++_0x51f8a0);}(_0xac0c,0xcf));var _0xcac0=function(_0x46cd89,_0x4a23e4){_0x46cd89=_0x46cd89-0x0;var _0xb080e8=_0xac0c[_0x46cd89];return _0xb080e8;};'use strict';var _=require(_0xcac0('0x0'));var util=require('util');var moment=require(_0xcac0('0x1'));var BPromise=require(_0xcac0('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xcac0('0x3'));var db=require('../../mysqldb')['db'];var utils=require(_0xcac0('0x4'));var logger=require(_0xcac0('0x5'))(_0xcac0('0x6'));var config=require(_0xcac0('0x7'));var jayson=require('jayson/promise');var client=jayson[_0xcac0('0x8')][_0xcac0('0x9')]({'port':0x232a});function respondWithRpcPromise(_0x19fabe,_0x59276a,_0x4181b5){return new BPromise(function(_0x357868,_0x4a80ba){return client[_0xcac0('0xa')](_0x19fabe,_0x4181b5)[_0xcac0('0xb')](function(_0x5038f3){logger[_0xcac0('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x59276a,'request\x20sent');logger[_0xcac0('0xd')](_0xcac0('0xe'),_0x59276a,'request\x20sent',JSON[_0xcac0('0xf')](_0x5038f3));if(_0x5038f3[_0xcac0('0x10')]){if(_0x5038f3['error']['code']===0x1f4){logger[_0xcac0('0x10')](_0xcac0('0x11'),_0x59276a,_0x5038f3[_0xcac0('0x10')][_0xcac0('0x12')]);return _0x4a80ba(_0x5038f3[_0xcac0('0x10')]['message']);}logger['error'](_0xcac0('0x11'),_0x59276a,_0x5038f3[_0xcac0('0x10')][_0xcac0('0x12')]);return _0x357868(_0x5038f3[_0xcac0('0x10')][_0xcac0('0x12')]);}else{logger[_0xcac0('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x59276a,_0xcac0('0x13'));_0x357868(_0x5038f3[_0xcac0('0x14')][_0xcac0('0x12')]);}})[_0xcac0('0x15')](function(_0x5befa1){logger[_0xcac0('0x10')](_0xcac0('0x11'),_0x59276a,_0x5befa1);_0x4a80ba(_0x5befa1);});});}