Built motion from commit (unavailable).|2.4.15
[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 _0x3b47=['message','result','catch','util','moment','randomstring','ioredis','../../config/environment','jayson/promise','client','http','then','info','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','debug','stringify','error','code'];(function(_0x40cdbe,_0x496eb1){var _0x327565=function(_0x30f472){while(--_0x30f472){_0x40cdbe['push'](_0x40cdbe['shift']());}};_0x327565(++_0x496eb1);}(_0x3b47,0xd4));var _0x73b4=function(_0x11cd61,_0x1ac0b2){_0x11cd61=_0x11cd61-0x0;var _0x5df920=_0x3b47[_0x11cd61];return _0x5df920;};'use strict';var _=require('lodash');var util=require(_0x73b4('0x0'));var moment=require(_0x73b4('0x1'));var BPromise=require('bluebird');var rs=require(_0x73b4('0x2'));var fs=require('fs');var Redis=require(_0x73b4('0x3'));var db=require('../../mysqldb')['db'];var utils=require('../../config/utils');var logger=require('../../config/logger')('rpc');var config=require(_0x73b4('0x4'));var jayson=require(_0x73b4('0x5'));var client=jayson[_0x73b4('0x6')][_0x73b4('0x7')]({'port':0x232a});function respondWithRpcPromise(_0x1a443a,_0x3ebff8,_0x23560b){return new BPromise(function(_0x4e6c17,_0x7d513a){return client['request'](_0x1a443a,_0x23560b)[_0x73b4('0x8')](function(_0x58f351){logger[_0x73b4('0x9')](_0x73b4('0xa'),_0x3ebff8,_0x73b4('0xb'));logger[_0x73b4('0xc')]('VoiceChanSpy,\x20%s,\x20%s,\x20%s',_0x3ebff8,_0x73b4('0xb'),JSON[_0x73b4('0xd')](_0x58f351));if(_0x58f351[_0x73b4('0xe')]){if(_0x58f351['error'][_0x73b4('0xf')]===0x1f4){logger[_0x73b4('0xe')](_0x73b4('0xa'),_0x3ebff8,_0x58f351[_0x73b4('0xe')][_0x73b4('0x10')]);return _0x7d513a(_0x58f351['error'][_0x73b4('0x10')]);}logger[_0x73b4('0xe')]('VoiceChanSpy,\x20%s,\x20%s',_0x3ebff8,_0x58f351[_0x73b4('0xe')]['message']);return _0x4e6c17(_0x58f351[_0x73b4('0xe')][_0x73b4('0x10')]);}else{logger['info'](_0x73b4('0xa'),_0x3ebff8,'request\x20sent');_0x4e6c17(_0x58f351[_0x73b4('0x11')]['message']);}})[_0x73b4('0x12')](function(_0x2edf0b){logger['error'](_0x73b4('0xa'),_0x3ebff8,_0x2edf0b);_0x7d513a(_0x2edf0b);});});}