Merge branch 'dev_conference_rfc4579'

This commit is contained in:
François Grisez 2016-01-14 15:04:35 +01:00
commit 454e9834ae
13 changed files with 393 additions and 106 deletions

View file

@ -216,6 +216,7 @@ endif()
set(STRICT_OPTIONS_CPP )
set(STRICT_OPTIONS_C )
set(STRICT_OPTIONS_CXX "-std=c++11")
set(STRICT_OPTIONS_OBJC )
if(NOT MSVC)
list(APPEND STRICT_OPTIONS_CPP "-Wall" "-Wuninitialized" "-Wno-error=deprecated-declarations")

View file

@ -24,7 +24,7 @@
*/
#include "private.h"
#include "conference.h"
#include "conference_private.h"
#include <mediastreamer2/msvolume.h>
#include <typeinfo>
#include <list>
@ -49,9 +49,21 @@ private:
class Conference {
public:
Conference(LinphoneCore *core);
class Params {
public:
Params(const LinphoneCore *core = NULL);
void enableVideo(bool enable) {m_enableVideo = enable;}
bool videoRequested() const {return m_enableVideo;}
private:
bool m_enableVideo;
};
Conference(LinphoneCore *core, const Params *params = NULL);
virtual ~Conference() {};
const Params &getCurrentParams() const {return m_currentParams;}
virtual int addParticipant(LinphoneCall *call) = 0;
virtual int removeParticipant(LinphoneCall *call) = 0;
virtual int removeParticipant(const LinphoneAddress *uri) = 0;
@ -83,11 +95,12 @@ protected:
AudioStream *m_localParticipantStream;
bool m_isMuted;
std::list<Participant> m_participants;
Params m_currentParams;
};
class LocalConference: public Conference {
public:
LocalConference(LinphoneCore *core);
LocalConference(LinphoneCore *core, const Params *params = NULL);
virtual ~LocalConference();
virtual int addParticipant(LinphoneCall *call);
@ -103,9 +116,9 @@ public:
virtual int startRecording(const char *path);
virtual int stopRecording();
void onCallStreamStarting(LinphoneCall *call, bool isPausedByRemote);
void onCallStreamStopping(LinphoneCall *call);
void onCallTerminating(LinphoneCall *call);
virtual void onCallStreamStarting(LinphoneCall *call, bool isPausedByRemote);
virtual void onCallStreamStopping(LinphoneCall *call);
virtual void onCallTerminating(LinphoneCall *call);
private:
void addLocalEndpoint();
@ -124,7 +137,7 @@ private:
class RemoteConference: public Conference {
public:
RemoteConference(LinphoneCore *core);
RemoteConference(LinphoneCore *core, const Params *params = NULL);
virtual ~RemoteConference();
virtual int addParticipant(LinphoneCall *call);
@ -190,10 +203,20 @@ bool Participant::operator==(const Participant &src) const {
Conference::Conference(LinphoneCore *core) :
Conference::Params::Params(const LinphoneCore *core): m_enableVideo(false) {
if(core) {
const LinphoneVideoPolicy *policy = linphone_core_get_video_policy(core);
if(policy->automatically_initiate) m_enableVideo = true;
}
}
Conference::Conference(LinphoneCore *core, const Conference::Params *params):
m_core(core),
m_localParticipantStream(NULL),
m_isMuted(false) {
if(params) m_currentParams = *params;
}
int Conference::addParticipant(LinphoneCall *call) {
@ -255,15 +278,16 @@ Participant *Conference::find_participant(const LinphoneAddress *uri) {
LocalConference::LocalConference(LinphoneCore *core): Conference(core),
LocalConference::LocalConference(LinphoneCore *core, const Conference::Params *params):
Conference(core, params),
m_conf(NULL),
m_localEndpoint(NULL),
m_recordEndpoint(NULL),
m_localDummyProfile(NULL),
m_terminated(FALSE) {
MSAudioConferenceParams params;
params.samplerate = lp_config_get_int(m_core->config, "sound","conference_rate",16000);
m_conf=ms_audio_conference_new(&params);
MSAudioConferenceParams ms_conf_params;
ms_conf_params.samplerate = lp_config_get_int(m_core->config, "sound","conference_rate",16000);
m_conf=ms_audio_conference_new(&ms_conf_params);
}
LocalConference::~LocalConference() {
@ -548,8 +572,8 @@ void LocalConference::onCallTerminating(LinphoneCall *call) {
RemoteConference::RemoteConference(LinphoneCore *core):
Conference(core),
RemoteConference::RemoteConference(LinphoneCore *core, const Conference::Params *params):
Conference(core, params),
m_focusAddr(NULL),
m_focusContact(NULL),
m_focusCall(NULL),
@ -573,6 +597,7 @@ RemoteConference::~RemoteConference() {
int RemoteConference::addParticipant(LinphoneCall *call) {
LinphoneAddress *addr;
LinphoneCallParams *params;
switch(m_state) {
case NotConnectedToFocus:
@ -580,12 +605,15 @@ int RemoteConference::addParticipant(LinphoneCall *call) {
ms_message("Calling the conference focus (%s)", m_focusAddr);
addr = linphone_address_new(m_focusAddr);
if(addr) {
m_focusCall = linphone_call_ref(linphone_core_invite_address(m_core, addr));
params = linphone_core_create_call_params(m_core, NULL);
linphone_call_params_enable_video(params, m_currentParams.videoRequested());
m_focusCall = linphone_call_ref(linphone_core_invite_address_with_params(m_core, addr, params));
m_localParticipantStream = m_focusCall->audiostream;
m_pendingCalls = ms_list_append(m_pendingCalls, linphone_call_ref(call));
m_state = ConnectingToFocus;
linphone_address_unref(addr);
call->conf_ref = (LinphoneConference *)this;
linphone_call_params_unref(params);
return 0;
} else return -1;
@ -784,14 +812,44 @@ void RemoteConference::transferStateChanged(LinphoneCore *lc, LinphoneCall *tran
LinphoneConferenceParams *linphone_conference_params_new(const LinphoneCore *core) {
return (LinphoneConferenceParams *)new Conference::Params(core);
}
void linphone_conference_params_free(LinphoneConferenceParams *params) {
delete (Conference::Params *)params;
}
LinphoneConferenceParams *linphone_conference_params_clone(const LinphoneConferenceParams *params) {
return (LinphoneConferenceParams *)new Conference::Params(*(Conference::Params *)params);
}
void linphone_conference_params_enable_video(LinphoneConferenceParams *params, bool_t enable) {
((Conference::Params *)params)->enableVideo(enable);
}
bool_t linphone_conference_params_video_requested(const LinphoneConferenceParams *params) {
return ((Conference::Params *)params)->videoRequested();
}
LinphoneConference *linphone_local_conference_new(LinphoneCore *core) {
return (LinphoneConference *) new LocalConference(core);
}
LinphoneConference *linphone_local_conference_new_with_params(LinphoneCore *core, const LinphoneConferenceParams *params) {
return (LinphoneConference *) new LocalConference(core, (Conference::Params *)params);
}
LinphoneConference *linphone_remote_conference_new(LinphoneCore *core) {
return (LinphoneConference *) new RemoteConference(core);
}
LinphoneConference *linphone_remote_conference_new_with_params(LinphoneCore *core, const LinphoneConferenceParams *params) {
return (LinphoneConference *) new RemoteConference(core, (Conference::Params *)params);
}
void linphone_conference_free(LinphoneConference *obj) {
delete (Conference *)obj;
}

View file

@ -1,5 +1,5 @@
/*******************************************************************************
* conference.cc
* conference.h
*
* Thu Nov 26, 2015
* Copyright 2015 Belledonne Communications
@ -25,49 +25,67 @@
#ifndef CONFERENCE_H
#define CONFERENCE_H
#include "linphonecore.h"
#ifdef __cplusplus
extern "C" {
#endif
#include "linphonecore.h"
//typedef struct _LinphoneConference LinphoneConference;
/**
* @addtogroup call_control
* @{
*/
typedef enum {
LinphoneConferenceClassLocal,
LinphoneConferenceClassRemote
} LinphoneConferenceClass;
/**
* Create a #LinphoneConferenceParams with default parameters set.
* @param core #LinphoneCore to use to find out the default parameters. Can be NULL.
* @return A freshly allocated #LinphoneConferenceParams
*/
LINPHONE_PUBLIC LinphoneConferenceParams *linphone_conference_params_new(const LinphoneCore *core);
/**
* Free a #LinphoneConferenceParams
* @param params #LinphoneConferenceParams to free
*/
LINPHONE_PUBLIC void linphone_conference_params_free(LinphoneConferenceParams *params);
/**
* Clone a #LinphoneConferenceParams
* @param params The #LinphoneConfrenceParams to clone
* @return An allocated #LinphoneConferenceParams with the same parameters than params
*/
LINPHONE_PUBLIC LinphoneConferenceParams *linphone_conference_params_clone(const LinphoneConferenceParams *params);
/**
* Enable video when starting a conference
* @param params A #LinphoneConnferenceParams
* @param enable If true, video will be enabled during conference
*/
LINPHONE_PUBLIC void linphone_conference_params_enable_video(LinphoneConferenceParams *params, bool_t enable);
/**
* Check whether video will be enable at conference starting
* @return if true, the video will be enable at conference starting
*/
LINPHONE_PUBLIC bool_t linphone_conference_params_video_requested(const LinphoneConferenceParams *params);
LinphoneConference *linphone_local_conference_new(LinphoneCore *core);
LinphoneConference *linphone_remote_conference_new(LinphoneCore *core);
void linphone_conference_free(LinphoneConference *obj);
int linphone_conference_add_participant(LinphoneConference *obj, LinphoneCall *call);
int linphone_conference_remove_participant_with_call(LinphoneConference *obj, LinphoneCall *call);
/**
* Remove a participant from a conference
* @param obj A #LinphoneConference
* @param uri SIP URI of the participant to remove
* @return 0 if succeeded, -1 if failed
*/
LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *obj, const LinphoneAddress *uri);
int linphone_conference_terminate(LinphoneConference *obj);
int linphone_conference_enter(LinphoneConference *obj);
int linphone_conference_leave(LinphoneConference *obj);
LINPHONE_PUBLIC bool_t linphone_conference_is_in(const LinphoneConference *obj);
AudioStream *linphone_conference_get_audio_stream(const LinphoneConference *obj);
int linphone_conference_mute_microphone(LinphoneConference *obj, bool_t val);
bool_t linphone_conference_microphone_is_muted(const LinphoneConference *obj);
float linphone_conference_get_input_volume(const LinphoneConference *obj);
LINPHONE_PUBLIC int linphone_conference_get_size(const LinphoneConference *obj);
/**
* Get URIs of all participants of one conference
* The returned MSList contains URIs of all participant. That list must be
* freed after use and each URI must be unref with linphone_address_unref()
* @param obj A #LinphoneConference
* @return \mslist{LinphoneAddress}
*/
LINPHONE_PUBLIC MSList *linphone_conference_get_participants(const LinphoneConference *obj);
int linphone_conference_start_recording(LinphoneConference *obj, const char *path);
int linphone_conference_stop_recording(LinphoneConference *obj);
void linphone_conference_on_call_stream_starting(LinphoneConference *obj, LinphoneCall *call, bool_t is_paused_by_remote);
void linphone_conference_on_call_stream_stopping(LinphoneConference *obj, LinphoneCall *call);
void linphone_conference_on_call_terminating(LinphoneConference *obj, LinphoneCall *call);
bool_t linphone_conference_check_class(LinphoneConference *obj, LinphoneConferenceClass _class);
/**
* @}
*/
#ifdef __cplusplus
}

View file

@ -0,0 +1,74 @@
/*******************************************************************************
* conference_private.h
*
* Tue Jan 12, 2015
* Copyright 2015 Belledonne Communications
* Author: Linphone's team
* Email info@belledonne-communications.com
******************************************************************************/
/*
* 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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
#ifndef CONFERENCE_PRIVATE_H
#define CONFERENCE_PRIVATE_H
#include "linphonecore.h"
#include "conference.h"
#ifdef __cplusplus
extern "C" {
#endif
typedef enum {
LinphoneConferenceClassLocal,
LinphoneConferenceClassRemote
} LinphoneConferenceClass;
LinphoneConference *linphone_local_conference_new(LinphoneCore *core);
LinphoneConference *linphone_local_conference_new_with_params(LinphoneCore *core, const LinphoneConferenceParams *params);
LinphoneConference *linphone_remote_conference_new(LinphoneCore *core);
LinphoneConference *linphone_remote_conference_new_with_params(LinphoneCore *core, const LinphoneConferenceParams *params);
void linphone_conference_free(LinphoneConference *obj);
int linphone_conference_add_participant(LinphoneConference *obj, LinphoneCall *call);
int linphone_conference_remove_participant_with_call(LinphoneConference *obj, LinphoneCall *call);
int linphone_conference_terminate(LinphoneConference *obj);
int linphone_conference_get_size(const LinphoneConference *obj);
int linphone_conference_enter(LinphoneConference *obj);
int linphone_conference_leave(LinphoneConference *obj);
bool_t linphone_conference_is_in(const LinphoneConference *obj);
AudioStream *linphone_conference_get_audio_stream(const LinphoneConference *obj);
int linphone_conference_mute_microphone(LinphoneConference *obj, bool_t val);
bool_t linphone_conference_microphone_is_muted(const LinphoneConference *obj);
float linphone_conference_get_input_volume(const LinphoneConference *obj);
int linphone_conference_start_recording(LinphoneConference *obj, const char *path);
int linphone_conference_stop_recording(LinphoneConference *obj);
void linphone_conference_on_call_stream_starting(LinphoneConference *obj, LinphoneCall *call, bool_t is_paused_by_remote);
void linphone_conference_on_call_stream_stopping(LinphoneConference *obj, LinphoneCall *call);
void linphone_conference_on_call_terminating(LinphoneConference *obj, LinphoneCall *call);
LINPHONE_PUBLIC bool_t linphone_conference_check_class(LinphoneConference *obj, LinphoneConferenceClass _class);
#ifdef __cplusplus
}
#endif
#endif //CONFERENCE_PRIVATE_H

View file

@ -25,6 +25,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "sipsetup.h"
#include "lpconfig.h"
#include "private.h"
#include "conference_private.h"
#include <ortp/event.h>
#include <ortp/b64.h>
#include <math.h>

View file

@ -24,6 +24,7 @@ Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
#include "private.h"
#include "quality_reporting.h"
#include "lime.h"
#include "conference_private.h"
#include <math.h>
#include <sys/types.h>
@ -5350,7 +5351,7 @@ void linphone_core_set_video_policy(LinphoneCore *lc, const LinphoneVideoPolicy
* See linphone_core_set_video_policy() for more details.
* @ingroup media_parameters
**/
const LinphoneVideoPolicy *linphone_core_get_video_policy(LinphoneCore *lc){
const LinphoneVideoPolicy *linphone_core_get_video_policy(const LinphoneCore *lc){
return &lc->video_policy;
}
@ -7433,20 +7434,30 @@ LinphoneRingtonePlayer *linphone_core_get_ringtoneplayer(LinphoneCore *lc) {
return lc->ringtoneplayer;
}
int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call) {
LinphoneConference *linphone_core_create_conference_with_params(LinphoneCore *lc, const LinphoneConferenceParams *params) {
const char *conf_method_name;
if(lc->conf_ctx == NULL) {
conf_method_name = lp_config_get_string(lc->config, "misc", "conference_type", "local");
if(strcasecmp(conf_method_name, "local") == 0) {
lc->conf_ctx = linphone_local_conference_new(lc);
lc->conf_ctx = linphone_local_conference_new_with_params(lc, params);
} else if(strcasecmp(conf_method_name, "remote") == 0) {
lc->conf_ctx = linphone_remote_conference_new(lc);
lc->conf_ctx = linphone_remote_conference_new_with_params(lc, params);
} else {
ms_error("'%s' is not a valid conference method", conf_method_name);
return -1;
return NULL;
}
} else {
ms_error("Could not create a conference: a conference instance already exists");
return NULL;
}
return linphone_conference_add_participant(lc->conf_ctx, call);
return lc->conf_ctx;
}
int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call) {
LinphoneConference *conference = linphone_core_get_conference(lc);
if(conference == NULL) conference = linphone_core_create_conference_with_params(lc, NULL);
if(conference) return linphone_conference_add_participant(lc->conf_ctx, call);
else return -1;
}
int linphone_core_add_all_to_conference(LinphoneCore *lc) {

View file

@ -66,6 +66,18 @@ struct _LinphoneInfoMessage;
*/
typedef struct _LinphoneCore LinphoneCore;
/**
* Internal object of LinphoneCore representing a conference
* @ingroup call_control
*/
typedef struct _LinphoneConference LinphoneConference;
/**
* Parameters for initialization of conferences
* @ingroup call_control
*/
typedef struct _LinphoneCorferenceParams LinphoneConferenceParams;
/**
* Disable a sip transport
@ -140,12 +152,6 @@ enum _LinphoneStreamType {
**/
typedef enum _LinphoneStreamType LinphoneStreamType;
/**
* Internal object of LinphoneCore representing a conference
* @ingroup call_control
*/
typedef struct _LinphoneConference LinphoneConference;
/**
* Function returning a human readable value for LinphoneStreamType.
* @ingroup initializing
@ -3443,7 +3449,7 @@ LINPHONE_PUBLIC bool_t linphone_core_video_capture_enabled(LinphoneCore *lc);
LINPHONE_PUBLIC bool_t linphone_core_video_display_enabled(LinphoneCore *lc);
LINPHONE_PUBLIC void linphone_core_set_video_policy(LinphoneCore *lc, const LinphoneVideoPolicy *policy);
LINPHONE_PUBLIC const LinphoneVideoPolicy *linphone_core_get_video_policy(LinphoneCore *lc);
LINPHONE_PUBLIC const LinphoneVideoPolicy *linphone_core_get_video_policy(const LinphoneCore *lc);
typedef struct MSVideoSizeDef{
MSVideoSize vsize;
@ -3828,6 +3834,14 @@ LINPHONE_PUBLIC LinphoneCall* linphone_core_find_call_from_uri(const LinphoneCor
* @{
*/
/**
* Create a conference
* @param lc The #LinphoneCore instance where the conference will be created inside.
* @param params Parameters of the conference. See #LinphoneConferenceParms.
* @return A pointer on the freshly created conference. That object will be automatically
* freed by the core after calling linphone_core_terminate_conference().
*/
LINPHONE_PUBLIC LinphoneConference *linphone_core_create_conference_with_params(LinphoneCore *lc, const LinphoneConferenceParams *params);
/**
* Add a participant to the conference. If no conference is going on
* a new internal conference context is created and the participant is
@ -3836,7 +3850,7 @@ LINPHONE_PUBLIC LinphoneCall* linphone_core_find_call_from_uri(const LinphoneCor
* @param call The current call with the participant to add
* @return 0 if succeeded. Negative number if failed
*/
LINPHONE_PUBLIC int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call);
LINPHONE_PUBLIC int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCall *call);
/**
* Add all current calls into the conference. If no conference is running
* a new internal conference context is created and all current calls
@ -3844,7 +3858,7 @@ LINPHONE_PUBLIC int linphone_core_add_to_conference(LinphoneCore *lc, LinphoneCa
* @param lc #LinphoneCore
* @return 0 if succeeded. Negative number if failed
*/
LINPHONE_PUBLIC int linphone_core_add_all_to_conference(LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_add_all_to_conference(LinphoneCore *lc);
/**
* Remove a call from the conference.
* @param lc the linphone core
@ -3860,7 +3874,7 @@ LINPHONE_PUBLIC int linphone_core_add_all_to_conference(LinphoneCore *lc);
*
* @return 0 if successful, -1 otherwise.
**/
LINPHONE_PUBLIC int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call);
LINPHONE_PUBLIC int linphone_core_remove_from_conference(LinphoneCore *lc, LinphoneCall *call);
/**
* Indicates whether the local participant is part of a conference.
* @warning That function automatically fails in the case of conferences using a
@ -3869,25 +3883,25 @@ LINPHONE_PUBLIC int linphone_core_add_all_to_conference(LinphoneCore *lc);
* @param lc the linphone core
* @return TRUE if the local participant is in a conference, FALSE otherwise.
*/
LINPHONE_PUBLIC bool_t linphone_core_is_in_conference(const LinphoneCore *lc);
LINPHONE_PUBLIC bool_t linphone_core_is_in_conference(const LinphoneCore *lc);
/**
* Join the local participant to the running conference
* @param lc #LinphoneCore
* @return 0 if succeeded. Negative number if failed
*/
LINPHONE_PUBLIC int linphone_core_enter_conference(LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_enter_conference(LinphoneCore *lc);
/**
* Make the local participant leave the running conference
* @param lc #LinphoneCore
* @return 0 if succeeded. Negative number if failed
*/
LINPHONE_PUBLIC int linphone_core_leave_conference(LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_leave_conference(LinphoneCore *lc);
/**
* Get the set input volume of the local participant
* @param lc #LinphoneCore
* @return A value inside [0.0 ; 1.0]
*/
LINPHONE_PUBLIC float linphone_core_get_conference_local_input_volume(LinphoneCore *lc);
LINPHONE_PUBLIC float linphone_core_get_conference_local_input_volume(LinphoneCore *lc);
/**
* Terminate the running conference. If it is a local conference, all calls
* inside it will become back separate calls and will be put in #LinphoneCallPaused state.
@ -3896,14 +3910,14 @@ LINPHONE_PUBLIC float linphone_core_get_conference_local_input_volume(LinphoneCo
* @param lc #LinphoneCore
* @return 0 if succeeded. Negative number if failed
*/
LINPHONE_PUBLIC int linphone_core_terminate_conference(LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_terminate_conference(LinphoneCore *lc);
/**
* Get the number of participant in the running conference. The local
* participant is included in the count only if it is in the conference.
* @param lc #LinphoneCore
* @return The number of participant
*/
LINPHONE_PUBLIC int linphone_core_get_conference_size(LinphoneCore *lc);
LINPHONE_PUBLIC int linphone_core_get_conference_size(LinphoneCore *lc);
/**
* Start recording the running conference
* @param lc #LinphoneCore
@ -3923,21 +3937,7 @@ LINPHONE_PUBLIC int linphone_core_stop_conference_recording(LinphoneCore *lc);
* @return A pointer on #LinphoneConference or NULL if no conference are going on
*/
LINPHONE_PUBLIC LinphoneConference *linphone_core_get_conference(LinphoneCore *lc);
/**
* Get URIs of all participants of one conference
* The returned MSList contains URIs of all participant. That list must be
* freed after use and each URI must be unref with linphone_address_unref()
* @param obj A #LinphoneConference
* @return \mslist{LinphoneAddress}
*/
LINPHONE_PUBLIC MSList *linphone_conference_get_participants(const LinphoneConference *obj);
/**
* Remove a participant from a conference
* @param obj A #LinphoneConference
* @param uri SIP URI of the participant to remove
* @return 0 if succeeded, -1 if failed
*/
LINPHONE_PUBLIC int linphone_conference_remove_participant(LinphoneConference *obj, const LinphoneAddress *uri);
/**
* @}

View file

@ -4315,6 +4315,21 @@ extern "C" jint Java_org_linphone_core_LinphoneCoreImpl_getConferenceSize(JNIEnv
return (jint)linphone_core_get_conference_size((LinphoneCore *) pCore);
}
extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_createConference(JNIEnv *env, jobject thiz, jlong corePtr, jobject jparams) {
jclass params_class = env->FindClass("org/linphone/core/LinphoneConferenceParamsImpl");
jclass conference_class = env->FindClass("org/linphone/core/LinphoneConferenceImpl");
jfieldID params_native_ptr_attr = env->GetFieldID(params_class, "nativePtr", "J");
jmethodID conference_constructor = env->GetMethodID(conference_class, "<init>", "(J)V");
LinphoneConferenceParams *params = NULL;
LinphoneConference *conference;
jobject jconference;
if(jparams) params = (LinphoneConferenceParams *)env->GetLongField(params_class, params_native_ptr_attr);
conference = linphone_core_create_conference_with_params((LinphoneCore *)corePtr, params);
if(conference) return env->NewObject(conference_class, conference_constructor, (jlong)conference);
else return NULL;
}
extern "C" jobject Java_org_linphone_core_LinphoneCoreImpl_getConference(JNIEnv *env, jobject thiz, jlong pCore) {
jclass conference_class = env->FindClass("org/linphone/core/LinphoneConferenceImpl");
jmethodID conference_constructor = env->GetMethodID(conference_class, "<init>", "(J)V");
@ -6746,6 +6761,32 @@ JNIEXPORT jint JNICALL Java_org_linphone_core_LinphoneCoreImpl_getNortpTimeout(J
extern "C" jlong Java_org_linphone_core_LinphoneConferenceParamsImpl_createInstance(JNIEnv *env, jobject thiz, jobject jcore) {
jclass core_class = env->FindClass("org/linphone/core/LinphoneCoreImpl");
jfieldID native_ptr_attr = env->GetFieldID(core_class, "nativePtr", "J");
LinphoneCore *core = NULL;
if(jcore) core = (LinphoneCore *)env->GetLongField(jcore, native_ptr_attr);
return (jlong)linphone_conference_params_new(core);
}
extern "C" jlong Java_org_linphone_core_LinphoneConferenceParamsImpl_copyInstance(JNIEnv *env, jobject thiz, jlong paramsPtr) {
return (jlong)linphone_conference_params_clone((LinphoneConferenceParams *)paramsPtr);
}
extern "C" void Java_org_linphone_core_LinphoneConferenceParamsImpl_destroyInstance(JNIEnv *env, jobject thiz, jlong paramsPtr) {
linphone_conference_params_free((LinphoneConferenceParams *)paramsPtr);
}
extern "C" void Java_org_linphone_core_LinphoneConferenceParamsImpl_enableVideo(JNIEnv *env, jobject thiz, jlong paramsPtr, jboolean enable) {
linphone_conference_params_enable_video((LinphoneConferenceParams *)paramsPtr, enable);
}
extern "C" jboolean Java_org_linphone_core_LinphoneConferenceParamsImpl_isVideoEnabled(JNIEnv *env, jobject thiz, jlong paramsPtr) {
return linphone_conference_params_video_requested((LinphoneConferenceParams *)paramsPtr);
}
extern "C" jobjectArray Java_org_linphone_core_LinphoneConferenceImpl_getParticipants(JNIEnv *env, jobject thiz, jlong pconference) {
MSList *participants, *it;
jclass addr_class = env->FindClass("org/linphone/core/LinphoneAddressImpl");

View file

@ -0,0 +1,25 @@
/*
LinphoneConferenceParams.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
public interface LinphoneConferenceParams {
public void enableVideo(boolean enable);
public boolean isVideoRequested();
}

View file

@ -1348,6 +1348,19 @@ public interface LinphoneCore {
void setZrtpSecretsCache(String file);
void enableEchoLimiter(boolean val);
/**
* Create a conference
* @param params Parameters of the conference. Can be null
* @return The new conference or null if the creation has failed
*/
LinphoneConference createConference(LinphoneConferenceParams params);
/**
* Return the value of the C pointer on the conference instance.
*
* That function can be used to test whether a conference is running.
* @return A positive value if a conference is running, 0 if not.
**/
LinphoneConference getConference();
/**
* Indicates whether the local user is part of the conference.
**/
@ -1368,7 +1381,6 @@ public interface LinphoneCore {
* When the local participant is out of the conference, the remote participants can continue to talk normally.
**/
void leaveConference();
/**
* Merge a call into a conference.
*
@ -1417,13 +1429,6 @@ public interface LinphoneCore {
* @returns the number of participants to the conference
**/
int getConferenceSize();
/**
* Return the value of the C pointer on the conference instance.
*
* That function can be used to test whether a conference is running.
* @return A positive value if a conference is running, 0 if not.
**/
LinphoneConference getConference();
/**
* Request recording of the conference into a supplied file path.

View file

@ -0,0 +1,51 @@
/*
LinphoneConferenceParamsImpl.java
Copyright (C) 2015 Belledonne Communications, Grenoble, France
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., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
*/
package org.linphone.core;
public class LinphoneConferenceParamsImpl implements LinphoneConferenceParams {
private long nativePtr = 0;
private native long createInstance(LinphoneCoreImpl core);
public LinphoneConferenceParamsImpl(LinphoneCore core) {
this.nativePtr = createInstance((LinphoneCoreImpl)core);
}
private native long copyInstance(long paramsPtr);
public LinphoneConferenceParamsImpl(LinphoneConferenceParamsImpl params) {
nativePtr = copyInstance(params.nativePtr);
}
private native void destroyInstance(long nativePtr);
public void finalize() {
destroyInstance(this.nativePtr);
}
private native void enableVideo(long paramsPtr, boolean enable);
@Override
public void enableVideo(boolean enable) {
enableVideo(this.nativePtr, enable);
}
private native boolean isVideoRequested(long paramsPtr);
@Override
public boolean isVideoRequested() {
return isVideoRequested(this.nativePtr);
}
}

View file

@ -322,7 +322,7 @@ class LinphoneCoreImpl implements LinphoneCore {
setNetworkStateReachable(nativePtr,isReachable);
}
public synchronized void setPlaybackGain(float gain) {
setPlaybackGain(nativePtr,gain);
setPlaybackGain(nativePtr, gain);
}
public synchronized float getPlaybackGain() {
@ -382,7 +382,7 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized boolean payloadTypeIsVbr(PayloadType pt) {
isValid();
return payloadTypeIsVbr(nativePtr, ((PayloadTypeImpl)pt).nativePtr);
return payloadTypeIsVbr(nativePtr, ((PayloadTypeImpl) pt).nativePtr);
}
public synchronized void enableEchoCancellation(boolean enable) {
@ -449,7 +449,7 @@ class LinphoneCoreImpl implements LinphoneCore {
}
public synchronized void addFriend(LinphoneFriend lf) throws LinphoneCoreException {
addFriend(nativePtr,((LinphoneFriendImpl)lf).nativePtr);
addFriend(nativePtr, ((LinphoneFriendImpl) lf).nativePtr);
}
@ -484,7 +484,7 @@ class LinphoneCoreImpl implements LinphoneCore {
return new LinphoneChatRoomImpl(getOrCreateChatRoom(nativePtr,to));
}
public synchronized LinphoneChatRoom getChatRoom(LinphoneAddress to) {
return new LinphoneChatRoomImpl(getChatRoom(nativePtr,((LinphoneAddressImpl)to).nativePtr));
return new LinphoneChatRoomImpl(getChatRoom(nativePtr, ((LinphoneAddressImpl) to).nativePtr));
}
public synchronized void setPreviewWindow(Object w) {
setPreviewWindowId(nativePtr,w);
@ -497,7 +497,7 @@ class LinphoneCoreImpl implements LinphoneCore {
}
public synchronized void enableVideo(boolean vcap_enabled, boolean display_enabled) {
enableVideo(nativePtr,vcap_enabled, display_enabled);
enableVideo(nativePtr, vcap_enabled, display_enabled);
}
public synchronized boolean isVideoEnabled() {
return isVideoEnabled(nativePtr);
@ -515,7 +515,7 @@ class LinphoneCoreImpl implements LinphoneCore {
setFirewallPolicy(nativePtr,pol.value());
}
public synchronized void setStunServer(String stunServer) {
setStunServer(nativePtr,stunServer);
setStunServer(nativePtr, stunServer);
}
public synchronized LinphoneCall inviteAddressWithParams(LinphoneAddress to, LinphoneCallParams params) throws LinphoneCoreException {
@ -655,7 +655,7 @@ class LinphoneCoreImpl implements LinphoneCore {
}
public synchronized void enableIpv6(boolean enable) {
enableIpv6(nativePtr,enable);
enableIpv6(nativePtr, enable);
}
public synchronized boolean isIpv6Enabled() {
return isIpv6Enabled(nativePtr);
@ -678,14 +678,14 @@ class LinphoneCoreImpl implements LinphoneCore {
}
public synchronized void setUploadPtime(int ptime) {
setUploadPtime(nativePtr,ptime);
setUploadPtime(nativePtr, ptime);
}
public synchronized void setZrtpSecretsCache(String file) {
setZrtpSecretsCache(nativePtr,file);
setZrtpSecretsCache(nativePtr, file);
}
public synchronized void enableEchoLimiter(boolean val) {
enableEchoLimiter(nativePtr,val);
enableEchoLimiter(nativePtr, val);
}
public synchronized void setVideoDevice(int id) {
Log.i("Setting camera id :", id);
@ -721,6 +721,10 @@ class LinphoneCoreImpl implements LinphoneCore {
public synchronized int getConferenceSize() {
return getConferenceSize(nativePtr);
}
private native LinphoneConference createConference(long corePtr, LinphoneConferenceParams params);
public synchronized LinphoneConference createConference(LinphoneConferenceParams params) {
return createConference(this.nativePtr, params);
}
private native LinphoneConference getConference(long nativePtr);
public synchronized LinphoneConference getConference() {
return getConference(nativePtr);

View file

@ -262,9 +262,7 @@ static void simple_conference_base(LinphoneCoreManager* marie, LinphoneCoreManag
BC_ASSERT_PTR_NOT_NULL(conference = linphone_core_get_conference(marie->lc));
if(conference) {
MSList *participants = linphone_conference_get_participants(conference);
BC_ASSERT_EQUAL(linphone_conference_get_size(conference), linphone_core_get_conference_size(marie->lc), int, "%d");
BC_ASSERT_EQUAL(linphone_conference_get_size(conference), ms_list_size(participants)+(linphone_conference_is_in(conference)?1:0), int, "%d");
BC_ASSERT_TRUE(linphone_conference_is_in(conference));
BC_ASSERT_EQUAL(ms_list_size(participants), 2, int, "%d");
ms_list_free_with_data(participants, (void(*)(void *))linphone_address_destroy);
}