f619057aa0c9e17a14aa7083d2b87507bef337cf
[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 _0x23bf=['error','code','message','info','catch','util','moment','bluebird','ioredis','../../mysqldb','../../config/logger','rpc','../../config/environment','jayson/promise','client','http','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify'];(function(_0x156a7b,_0x581641){var _0x2a8b96=function(_0x571881){while(--_0x571881){_0x156a7b['push'](_0x156a7b['shift']());}};_0x2a8b96(++_0x581641);}(_0x23bf,0x1a9));var _0xf23b=function(_0x2ed5dd,_0x11de93){_0x2ed5dd=_0x2ed5dd-0x0;var _0x4573ff=_0x23bf[_0x2ed5dd];return _0x4573ff;};'use strict';var _=require('lodash');var util=require(_0xf23b('0x0'));var moment=require(_0xf23b('0x1'));var BPromise=require(_0xf23b('0x2'));var rs=require('randomstring');var fs=require('fs');var Redis=require(_0xf23b('0x3'));var db=require(_0xf23b('0x4'))['db'];var utils=require('../../config/utils');var logger=require(_0xf23b('0x5'))(_0xf23b('0x6'));var config=require(_0xf23b('0x7'));var jayson=require(_0xf23b('0x8'));var client=jayson[_0xf23b('0x9')][_0xf23b('0xa')]({'port':0x232a});function respondWithRpcPromise(_0x27f8f3,_0x588a5c,_0x575650){return new BPromise(function(_0x411d81,_0x341949){return client['request'](_0x27f8f3,_0x575650)[_0xf23b('0xb')](function(_0x3dfa27){logger['info'](_0xf23b('0xc'),_0x588a5c,_0xf23b('0xd'));logger['debug'](_0xf23b('0xe'),_0x588a5c,'request\x20sent',JSON[_0xf23b('0xf')](_0x3dfa27));if(_0x3dfa27['error']){if(_0x3dfa27[_0xf23b('0x10')][_0xf23b('0x11')]===0x1f4){logger[_0xf23b('0x10')](_0xf23b('0xc'),_0x588a5c,_0x3dfa27['error'][_0xf23b('0x12')]);return _0x341949(_0x3dfa27[_0xf23b('0x10')][_0xf23b('0x12')]);}logger[_0xf23b('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x588a5c,_0x3dfa27['error'][_0xf23b('0x12')]);return _0x411d81(_0x3dfa27[_0xf23b('0x10')][_0xf23b('0x12')]);}else{logger[_0xf23b('0x13')]('VoiceChanSpy,\x20%s,\x20%s',_0x588a5c,_0xf23b('0xd'));_0x411d81(_0x3dfa27['result'][_0xf23b('0x12')]);}})[_0xf23b('0x14')](function(_0x4f7b97){logger[_0xf23b('0x10')]('VoiceChanSpy,\x20%s,\x20%s',_0x588a5c,_0x4f7b97);_0x341949(_0x4f7b97);});});}