2015-05-11 15:40:07 -04:00
|
|
|
/****************************************************************
|
|
|
|
* RetroShare is distributed under the following license:
|
|
|
|
*
|
|
|
|
* Copyright (C) 2015
|
|
|
|
*
|
|
|
|
* This program is free software; you can redistribute it and/or
|
|
|
|
* modify it under the terms of the GNU General Public License
|
|
|
|
* as published by the Free Software Foundation; either version 2
|
|
|
|
* of the License, or (at your option) any later version.
|
|
|
|
*
|
|
|
|
* This program is distributed in the hope that it will be useful,
|
|
|
|
* but WITHOUT ANY WARRANTY; without even the implied warranty of
|
|
|
|
* MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
|
|
|
* GNU General Public License for more details.
|
|
|
|
*
|
|
|
|
* You should have received a copy of the GNU General Public License
|
|
|
|
* along with this program; if not, write to the Free Software
|
|
|
|
* Foundation, Inc., 51 Franklin Street, Fifth Floor,
|
|
|
|
* Boston, MA 02110-1301, USA.
|
|
|
|
****************************************************************/
|
|
|
|
|
|
|
|
// interface class for p3VOIP service
|
2012-02-18 10:56:37 -05:00
|
|
|
//
|
|
|
|
|
|
|
|
#pragma once
|
|
|
|
|
|
|
|
#include <stdint.h>
|
2012-02-28 16:59:01 -05:00
|
|
|
#include <string>
|
|
|
|
#include <list>
|
|
|
|
#include <vector>
|
2014-04-20 10:21:53 -04:00
|
|
|
#include <retroshare/rstypes.h>
|
2012-02-18 10:56:37 -05:00
|
|
|
|
2015-05-11 15:40:07 -04:00
|
|
|
class RsVOIP ;
|
|
|
|
extern RsVOIP *rsVOIP;
|
2012-02-19 10:07:47 -05:00
|
|
|
|
2012-02-26 12:13:54 -05:00
|
|
|
static const uint32_t CONFIG_TYPE_VOIP_PLUGIN = 0xe001 ;
|
2012-02-18 11:15:37 -05:00
|
|
|
|
2015-05-11 15:40:07 -04:00
|
|
|
class RsVOIPPongResult
|
2012-02-19 10:07:47 -05:00
|
|
|
{
|
|
|
|
public:
|
2015-05-11 15:40:07 -04:00
|
|
|
RsVOIPPongResult()
|
2012-02-19 10:07:47 -05:00
|
|
|
:mTS(0), mRTT(0), mOffset(0) { return; }
|
|
|
|
|
2015-05-11 15:40:07 -04:00
|
|
|
RsVOIPPongResult(double ts, double rtt, double offset)
|
2012-02-19 10:07:47 -05:00
|
|
|
:mTS(ts), mRTT(rtt), mOffset(offset) { return; }
|
|
|
|
|
|
|
|
double mTS;
|
|
|
|
double mRTT;
|
|
|
|
double mOffset;
|
|
|
|
};
|
|
|
|
|
2015-05-11 15:40:07 -04:00
|
|
|
struct RsVOIPDataChunk
|
2012-02-25 07:18:40 -05:00
|
|
|
{
|
2015-05-11 15:40:07 -04:00
|
|
|
typedef enum { RS_VOIP_DATA_TYPE_AUDIO, RS_VOIP_DATA_TYPE_VIDEO } RsVOIPDataType ;
|
2014-07-15 16:04:31 -04:00
|
|
|
|
2012-02-25 07:18:40 -05:00
|
|
|
void *data ; // create/delete using malloc/free.
|
|
|
|
uint32_t size ;
|
2015-05-11 15:40:07 -04:00
|
|
|
RsVOIPDataType type ; // video or audio
|
2015-08-07 21:40:48 -04:00
|
|
|
|
|
|
|
void clear() ;
|
2012-02-25 07:18:40 -05:00
|
|
|
};
|
|
|
|
|
2015-05-11 15:40:07 -04:00
|
|
|
class RsVOIP
|
2012-02-18 10:56:37 -05:00
|
|
|
{
|
|
|
|
public:
|
2014-07-15 16:04:31 -04:00
|
|
|
virtual int sendVoipHangUpCall(const RsPeerId& peer_id) = 0;
|
|
|
|
virtual int sendVoipRinging(const RsPeerId& peer_id) = 0;
|
|
|
|
virtual int sendVoipAcceptCall(const RsPeerId& peer_id) = 0;
|
2012-02-18 10:56:37 -05:00
|
|
|
|
2012-02-25 07:18:40 -05:00
|
|
|
// Sending data. The client keeps the memory ownership and must delete it after calling this.
|
2015-05-11 15:40:07 -04:00
|
|
|
virtual int sendVoipData(const RsPeerId& peer_id,const RsVOIPDataChunk& chunk) = 0;
|
2012-02-25 07:18:40 -05:00
|
|
|
|
|
|
|
// The server fill in the data and gives up memory ownership. The client must delete the memory
|
|
|
|
// in each chunk once it has been used.
|
|
|
|
//
|
2015-05-11 15:40:07 -04:00
|
|
|
virtual bool getIncomingData(const RsPeerId& peer_id,std::vector<RsVOIPDataChunk>& chunks) = 0;
|
2012-02-25 07:18:40 -05:00
|
|
|
|
2012-02-18 10:56:37 -05:00
|
|
|
typedef enum { AudioTransmitContinous = 0, AudioTransmitVAD = 1, AudioTransmitPushToTalk = 2 } enumAudioTransmit ;
|
|
|
|
|
|
|
|
// Config stuff
|
|
|
|
|
|
|
|
virtual int getVoipATransmit() const = 0 ;
|
2012-02-18 15:30:10 -05:00
|
|
|
virtual void setVoipATransmit(int) = 0 ;
|
2012-02-18 10:56:37 -05:00
|
|
|
virtual int getVoipVoiceHold() const = 0 ;
|
2012-02-18 15:30:10 -05:00
|
|
|
virtual void setVoipVoiceHold(int) = 0 ;
|
2012-02-18 10:56:37 -05:00
|
|
|
virtual int getVoipfVADmin() const = 0 ;
|
2012-02-18 15:30:10 -05:00
|
|
|
virtual void setVoipfVADmin(int) = 0 ;
|
2012-02-18 10:56:37 -05:00
|
|
|
virtual int getVoipfVADmax() const = 0 ;
|
2012-02-18 15:30:10 -05:00
|
|
|
virtual void setVoipfVADmax(int) = 0 ;
|
2012-02-18 10:56:37 -05:00
|
|
|
virtual int getVoipiNoiseSuppress() const = 0 ;
|
2012-02-18 15:30:10 -05:00
|
|
|
virtual void setVoipiNoiseSuppress(int) = 0 ;
|
2012-02-18 10:56:37 -05:00
|
|
|
virtual int getVoipiMinLoudness() const = 0 ;
|
2012-02-18 15:30:10 -05:00
|
|
|
virtual void setVoipiMinLoudness(int) = 0 ;
|
2012-02-18 10:56:37 -05:00
|
|
|
virtual bool getVoipEchoCancel() const = 0 ;
|
2012-02-18 15:30:10 -05:00
|
|
|
virtual void setVoipEchoCancel(bool) = 0 ;
|
2012-02-19 10:07:47 -05:00
|
|
|
|
2015-05-11 15:40:07 -04:00
|
|
|
virtual uint32_t getPongResults(const RsPeerId& id, int n, std::list<RsVOIPPongResult> &results) = 0;
|
2012-02-18 10:56:37 -05:00
|
|
|
};
|
2012-02-19 10:07:47 -05:00
|
|
|
|
|
|
|
|