diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c
index fa9022557..6da4d2343 100644
--- a/coreapi/linphonecall.c
+++ b/coreapi/linphonecall.c
@@ -86,7 +86,6 @@ MSWebCam *get_nowebcam_device(MSFactory* f){
#endif
}
-
static bool_t generate_b64_crypto_key(size_t key_length, char* key_out, size_t key_out_size) {
size_t b64_size;
uint8_t* tmp = (uint8_t*) ms_malloc0(key_length);
@@ -134,14 +133,6 @@ const char* linphone_call_get_authentication_token(LinphoneCall *call){
return call->auth_token;
}
-/**
- * Returns whether ZRTP authentication token is verified.
- * If not, it must be verified by users as described in ZRTP procedure.
- * Once done, the application must inform of the results with linphone_call_set_authentication_token_verified().
- * @param call the LinphoneCall
- * @return TRUE if authentication token is verifed, false otherwise.
- * @ingroup call_control
-**/
bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call){
return call->auth_token_verified;
}
@@ -246,7 +237,6 @@ static void linphone_call_audiostream_encryption_changed(void *data, bool_t encr
propagate_encryption_changed(call);
-
#ifdef VIDEO_ENABLED
// Enable video encryption
if (call->params->media_encryption==LinphoneMediaEncryptionZRTP) {
@@ -259,7 +249,6 @@ static void linphone_call_audiostream_encryption_changed(void *data, bool_t encr
#endif
}
-
static void linphone_call_audiostream_auth_token_ready(void *data, const char* auth_token, bool_t verified) {
LinphoneCall *call=(LinphoneCall *)data;
if (call->auth_token != NULL)
@@ -271,13 +260,6 @@ static void linphone_call_audiostream_auth_token_ready(void *data, const char* a
ms_message("Authentication token is %s (%s)", auth_token, verified?"verified":"unverified");
}
-/**
- * Set the result of ZRTP short code verification by user.
- * If remote party also does the same, it will update the ZRTP cache so that user's verification will not be required for the two users.
- * @param call the LinphoneCall
- * @param verified whether the ZRTP SAS is verified.
- * @ingroup call_control
-**/
void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t verified){
if (call->audiostream==NULL || !media_stream_started(&call->audiostream->ms)){
ms_error("linphone_call_set_authentication_token_verified(): No audio stream or not started");
@@ -1053,7 +1035,6 @@ void linphone_call_init_stats(LinphoneCallStats *stats, int type) {
#endif //BUILD_UPNP
}
-
static void discover_mtu(LinphoneCore *lc, const char *remote){
int mtu;
if (lc->net_conf.mtu==0 ){
@@ -1535,7 +1516,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
* It is called by linphone_call_set_terminated() (for termination of calls signaled to the application), or directly by the destructor of LinphoneCall
* (_linphone_call_destroy) if the call was never notified to the application.
*/
-void linphone_call_free_media_resources(LinphoneCall *call){
+static void linphone_call_free_media_resources(LinphoneCall *call){
int i;
linphone_call_stop_media_streams(call);
@@ -1585,7 +1566,6 @@ static void linphone_call_set_released(LinphoneCall *call){
- remove the call from the internal list of calls
- update the call logs accordingly
*/
-
static void linphone_call_set_terminated(LinphoneCall *call){
LinphoneCore *lc=call->core;
@@ -1866,11 +1846,6 @@ static void linphone_call_destroy(LinphoneCall *obj){
sal_error_info_reset(&obj->non_op_error);
}
-/**
- * @addtogroup call_control
- * @{
-**/
-
LinphoneCall * linphone_call_ref(LinphoneCall *obj){
belle_sip_object_ref(obj);
return obj;
@@ -1889,9 +1864,6 @@ static unsigned int linphone_call_get_n_active_streams(const LinphoneCall *call)
return sal_media_description_nb_active_streams_of_type(md, SalAudio) + sal_media_description_nb_active_streams_of_type(md, SalVideo) + sal_media_description_nb_active_streams_of_type(md, SalText);
}
-/**
- * Returns current parameters associated to the call.
-**/
const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
SalMediaDescription *md=call->resultdesc;
int all_streams_encrypted = 0;
@@ -1986,12 +1958,6 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
return call->current_params;
}
-/**
- * Returns call parameters proposed by remote.
- *
- * This is useful when receiving an incoming call, to know whether the remote party
- * supports video, encryption or whatever.
-**/
const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call){
if (call->op){
LinphoneCallParams *cp;
@@ -2045,48 +2011,26 @@ const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call){
return NULL;
}
-/**
- * Returns the remote address associated to this call
- *
-**/
const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call){
return call->dir==LinphoneCallIncoming ? call->log->from : call->log->to;
}
-/**
- * Returns the remote address associated to this call as a string.
- *
- * The result string must be freed by user using ms_free().
-**/
char *linphone_call_get_remote_address_as_string(const LinphoneCall *call){
return linphone_address_as_string(linphone_call_get_remote_address(call));
}
-/**
- * Returns the diversion address associated to this call
- *
-**/
const LinphoneAddress * linphone_call_get_diversion_address(const LinphoneCall *call){
return call->op?(const LinphoneAddress *)sal_op_get_diversion_address(call->op):NULL;
}
-/**
- * Retrieves the call's current state.
-**/
LinphoneCallState linphone_call_get_state(const LinphoneCall *call){
return call->state;
}
-/**
- * Returns the reason for a call termination (either error or normal termination)
-**/
LinphoneReason linphone_call_get_reason(const LinphoneCall *call){
return linphone_error_info_get_reason(linphone_call_get_error_info(call));
}
-/**
- * Returns full details about call errors or termination reasons.
-**/
const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call){
if (call->non_op_error.reason!=SalReasonNone){
return (const LinphoneErrorInfo*)&call->non_op_error;
@@ -2103,45 +2047,26 @@ void linphone_call_set_user_data(LinphoneCall *call, void *user_pointer)
call->user_data = user_pointer;
}
-/**
- * Returns the call log associated to this call.
-**/
LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call){
return call->log;
}
-/**
- * Returns the refer-to uri (if the call was transfered).
-**/
const char *linphone_call_get_refer_to(const LinphoneCall *call){
return call->refer_to;
}
-/**
- * Returns the transferer if this call was started automatically as a result of an incoming transfer request.
- * The call in which the transfer request was received is returned in this case.
-**/
LinphoneCall *linphone_call_get_transferer_call(const LinphoneCall *call){
return call->referer;
}
-/**
- * When this call has received a transfer request, returns the new call that was automatically created as a result of the transfer.
-**/
LinphoneCall *linphone_call_get_transfer_target_call(const LinphoneCall *call){
return call->transfer_target;
}
-/**
- * Returns direction of the call (incoming or outgoing).
-**/
LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call){
return call->log->dir;
}
-/**
- * Returns the far end's user agent description string, if available.
-**/
const char *linphone_call_get_remote_user_agent(LinphoneCall *call){
if (call->op){
return sal_op_get_remote_ua (call->op);
@@ -2149,9 +2074,6 @@ const char *linphone_call_get_remote_user_agent(LinphoneCall *call){
return NULL;
}
-/**
- * Returns the far end's sip contact as a string, if available.
-**/
const char *linphone_call_get_remote_contact(LinphoneCall *call){
if( call->op ){
/*sal_op_get_remote_contact preserves header params*/
@@ -2160,33 +2082,15 @@ const char *linphone_call_get_remote_contact(LinphoneCall *call){
return NULL;
}
-
-/**
- * Returns true if this calls has received a transfer that has not been
- * executed yet.
- * Pending transfers are executed when this call is being paused or closed,
- * locally or by remote endpoint.
- * If the call is already paused while receiving the transfer request, the
- * transfer immediately occurs.
-**/
bool_t linphone_call_has_transfer_pending(const LinphoneCall *call){
return call->refer_pending;
}
-/**
- * Returns call's duration in seconds.
-**/
int linphone_call_get_duration(const LinphoneCall *call){
if (call->log->connected_date_time==0) return 0;
return (int)(ms_time(NULL) - call->log->connected_date_time);
}
-/**
- * Returns the call object this call is replacing, if any.
- * Call replacement can occur during call transfers.
- * By default, the core automatically terminates the replaced call and accept the new one.
- * This function allows the application to know whether a new incoming call is a one that replaces another one.
-**/
LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call){
SalOp *op=sal_call_get_replaces(call->op);
if (op){
@@ -2195,9 +2099,6 @@ LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call){
return NULL;
}
-/**
- * Indicate whether camera input should be sent to remote end.
-**/
void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){
#ifdef VIDEO_ENABLED
call->camera_enabled=enable;
@@ -2222,9 +2123,6 @@ void linphone_call_enable_camera (LinphoneCall *call, bool_t enable){
#endif
}
-/**
- * Request remote side to send us a Video Fast Update.
-**/
void linphone_call_send_vfu_request(LinphoneCall *call) {
#ifdef VIDEO_ENABLED
const LinphoneCallParams *current_params = linphone_call_get_current_params(call);
@@ -2242,13 +2140,6 @@ void linphone_call_send_vfu_request(LinphoneCall *call) {
}
-/**
- * Take a photo of currently received video and write it into a jpeg file.
- * Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
- * @param call a LinphoneCall
- * @param file a path where to write the jpeg content.
- * @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
-**/
int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL && call->videostream->jpegwriter!=NULL){
@@ -2259,13 +2150,6 @@ int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file){
return -1;
}
-/**
- * Take a photo of currently captured video and write it into a jpeg file.
- * Note that the snapshot is asynchronous, an application shall not assume that the file is created when the function returns.
- * @param call a LinphoneCall
- * @param file a path where to write the jpeg content.
- * @return 0 if successfull, -1 otherwise (typically if jpeg format is not supported).
-**/
int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file){
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL && call->videostream->local_jpegwriter!=NULL){
@@ -2277,14 +2161,10 @@ int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file){
return -1;
}
-/**
- * Returns TRUE if camera pictures are allowed to be sent to the remote party.
-**/
bool_t linphone_call_camera_enabled (const LinphoneCall *call){
return call->camera_enabled;
}
-
/**
* @ingroup call_control
* @return string value of LinphonePrivacy enum
@@ -2303,11 +2183,6 @@ const char* linphone_privacy_to_string(LinphonePrivacy privacy) {
}
-/**
- * @}
-**/
-
-
#ifdef TEST_EXT_RENDERER
static void rendercb(void *data, const MSPicture *local, const MSPicture *remote){
ms_message("rendercb, local buffer=%p, remote buffer=%p",
@@ -2461,7 +2336,6 @@ static SalMulticastRole linphone_call_get_multicast_role(const LinphoneCall *cal
ms_message("Call [%p], stream type [%s], multicast role is [%s]",call, sal_stream_type_to_string(type),
sal_multicast_role_to_string(multicast_role));
return multicast_role;
-
}
static void setup_dtls_params(LinphoneCall *call, MediaStream* stream) {
@@ -3029,7 +2903,6 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
return prof;
}
-
static void setup_ring_player(LinphoneCore *lc, LinphoneCall *call){
int pause_time=3000;
audio_stream_play(call->audiostream,lc->sound_conf.ringback_tone);
@@ -3404,7 +3277,6 @@ static void linphone_call_start_audio_stream(LinphoneCall *call, LinphoneCallSta
}else ms_warning("No audio stream accepted ?");
}
linphone_call_set_on_hold_file(call, file_to_play);
-
}
#ifdef VIDEO_ENABLED
@@ -3660,7 +3532,6 @@ void linphone_call_set_symmetric_rtp(LinphoneCall *call, bool_t val){
}
}
-
void linphone_call_start_media_streams(LinphoneCall *call, LinphoneCallState next_state){
LinphoneCore *lc=call->core;
bool_t use_arc = linphone_core_adaptive_rate_control_enabled(lc);
@@ -3829,7 +3700,6 @@ void linphone_call_delete_ice_session(LinphoneCall *call){
}
}
-
void linphone_call_delete_upnp_session(LinphoneCall *call){
#ifdef BUILD_UPNP
if(call->upnp_session!=NULL) {
@@ -3839,7 +3709,6 @@ void linphone_call_delete_upnp_session(LinphoneCall *call){
#endif //BUILD_UPNP
}
-
static void linphone_call_log_fill_stats(LinphoneCallLog *log, MediaStream *st){
float quality=media_stream_get_average_quality_rating(st);
if (quality>=0){
@@ -3973,14 +3842,13 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
linphone_core_soundcard_hint_check(call->core);
}
-
-
void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t enable) {
if (call!=NULL && call->audiostream!=NULL && call->audiostream->ec){
bool_t bypass_mode = !enable;
ms_filter_call_method(call->audiostream->ec,MS_ECHO_CANCELLER_SET_BYPASS_MODE,&bypass_mode);
}
}
+
bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *call) {
if (call!=NULL && call->audiostream!=NULL && call->audiostream->ec){
bool_t val;
@@ -4013,15 +3881,6 @@ bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call){
}
}
-/**
- * @addtogroup call_misc
- * @{
-**/
-
-/**
- * Returns the measured sound volume played locally (received from remote).
- * It is expressed in dbm0.
-**/
float linphone_call_get_play_volume(LinphoneCall *call){
AudioStream *st=call->audiostream;
if (st && st->volrecv){
@@ -4033,10 +3892,6 @@ float linphone_call_get_play_volume(LinphoneCall *call){
return LINPHONE_VOLUME_DB_LOWEST;
}
-/**
- * Returns the measured sound volume recorded locally (sent to remote).
- * It is expressed in dbm0.
-**/
float linphone_call_get_record_volume(LinphoneCall *call){
AudioStream *st=call->audiostream;
if (st && st->volsend && !call->audio_muted && call->state==LinphoneCallStreamsRunning){
@@ -4073,6 +3928,7 @@ void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float volume)
if(call->audiostream) audio_stream_set_sound_card_input_gain(call->audiostream, volume);
else ms_error("Could not set record volume: no audio stream");
}
+
static float agregate_ratings(float audio_rating, float video_rating){
float result;
if (audio_rating<0 && video_rating<0) result=-1;
@@ -4081,23 +3937,7 @@ static float agregate_ratings(float audio_rating, float video_rating){
else result=audio_rating*video_rating*5.0f;
return result;
}
-/**
- * Obtain real-time quality rating of the call
- *
- * Based on local RTP statistics and RTCP feedback, a quality rating is computed and updated
- * during all the duration of the call. This function returns its value at the time of the function call.
- * It is expected that the rating is updated at least every 5 seconds or so.
- * The rating is a floating point number comprised between 0 and 5.
- *
- * 4-5 = good quality
- * 3-4 = average quality
- * 2-3 = poor quality
- * 1-2 = very poor quality
- * 0-1 = can't be worse, mostly unusable
- *
- * @return The function returns -1 if no quality measurement is available, for example if no
- * active audio stream exist. Otherwise it returns the quality rating.
-**/
+
float linphone_call_get_current_quality(LinphoneCall *call){
float audio_rating=-1.f;
float video_rating=-1.f;
@@ -4111,11 +3951,6 @@ float linphone_call_get_current_quality(LinphoneCall *call){
return agregate_ratings(audio_rating, video_rating);
}
-/**
- * Returns call quality averaged over all the duration of the call.
- *
- * See linphone_call_get_current_quality() for more details about quality measurement.
-**/
float linphone_call_get_average_quality(LinphoneCall *call){
float audio_rating=-1.f;
float video_rating=-1.f;
@@ -4175,15 +4010,6 @@ static bool_t ice_in_progress(LinphoneCallStats *stats){
return stats->ice_state==LinphoneIceStateInProgress;
}
-/**
- * Indicates whether an operation is in progress at the media side.
- * It can be a bad idea to initiate signaling operations (adding video, pausing the call, removing video, changing video parameters) while
- * the media is busy in establishing the connection (typically ICE connectivity checks). It can result in failures generating loss of time
- * in future operations in the call.
- * Applications are invited to check this function after each call state change to decide whether certain operations are permitted or not.
- * @param call the call
- * @return TRUE if media is busy in establishing the connection, FALSE otherwise.
-**/
bool_t linphone_call_media_in_progress(LinphoneCall *call){
bool_t ret=FALSE;
if (ice_in_progress(&call->stats[LINPHONE_CALL_STATS_AUDIO]) || ice_in_progress(&call->stats[LINPHONE_CALL_STATS_VIDEO]) || ice_in_progress(&call->stats[LINPHONE_CALL_STATS_TEXT]))
@@ -4313,10 +4139,6 @@ LinphoneUpnpState linphone_call_stats_get_upnp_state(const LinphoneCallStats *st
return stats->upnp_state;
}
-/**
- * Start call recording.
- * The output file where audio is recorded must be previously specified with linphone_call_params_set_record_file().
-**/
void linphone_call_start_recording(LinphoneCall *call){
if (!call->params->record_file){
ms_error("linphone_call_start_recording(): no output file specified. Use linphone_call_params_set_record_file().");
@@ -4328,9 +4150,6 @@ void linphone_call_start_recording(LinphoneCall *call){
call->record_active=TRUE;
}
-/**
- * Stop call recording.
-**/
void linphone_call_stop_recording(LinphoneCall *call){
if (call->audiostream && !call->params->in_conference){
audio_stream_mixed_record_stop(call->audiostream);
@@ -4338,10 +4157,6 @@ void linphone_call_stop_recording(LinphoneCall *call){
call->record_active=FALSE;
}
-/**
- * @}
-**/
-
static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *vs, MediaStream *ts){
bool_t as_active = as ? (media_stream_get_state(as) == MSStreamStarted) : FALSE;
bool_t vs_active = vs ? (media_stream_get_state(vs) == MSStreamStarted) : FALSE;
@@ -4384,7 +4199,6 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v
if (ts_active) update_local_stats(&call->stats[LINPHONE_CALL_STATS_TEXT], ts);
}
-
ms_message( "Bandwidth usage for call [%p]:\n"
"\tRTP audio=[d=%5.1f,u=%5.1f], video=[d=%5.1f,u=%5.1f], text=[d=%5.1f,u=%5.1f] kbits/sec\n"
"\tRTCP audio=[d=%5.1f,u=%5.1f], video=[d=%5.1f,u=%5.1f], text=[d=%5.1f,u=%5.1f] kbits/sec",
@@ -4402,7 +4216,6 @@ static void report_bandwidth(LinphoneCall *call, MediaStream *as, MediaStream *v
call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_download_bandwidth,
call->stats[LINPHONE_CALL_STATS_TEXT].rtcp_upload_bandwidth
);
-
}
static void linphone_call_lost(LinphoneCall *call, LinphoneReason reason){
@@ -4427,7 +4240,6 @@ static void linphone_call_lost(LinphoneCall *call, LinphoneReason reason){
ms_free(temp);
}
-
static void linphone_call_on_ice_gathering_finished(LinphoneCall *call){
int ping_time;
const SalMediaDescription *rmd = sal_call_get_remote_media_description(call->op);
@@ -4503,7 +4315,6 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
}
}
-
/*do not change the prototype of this function, it is also used internally in linphone-daemon.*/
void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev){
OrtpEventType evt=ortp_event_get_type(ev);
@@ -4732,10 +4543,6 @@ void linphone_call_log_completed(LinphoneCall *call){
linphone_core_notify_call_log_updated(lc,call->log);
}
-/**
- * Returns the current transfer state, if a transfer has been initiated from this call.
- * @see linphone_core_transfer_call() , linphone_core_transfer_call_to_another()
-**/
LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call) {
return call->transfer_state;
}
@@ -4759,15 +4566,6 @@ 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.
- * @param zoom_factor a floating point number describing the zoom factor. A value 1.0 corresponds to no zoom applied.
- * @param cx a floating point number pointing the horizontal center of the zoom to be applied. This value should be between 0.0 and 1.0.
- * @param cy a floating point number pointing the vertical center of the zoom to be applied. This value should be between 0.0 and 1.0.
- *
- * cx and cy are updated in return in case their coordinates were too excentrated for the requested zoom factor. The zoom ensures that all the screen is fullfilled with the video.
-**/
void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy) {
VideoStream* vstream = call->videostream;
if (vstream && vstream->output) {
@@ -4892,6 +4690,7 @@ static int send_dtmf_handler(void *data, unsigned int revents){
return FALSE;
}
}
+
int linphone_call_send_dtmf(LinphoneCall *call,char dtmf){
if (call==NULL){
ms_warning("linphone_call_send_dtmf(): invalid call, canceling DTMF.");
@@ -4965,7 +4764,6 @@ MSWebCam *linphone_call_get_video_device(const LinphoneCall *call) {
return call->core->video_conf.device;
}
-
void linphone_call_set_audio_route(LinphoneCall *call, LinphoneAudioRoute route) {
if (call != NULL && call->audiostream != NULL){
audio_stream_set_audio_route(call->audiostream, (MSAudioRoute) route);
@@ -5095,7 +4893,6 @@ void linphone_call_repair_if_broken(LinphoneCall *call){
&& linphone_proxy_config_get_state(call->dest_proxy) != LinphoneRegistrationOk) return;
}
-
switch (call->state){
case LinphoneCallUpdating:
case LinphoneCallPausing:
diff --git a/include/CMakeLists.txt b/include/CMakeLists.txt
index cd7b3c129..8671d5dfb 100644
--- a/include/CMakeLists.txt
+++ b/include/CMakeLists.txt
@@ -24,6 +24,7 @@ set(HEADER_FILES
account_creator.h
address.h
buffer.h
+ call.h
call_log.h
call_params.h
call_stats.h
diff --git a/include/linphone/Makefile.am b/include/linphone/Makefile.am
index f8d31657d..006ea7bd1 100644
--- a/include/linphone/Makefile.am
+++ b/include/linphone/Makefile.am
@@ -4,6 +4,7 @@ linphone_include_HEADERS=\
account_creator.h \
address.h \
buffer.h \
+ call.h \
call_log.h \
call_params.h \
call_stats.h \
diff --git a/include/linphone/call.h b/include/linphone/call.h
new file mode 100644
index 000000000..fac2d6766
--- /dev/null
+++ b/include/linphone/call.h
@@ -0,0 +1,575 @@
+/*
+call.h
+Copyright (C) 2016 Belledonne Communications SARL
+
+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.
+*/
+
+#ifndef LINPHONE_CALL_H
+#define LINPHONE_CALL_H
+
+#include "linphone/address.h"
+#include "linphone/call_log.h"
+#include "linphone/call_params.h"
+#include "linphone/conference.h"
+#include "linphone/error_info.h"
+
+/**
+ * @addtogroup call_control
+ * @{
+ */
+
+/**
+ * LinphoneCallState enum represents the different state a call can reach into.
+ * The application is notified of state changes through the LinphoneCoreVTable::call_state_changed callback.
+**/
+typedef enum _LinphoneCallState{
+ LinphoneCallIdle, /**
+ * 3-4 = average quality
+ * 2-3 = poor quality
+ * 1-2 = very poor quality
+ * 0-1 = can't be worse, mostly unusable
+ *
+ * @return The function returns -1 if no quality measurement is available, for example if no
+ * active audio stream exist. Otherwise it returns the quality rating.
+**/
+LINPHONE_PUBLIC float linphone_call_get_current_quality(LinphoneCall *call);
+
+/**
+ * Returns call quality averaged over all the duration of the call.
+ *
+ * See linphone_call_get_current_quality() for more details about quality measurement.
+**/
+LINPHONE_PUBLIC float linphone_call_get_average_quality(LinphoneCall *call);
+
+/**
+ * Start call recording.
+ * The output file where audio is recorded must be previously specified with linphone_call_params_set_record_file().
+**/
+LINPHONE_PUBLIC void linphone_call_start_recording(LinphoneCall *call);
+
+/**
+ * Stop call recording.
+**/
+LINPHONE_PUBLIC void linphone_call_stop_recording(LinphoneCall *call);
+
+LINPHONE_PUBLIC LinphonePlayer * linphone_call_get_player(LinphoneCall *call);
+
+/**
+ * Indicates whether an operation is in progress at the media side.
+ * It can be a bad idea to initiate signaling operations (adding video, pausing the call, removing video, changing video parameters) while
+ * the media is busy in establishing the connection (typically ICE connectivity checks). It can result in failures generating loss of time
+ * in future operations in the call.
+ * Applications are invited to check this function after each call state change to decide whether certain operations are permitted or not.
+ * @param call the call
+ * @return TRUE if media is busy in establishing the connection, FALSE otherwise.
+**/
+LINPHONE_PUBLIC bool_t linphone_call_media_in_progress(LinphoneCall *call);
+
+/**
+ * @}
+ */
+
+
+#endif /* LINPHONE_CALL_H */
diff --git a/include/linphone/core.h b/include/linphone/core.h
index e6991957a..d4e4149c6 100644
--- a/include/linphone/core.h
+++ b/include/linphone/core.h
@@ -147,17 +147,6 @@ LINPHONE_PUBLIC const char *linphone_stream_type_to_string(const LinphoneStreamT
typedef struct belle_sip_dict LinphoneDictionary;
-/**
- * The LinphoneCall object represents a call issued or received by the LinphoneCore
- * @ingroup call_control
-**/
-struct _LinphoneCall;
-/**
- * The LinphoneCall object represents a call issued or received by the LinphoneCore
- * @ingroup call_control
-**/
-typedef struct _LinphoneCall LinphoneCall;
-
#include "linphone/error_info.h"
/**
@@ -343,8 +332,51 @@ typedef unsigned int LinphonePrivacyMask;
LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy);
+/**
+ * Player interface.
+ * @ingroup call_control
+**/
+typedef struct _LinphonePlayer LinphonePlayer;
+
+/**
+ * Callback for notifying end of play (file).
+ * @param obj the LinphonePlayer
+ * @param user_data the user_data provided when calling linphone_player_open().
+ * @ingroup call_control
+**/
+typedef void (*LinphonePlayerEofCallback)(struct _LinphonePlayer *obj, void *user_data);
+
+LINPHONE_PUBLIC int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback, void *user_data);
+LINPHONE_PUBLIC int linphone_player_start(LinphonePlayer *obj);
+LINPHONE_PUBLIC int linphone_player_pause(LinphonePlayer *obj);
+LINPHONE_PUBLIC int linphone_player_seek(LinphonePlayer *obj, int time_ms);
+LINPHONE_PUBLIC MSPlayerState linphone_player_get_state(LinphonePlayer *obj);
+LINPHONE_PUBLIC int linphone_player_get_duration(LinphonePlayer *obj);
+LINPHONE_PUBLIC int linphone_player_get_current_position(LinphonePlayer *obj);
+LINPHONE_PUBLIC void linphone_player_close(LinphonePlayer *obj);
+LINPHONE_PUBLIC void linphone_player_destroy(LinphonePlayer *obj);
+
+/**
+ * Create an independent media file player.
+ * This player support WAVE and MATROSKA formats.
+ * @param lc A LinphoneCore object
+ * @param snd_card Playback sound card. If NULL, the sound card set in LinphoneCore will be used
+ * @param video_out Video display. If NULL, the video display set in LinphoneCore will be used
+ * @param window_id Id of the drawing window. Depend of video out
+ * @return A pointer on the new instance. NULL if faild.
+ */
+LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id);
+
+/**
+ * Check whether Matroksa format is supported by the player
+ * @return TRUE if it is supported
+ */
+LINPHONE_PUBLIC bool_t linphone_local_player_matroska_supported(void);
+
+
#include "linphone/address.h"
#include "linphone/buffer.h"
+#include "linphone/call.h"
#include "linphone/call_log.h"
#include "linphone/call_params.h"
#include "linphone/content.h"
@@ -476,133 +508,6 @@ LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_audio_stats(LinphoneC
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_video_stats(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallStats *linphone_call_get_text_stats(LinphoneCall *call);
-/** Callback prototype */
-typedef void (*LinphoneCallCbFunc)(LinphoneCall *call,void * user_data);
-
-/**
- * Player interface.
- * @ingroup call_control
-**/
-typedef struct _LinphonePlayer LinphonePlayer;
-
-/**
- * Callback for notifying end of play (file).
- * @param obj the LinphonePlayer
- * @param user_data the user_data provided when calling linphone_player_open().
- * @ingroup call_control
-**/
-typedef void (*LinphonePlayerEofCallback)(struct _LinphonePlayer *obj, void *user_data);
-
-LINPHONE_PUBLIC int linphone_player_open(LinphonePlayer *obj, const char *filename, LinphonePlayerEofCallback, void *user_data);
-LINPHONE_PUBLIC int linphone_player_start(LinphonePlayer *obj);
-LINPHONE_PUBLIC int linphone_player_pause(LinphonePlayer *obj);
-LINPHONE_PUBLIC int linphone_player_seek(LinphonePlayer *obj, int time_ms);
-LINPHONE_PUBLIC MSPlayerState linphone_player_get_state(LinphonePlayer *obj);
-LINPHONE_PUBLIC int linphone_player_get_duration(LinphonePlayer *obj);
-LINPHONE_PUBLIC int linphone_player_get_current_position(LinphonePlayer *obj);
-LINPHONE_PUBLIC void linphone_player_close(LinphonePlayer *obj);
-LINPHONE_PUBLIC void linphone_player_destroy(LinphonePlayer *obj);
-
-/**
- * Create an independent media file player.
- * This player support WAVE and MATROSKA formats.
- * @param lc A LinphoneCore object
- * @param snd_card Playback sound card. If NULL, the sound card set in LinphoneCore will be used
- * @param video_out Video display. If NULL, the video display set in LinphoneCore will be used
- * @param window_id Id of the drawing window. Depend of video out
- * @return A pointer on the new instance. NULL if faild.
- */
-LINPHONE_PUBLIC LinphonePlayer *linphone_core_create_local_player(LinphoneCore *lc, MSSndCard *snd_card, const char *video_out, void *window_id);
-
-/**
- * Check whether Matroksa format is supported by the player
- * @return TRUE if it is supported
- */
-LINPHONE_PUBLIC bool_t linphone_local_player_matroska_supported(void);
-
-/**
- * LinphoneCallState enum represents the different state a call can reach into.
- * The application is notified of state changes through the LinphoneCoreVTable::call_state_changed callback.
- * @ingroup call_control
-**/
-typedef enum _LinphoneCallState{
- LinphoneCallIdle, /**