Commit f8a7f255 authored by François Grisez's avatar François Grisez

Add a property to LinphoneCalls

Add a property to LinphoneCalls storing the reference
to the conference in which the call is part of. That
property is NULL if the call is part of no conference

That commit also add some documentation on several
functions
parent 0a4fab59
......@@ -125,6 +125,10 @@ LINPHONE_PUBLIC const char *linphone_call_params_get_custom_header(const Linphon
/**
* Tell whether the call is part of the locally managed conference.
* @warning If a conference server is used to manage conferences,
* that function does not return TRUE even if the conference is running.<br/>
* If you want to test whether the conference is running, you should test
* whether linphone_core_get_conference() return a non-null pointer.
* @param[in] cp LinphoneCallParams object
* @return A boolean value telling whether the call is part of the locally managed conference.
**/
......
......@@ -71,6 +71,16 @@ Conference::Conference(LinphoneCore *core) :
m_isMuted(false) {
}
int Conference::addCall(LinphoneCall *call) {
call->conf_ref = (LinphoneConference *)this;
return 0;
}
int Conference::removeCall(LinphoneCall *call) {
call->conf_ref = NULL;
return 0;
}
int Conference::muteMicrophone(bool val) {
if (val) {
audio_stream_set_mic_gain(m_localParticipantStream, 0);
......@@ -386,12 +396,14 @@ void MediaConference::onCallStreamStarting(LinphoneCall *call, bool isPausedByRe
ms_audio_conference_add_member(m_conf,ep);
ms_audio_conference_mute_member(m_conf,ep,isPausedByRemote);
call->endpoint=ep;
Conference::addCall(call);
}
void MediaConference::onCallStreamStopping(LinphoneCall *call) {
ms_audio_conference_remove_member(m_conf,call->endpoint);
ms_audio_endpoint_release_from_stream(call->endpoint);
call->endpoint=NULL;
Conference::removeCall(call);
}
void MediaConference::onCallTerminating(LinphoneCall *call) {
......@@ -573,6 +585,7 @@ const char *TransportConference::stateToString(TransportConference::State state)
void TransportConference::onFocusCallSateChanged(LinphoneCallState state) {
switch (state) {
case LinphoneCallConnected:
Conference::addCall(m_focusCall);
m_state = ConnectedToFocus;
m_focusContact = linphone_call_get_remote_contact(m_focusCall);
for (MSList *it = m_pendingCalls; it; it = it->next) {
......@@ -591,6 +604,7 @@ void TransportConference::onFocusCallSateChanged(LinphoneCallState state) {
case LinphoneCallError:
case LinphoneCallEnd:
Conference::removeCall(m_focusCall);
m_state = NotConnectedToFocus;
m_focusCall = NULL;
m_localParticipantStream = NULL;
......
......@@ -4520,6 +4520,10 @@ bool_t linphone_call_is_in_conference(const LinphoneCall *call) {
return call->params->in_conference;
}
LinphoneConference *linphone_call_get_conference(const LinphoneCall *call) {
return call->conf_ref;
}
/**
* Perform a zoom of the video displayed during a call.
* @param call the call.
......
......@@ -139,13 +139,19 @@ enum _LinphoneStreamType {
* @ingroup initializing
**/
typedef enum _LinphoneStreamType LinphoneStreamType;
/**
* Internal object of LinphoneCore representing a conference
* @ingroup call_control
*/
typedef struct _LinphoneConference LinphoneConference;
/**
* Function returning a humain readable value for LinphoneStreamType.
* @param LinphoneStreamType
* @returns
* @ingroup initializing
**/
LINPHONE_PUBLIC const char *linphone_stream_type_to_string(const LinphoneStreamType);
/**
* Object that represents a SIP address.
......@@ -890,10 +896,19 @@ LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call
* @param call #LinphoneCall
* @return TRUE if part of a conference.
*
* @deprecated Use linphone_call_params_get_local_conference_mode(linphone_call_get_current_params(call)) instead.
* @deprecated Use linphone_call_get_conference() instead.
* @ingroup call_control
*/
LINPHONE_PUBLIC LINPHONE_DEPRECATED bool_t linphone_call_is_in_conference(const LinphoneCall *call);
/**
* Return the associated conference object
* @param call #LinphoneCall
* @return A pointer on #LinphoneConference or NULL if the call is not part
* of any conference.
* @ingroup call_control
*/
LINPHONE_PUBLIC LinphoneConference *linphone_call_get_conference(const LinphoneCall *call);
/**
* Enables or disable echo cancellation for this call
* @param call
......@@ -3803,9 +3818,27 @@ LINPHONE_PUBLIC const char *linphone_core_get_user_certificates_path(LinphoneCor
*/
LINPHONE_PUBLIC LinphoneCall* linphone_core_find_call_from_uri(const LinphoneCore *lc, const char *uri);
typedef struct _LinphoneConference LinphoneConference;
/**
* @addtogroup call_control
* @{
*/
/**
* Add a participant to the conference. If no conference is going on
* a new internal conference context is created and the participant is
* added to it.
* @param lc #LinphoneCore
* @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);
/**
* Add all current calls into the conference. If no conference is running
* a new internal conference context is created and all current calls
* are added to it.
* @param lc #LinphoneCore
* @return 0 if succeeded. Negative number if failed
*/
LINPHONE_PUBLIC int linphone_core_add_all_to_conference(LinphoneCore *lc);
/**
* Remove a call from the conference.
......@@ -3827,17 +3860,65 @@ LINPHONE_PUBLIC int linphone_core_add_all_to_conference(LinphoneCore *lc);
* Indicates whether the local participant is part of a conference.
* @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);
/**
* 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);
/**
* 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);
/**
* 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);
/**
* 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.
* If it is a conference involving a focus server, all calls inside the conference
* will be terminated.
* @param lc #LinphoneCore
* @return 0 if succeeded. Negative number if failed
*/
LINPHONE_PUBLIC int linphone_core_terminate_conference(LinphoneCore *lc);
/**
* Get the number of remote participant in the running conference
* @param lc #LinphoneCore
* @return The number of remote participant
*/
LINPHONE_PUBLIC int linphone_core_get_conference_size(LinphoneCore *lc);
/**
* Start recording the running conference
* @param lc #LinphoneCore
* @param path Path to the file where the recording will be written
* @return 0 if succeeded. Negative number if failed
*/
LINPHONE_PUBLIC int linphone_core_start_conference_recording(LinphoneCore *lc, const char *path);
/**
* Stop recording the running conference
* @param #LinphoneCore
* @return 0 if succeeded. Negative number if failed
*/
LINPHONE_PUBLIC int linphone_core_stop_conference_recording(LinphoneCore *lc);
/**
* Get a pointer on the internal conference object.
* @param lc #LinphoneCore
* @return A pointer on #LinphoneConference or NULL if no conference are going on
*/
LINPHONE_PUBLIC LinphoneConference *linphone_core_get_conference(LinphoneCore *lc);
/**
* @}
*/
/**
* Get the maximum number of simultaneous calls Linphone core can manage at a time. All new call above this limit are declined with a busy answer
* @ingroup initializing
......
......@@ -329,6 +329,8 @@ struct _LinphoneCall{
bool_t paused_by_app;
bool_t broken; /*set to TRUE when the call is in broken state due to network disconnection or transport */
LinphoneConference *conf_ref; /**> Point on the associated conference if this call is part of a conference. NULL instead. */
};
BELLE_SIP_DECLARE_VPTR(LinphoneCall);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment