06610c9d913ed7b996b7494d56d684889ec82d7f
[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 _0x69fb=['../../mysqldb','../../config/utils','../../config/logger','rpc','../../config/environment','jayson/promise','client','request','then','VoiceChanSpy,\x20%s,\x20%s','request\x20sent','VoiceChanSpy,\x20%s,\x20%s,\x20%s','stringify','error','code','message','info','catch','util','moment','bluebird','randomstring','ioredis'];(function(_0x5cd5c3,_0x473a63){var _0x1c39f3=function(_0x445be3){while(--_0x445be3){_0x5cd5c3['push'](_0x5cd5c3['shift']());}};_0x1c39f3(++_0x473a63);}(_0x69fb,0x6e));var _0xb69f=function(_0x1806d4,_0x47cc68){_0x1806d4=_0x1806d4-0x0;var _0x392c2c=_0x69fb[_0x1806d4];return _0x392c2c;};'use strict';var _=require('lodash');var util=require(_0xb69f('0x0'));var moment=require(_0xb69f('0x1'));var BPromise=require(_0xb69f('0x2'));var rs=require(_0xb69f('0x3'));var fs=require('fs');var Redis=require(_0xb69f('0x4'));var db=require(_0xb69f('0x5'))['db'];var utils=require(_0xb69f('0x6'));var logger=require(_0xb69f('0x7'))(_0xb69f('0x8'));var config=require(_0xb69f('0x9'));var jayson=require(_0xb69f('0xa'));var client=jayson[_0xb69f('0xb')]['http']({'port':0x232a});function respondWithRpcPromise(_0x221ef6,_0x24c4d8,_0x390f86){return new BPromise(function(_0x5dabc2,_0x5c8e75){return client[_0xb69f('0xc')](_0x221ef6,_0x390f86)[_0xb69f('0xd')](function(_0x1a27dc){logger['info'](_0xb69f('0xe'),_0x24c4d8,_0xb69f('0xf'));logger['debug'](_0xb69f('0x10'),_0x24c4d8,'request\x20sent',JSON[_0xb69f('0x11')](_0x1a27dc));if(_0x1a27dc[_0xb69f('0x12')]){if(_0x1a27dc[_0xb69f('0x12')][_0xb69f('0x13')]===0x1f4){logger[_0xb69f('0x12')](_0xb69f('0xe'),_0x24c4d8,_0x1a27dc[_0xb69f('0x12')][_0xb69f('0x14')]);return _0x5c8e75(_0x1a27dc[_0xb69f('0x12')]['message']);}logger[_0xb69f('0x12')](_0xb69f('0xe'),_0x24c4d8,_0x1a27dc[_0xb69f('0x12')][_0xb69f('0x14')]);return _0x5dabc2(_0x1a27dc['error'][_0xb69f('0x14')]);}else{logger[_0xb69f('0x15')](_0xb69f('0xe'),_0x24c4d8,'request\x20sent');_0x5dabc2(_0x1a27dc['result'][_0xb69f('0x14')]);}})[_0xb69f('0x16')](function(_0x57a788){logger[_0xb69f('0x12')]('VoiceChanSpy,\x20%s,\x20%s',_0x24c4d8,_0x57a788);_0x5c8e75(_0x57a788);});});}