Built motion from commit (unavailable).|2.5.24
[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 _0x2201=['client','request','then','request\x20sent','debug','stringify','error','code','VoiceChanSpy,\x20%s,\x20%s','message','info','result','moment','bluebird','ioredis','../../mysqldb','../../config/utils','../../config/environment'];(function(_0x37e175,_0x5c4336){var _0x12b71e=function(_0x2ff2d1){while(--_0x2ff2d1){_0x37e175['push'](_0x37e175['shift']());}};_0x12b71e(++_0x5c4336);}(_0x2201,0xd2));var _0x1220=function(_0x5e9ddf,_0x2ca929){_0x5e9ddf=_0x5e9ddf-0x0;var _0x4d7f63=_0x2201[_0x5e9ddf];return _0x4d7f63;};'use strict';var _=require('lodash');var util=require('util');var moment=require(_0x1220('0x0'));var BPromise=require(_0x1220('0x1'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0x1220('0x2'));var db=require(_0x1220('0x3'))['db'];var utils=require(_0x1220('0x4'));var logger=require('../../config/logger')('rpc');var config=require(_0x1220('0x5'));var jayson=require('jayson/promise');var client=jayson[_0x1220('0x6')]['http']({'port':0x232a});function respondWithRpcPromise(_0x38816e,_0x41c46a,_0x3ef6f3){return new BPromise(function(_0x5b1718,_0x2da7d4){return client[_0x1220('0x7')](_0x38816e,_0x3ef6f3)[_0x1220('0x8')](function(_0x1d2696){logger['info']('VoiceChanSpy,\x20%s,\x20%s',_0x41c46a,_0x1220('0x9'));logger[_0x1220('0xa')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x41c46a,_0x1220('0x9'),JSON[_0x1220('0xb')](_0x1d2696));if(_0x1d2696[_0x1220('0xc')]){if(_0x1d2696[_0x1220('0xc')][_0x1220('0xd')]===0x1f4){logger['error'](_0x1220('0xe'),_0x41c46a,_0x1d2696[_0x1220('0xc')]['message']);return _0x2da7d4(_0x1d2696[_0x1220('0xc')][_0x1220('0xf')]);}logger[_0x1220('0xc')](_0x1220('0xe'),_0x41c46a,_0x1d2696[_0x1220('0xc')]['message']);return _0x5b1718(_0x1d2696[_0x1220('0xc')][_0x1220('0xf')]);}else{logger[_0x1220('0x10')](_0x1220('0xe'),_0x41c46a,_0x1220('0x9'));_0x5b1718(_0x1d2696[_0x1220('0x11')][_0x1220('0xf')]);}})['catch'](function(_0x3ffbe8){logger[_0x1220('0xc')]('VoiceChanSpy,\x20%s,\x20%s',_0x41c46a,_0x3ffbe8);_0x2da7d4(_0x3ffbe8);});});}