Introduce the call.h header file.

This commit is contained in:
Ghislain MARY 2016-12-20 16:13:49 +01:00
parent 97a73f1c60
commit 82b8f3cdd7
5 changed files with 625 additions and 605 deletions

View file

@ -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 <br>
* 3-4 = average quality <br>
* 2-3 = poor quality <br>
* 1-2 = very poor quality <br>
* 0-1 = can't be worse, mostly unusable <br>
*
* @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:

View file

@ -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

View file

@ -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 \

575
include/linphone/call.h Normal file
View file

@ -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, /**<Initial call state */
LinphoneCallIncomingReceived, /**<This is a new incoming call */
LinphoneCallOutgoingInit, /**<An outgoing call is started */
LinphoneCallOutgoingProgress, /**<An outgoing call is in progress */
LinphoneCallOutgoingRinging, /**<An outgoing call is ringing at remote end */
LinphoneCallOutgoingEarlyMedia, /**<An outgoing call is proposed early media */
LinphoneCallConnected, /**<Connected, the call is answered */
LinphoneCallStreamsRunning, /**<The media streams are established and running*/
LinphoneCallPausing, /**<The call is pausing at the initiative of local end */
LinphoneCallPaused, /**< The call is paused, remote end has accepted the pause */
LinphoneCallResuming, /**<The call is being resumed by local end*/
LinphoneCallRefered, /**<The call is being transfered to another party, resulting in a new outgoing call to follow immediately*/
LinphoneCallError, /**<The call encountered an error*/
LinphoneCallEnd, /**<The call ended normally*/
LinphoneCallPausedByRemote, /**<The call is paused by remote end*/
LinphoneCallUpdatedByRemote, /**<The call's parameters change is requested by remote end, used for example when video is added by remote */
LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
LinphoneCallUpdating, /**<A call update has been initiated by us */
LinphoneCallReleased, /**< The call object is no more retained by the core */
LinphoneCallEarlyUpdatedByRemote, /*<The call is updated by remote while not yet answered (early dialog SIP UPDATE received).*/
LinphoneCallEarlyUpdating /*<We are updating the call while not yet answered (early dialog SIP UPDATE sent)*/
} LinphoneCallState;
/**
* Enum describing type of audio route.
**/
enum _LinphoneAudioRoute {
LinphoneAudioRouteEarpiece = MSAudioRouteEarpiece,
LinphoneAudioRouteSpeaker = MSAudioRouteSpeaker
};
/**
* Enum describing type of audio route.
**/
typedef enum _LinphoneAudioRoute LinphoneAudioRoute;
/**
* The LinphoneCall object represents a call issued or received by the LinphoneCore
**/
struct _LinphoneCall;
/**
* The LinphoneCall object represents a call issued or received by the LinphoneCore
**/
typedef struct _LinphoneCall LinphoneCall;
/** Callback prototype */
typedef void (*LinphoneCallCbFunc)(LinphoneCall *call, void *user_data);
LINPHONE_PUBLIC const char *linphone_call_state_to_string(LinphoneCallState cs);
/**
* Acquire a reference to the call.
* An application that wishes to retain a pointer to call object
* must use this function to unsure the pointer remains
* valid. Once the application no more needs this pointer,
* it must call linphone_call_unref().
* @param[in] call The call.
* @return The same call.
**/
LINPHONE_PUBLIC LinphoneCall * linphone_call_ref(LinphoneCall *call);
/**
* Release reference to the call.
* @param[in] call The call.
**/
LINPHONE_PUBLIC void linphone_call_unref(LinphoneCall *call);
/**
* Retrieve the user pointer associated with the call.
* @param[in] call The call.
* @return The user pointer associated with the call.
**/
LINPHONE_PUBLIC void * linphone_call_get_user_data(const LinphoneCall *call);
/**
* Assign a user pointer to the call.
* @param[in] call The call.
* @param[in] ud The user pointer to associate with the call.
**/
LINPHONE_PUBLIC void linphone_call_set_user_data(LinphoneCall *call, void *ud);
/**
* Get the core that has created the specified call.
* @param[in] call LinphoneCall object
* @return The LinphoneCore object that has created the specified call.
*/
LINPHONE_PUBLIC LinphoneCore * linphone_call_get_core(const LinphoneCall *call);
/**
* Retrieves the call's current state.
**/
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
/**
* Tell whether a call has been asked to autoanswer
* @param[in] call LinphoneCall object
* @return A boolean value telling whether the call has been asked to autoanswer
**/
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
/**
* Returns the remote address associated to this call
**/
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
/**
* Returns the remote address associated to this call as a string.
* The result string must be freed by user using ms_free().
**/
LINPHONE_PUBLIC char * linphone_call_get_remote_address_as_string(const LinphoneCall *call);
/**
* Returns the diversion address associated to this call
**/
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_diversion_address(const LinphoneCall *call);
/**
* Returns direction of the call (incoming or outgoing).
**/
LINPHONE_PUBLIC LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
/**
* Gets the call log associated to this call.
* @param[in] call LinphoneCall object
* @return The LinphoneCallLog associated with the specified LinphoneCall
**/
LINPHONE_PUBLIC LinphoneCallLog * linphone_call_get_call_log(const LinphoneCall *call);
/**
* Gets the refer-to uri (if the call was transfered).
* @param[in] call LinphoneCall object
* @return The refer-to uri of the call (if it was transfered)
**/
LINPHONE_PUBLIC const char * linphone_call_get_refer_to(const LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
/**
* Gets 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.
* @param[in] call LinphoneCall object
* @return The transferer call if the specified call was started automatically as a result of an incoming transfer request, NULL otherwise
**/
LINPHONE_PUBLIC LinphoneCall * linphone_call_get_transferer_call(const LinphoneCall *call);
/**
* When this call has received a transfer request, returns the new call that was automatically created as a result of the transfer.
**/
LINPHONE_PUBLIC LinphoneCall * linphone_call_get_transfer_target_call(const LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC LinphoneCall * linphone_call_get_replaced_call(LinphoneCall *call);
/**
* Returns call's duration in seconds.
**/
LINPHONE_PUBLIC int linphone_call_get_duration(const LinphoneCall *call);
/**
* Returns current parameters associated to the call.
**/
LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call);
/**
* Indicate whether camera input should be sent to remote end.
**/
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
/**
* Returns TRUE if camera pictures are allowed to be sent to the remote party.
**/
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
/**
* 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).
**/
LINPHONE_PUBLIC int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
/**
* 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).
**/
LINPHONE_PUBLIC int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file);
/**
* Returns the reason for a call termination (either error or normal termination)
**/
LINPHONE_PUBLIC LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
/**
* Returns full details about call errors or termination reasons.
**/
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call);
/**
* Returns the far end's user agent description string, if available.
**/
LINPHONE_PUBLIC const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
/**
* Returns the far end's sip contact as a string, if available.
**/
LINPHONE_PUBLIC const char *linphone_call_get_remote_contact(LinphoneCall *call);
LINPHONE_PUBLIC const char * linphone_call_get_authentication_token(LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t verified);
/**
* Request remote side to send us a Video Fast Update.
**/
LINPHONE_PUBLIC void linphone_call_send_vfu_request(LinphoneCall *call);
/** @deprecated Use linphone_call_get_user_data() instead. */
#define linphone_call_get_user_pointer(call) linphone_call_get_user_data(call)
/** @deprecated Use linphone_call_set_user_data() instead. */
#define linphone_call_set_user_pointer(call, ud) linphone_call_set_user_data(call, ud)
LINPHONE_PUBLIC void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void *user_data);
/**
* 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()
**/
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call);
/**
* 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.
**/
LINPHONE_PUBLIC void linphone_call_zoom_video(LinphoneCall *call, float zoom_factor, float *cx, float *cy);
/**
* Send the specified dtmf.
*
* The dtmf is automatically played to the user.
* @param call The LinphoneCall object
* @param dtmf The dtmf name specified as a char, such as '0', '#' etc...
* @return 0 if successful, -1 on error.
**/
LINPHONE_PUBLIC int linphone_call_send_dtmf(LinphoneCall *call, char dtmf);
/**
* Send a list of dtmf.
*
* The dtmfs are automatically sent to remote, separated by some needed customizable delay.
* Sending is canceled if the call state changes to something not LinphoneCallStreamsRunning.
* @param call The LinphoneCall object
* @param dtmfs A dtmf sequence such as '123#123123'
* @return -2 if there is already a DTMF sequence, -1 if call is not ready, 0 otherwise.
**/
LINPHONE_PUBLIC int linphone_call_send_dtmfs(LinphoneCall *call, const char *dtmfs);
/**
* Stop current DTMF sequence sending.
*
* Please note that some DTMF could be already sent,
* depending on when this function call is delayed from #linphone_call_send_dtmfs. This
* function will be automatically called if call state change to anything but LinphoneCallStreamsRunning.
* @param call The LinphoneCall object
**/
LINPHONE_PUBLIC void linphone_call_cancel_dtmfs(LinphoneCall *call);
/**
* Return TRUE if this call is currently part of a conference
* @param call #LinphoneCall
* @return TRUE if part of a conference.
* @deprecated Use linphone_call_get_conference() instead.
*/
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.
*/
LINPHONE_PUBLIC LinphoneConference * linphone_call_get_conference(const LinphoneCall *call);
/**
* Change the playback output device (currently only used for blackberry)
* @param call
* @param route the wanted audio route (earpiece, speaker, ...)
**/
LINPHONE_PUBLIC void linphone_call_set_audio_route(LinphoneCall *call, LinphoneAudioRoute route);
/**
* Returns the number of stream for the given call.
* Currently there is only two (Audio, Video), but later there will be more.
* @param call
* @return 2
**/
LINPHONE_PUBLIC int linphone_call_get_stream_count(LinphoneCall *call);
/**
* Returns the type of stream for the given stream index.
* @param call
* @param stream_index
* @return the type (MSAudio, MSVideo, MSText) of the stream of given index.
**/
LINPHONE_PUBLIC MSFormatType linphone_call_get_stream_type(LinphoneCall *call, int stream_index);
/**
* Returns the meta rtp transport for the given stream index.
* @param call
* @param stream_index
* @return a pointer to the meta rtp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport * linphone_call_get_meta_rtp_transport(LinphoneCall *call, int stream_index);
/**
* Returns the meta rtcp transport for the given stream index.
* @param call
* @param stream_index
* @return a pointer to the meta rtcp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport * linphone_call_get_meta_rtcp_transport(LinphoneCall *call, int stream_index);
/**
* @}
*/
/**
* @addtogroup media_parameters
* @{
*/
/**
* Get the native window handle of the video window, casted as an unsigned long.
**/
LINPHONE_PUBLIC void * linphone_call_get_native_video_window_id(const LinphoneCall *call);
/**
* Set the native video window id where the video is to be displayed.
* For MacOS, Linux, Windows: if not set or 0 a window will be automatically created, unless the special id -1 is given.
**/
LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call, void * id);
/**
* Enables or disable echo cancellation for this call
* @param call
* @param val
**/
LINPHONE_PUBLIC void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
/**
* Returns TRUE if echo cancellation is enabled.
**/
LINPHONE_PUBLIC bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *lc);
/**
* Enables or disable echo limiter for this call
* @param call
* @param val
**/
LINPHONE_PUBLIC void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
/**
* Returns TRUE if echo limiter is enabled.
**/
LINPHONE_PUBLIC bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
/**
* @}
*/
/**
* @addtogroup call_misc
* @{
*/
/**
* Create a new chat room for messaging from a call if not already existing, else return existing one.
* No reference is given to the caller: the chat room will be deleted when the call is ended.
* @param call #LinphoneCall object
* @return #LinphoneChatRoom where messaging can take place.
*/
LINPHONE_PUBLIC struct _LinphoneChatRoom * linphone_call_get_chat_room(LinphoneCall *call);
/**
* Get the mesured playback volume level (received from remote) in dbm0.
* @param call The call.
* @return float Volume level in percentage.
*/
LINPHONE_PUBLIC float linphone_call_get_play_volume(LinphoneCall *call);
/**
* Get the mesured record volume level (sent to remote) in dbm0.
* @param call The call.
* @return float Volume level in percentage.
*/
LINPHONE_PUBLIC float linphone_call_get_record_volume(LinphoneCall *call);
/**
* Get speaker volume gain.
* If the sound backend supports it, the returned gain is equal to the gain set
* with the system mixer.
* @param call The call.
* @return Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
* In case of failure, a negative value is returned
*/
LINPHONE_PUBLIC float linphone_call_get_speaker_volume_gain(const LinphoneCall *call);
/**
* Set speaker volume gain.
* If the sound backend supports it, the new gain will synchronized with the system mixer.
* @param call The call.
* @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
*/
LINPHONE_PUBLIC void linphone_call_set_speaker_volume_gain(LinphoneCall *call, float volume);
/**
* Get microphone volume gain.
* If the sound backend supports it, the returned gain is equal to the gain set
* with the system mixer.
* @param call The call.
* @return double Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
* In case of failure, a negative value is returned
*/
LINPHONE_PUBLIC float linphone_call_get_microphone_volume_gain(const LinphoneCall *call);
/**
* Set microphone volume gain.
* If the sound backend supports it, the new gain will synchronized with the system mixer.
* @param call The call.
* @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
*/
LINPHONE_PUBLIC void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float volume);
/**
* 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 <br>
* 3-4 = average quality <br>
* 2-3 = poor quality <br>
* 1-2 = very poor quality <br>
* 0-1 = can't be worse, mostly unusable <br>
*
* @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 */

View file

@ -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, /**<Initial call state */
LinphoneCallIncomingReceived, /**<This is a new incoming call */
LinphoneCallOutgoingInit, /**<An outgoing call is started */
LinphoneCallOutgoingProgress, /**<An outgoing call is in progress */
LinphoneCallOutgoingRinging, /**<An outgoing call is ringing at remote end */
LinphoneCallOutgoingEarlyMedia, /**<An outgoing call is proposed early media */
LinphoneCallConnected, /**<Connected, the call is answered */
LinphoneCallStreamsRunning, /**<The media streams are established and running*/
LinphoneCallPausing, /**<The call is pausing at the initiative of local end */
LinphoneCallPaused, /**< The call is paused, remote end has accepted the pause */
LinphoneCallResuming, /**<The call is being resumed by local end*/
LinphoneCallRefered, /**<The call is being transfered to another party, resulting in a new outgoing call to follow immediately*/
LinphoneCallError, /**<The call encountered an error*/
LinphoneCallEnd, /**<The call ended normally*/
LinphoneCallPausedByRemote, /**<The call is paused by remote end*/
LinphoneCallUpdatedByRemote, /**<The call's parameters change is requested by remote end, used for example when video is added by remote */
LinphoneCallIncomingEarlyMedia, /**<We are proposing early media to an incoming call */
LinphoneCallUpdating, /**<A call update has been initiated by us */
LinphoneCallReleased, /**< The call object is no more retained by the core */
LinphoneCallEarlyUpdatedByRemote, /*<The call is updated by remote while not yet answered (early dialog SIP UPDATE received).*/
LinphoneCallEarlyUpdating /*<We are updating the call while not yet answered (early dialog SIP UPDATE sent)*/
} LinphoneCallState;
LINPHONE_PUBLIC const char *linphone_call_state_to_string(LinphoneCallState cs);
/**
* Acquire a reference to the call.
* An application that wishes to retain a pointer to call object
* must use this function to unsure the pointer remains
* valid. Once the application no more needs this pointer,
* it must call linphone_call_unref().
* @param[in] call The call.
* @return The same call.
* @ingroup call_control
**/
LINPHONE_PUBLIC LinphoneCall *linphone_call_ref(LinphoneCall *call);
/**
* Release reference to the call.
* @param[in] call The call.
* @ingroup call_control
**/
LINPHONE_PUBLIC void linphone_call_unref(LinphoneCall *call);
/**
* Retrieve the user pointer associated with the call.
* @param[in] call The call.
* @return The user pointer associated with the call.
* @ingroup call_control
**/
LINPHONE_PUBLIC void *linphone_call_get_user_data(const LinphoneCall *call);
/**
* Assign a user pointer to the call.
* @param[in] call The call.
* @param[in] ud The user pointer to associate with the call.
* @ingroup call_control
**/
LINPHONE_PUBLIC void linphone_call_set_user_data(LinphoneCall *call, void *ud);
/**
* Get the core that has created the specified call.
* @param[in] call LinphoneCall object
* @return The LinphoneCore object that has created the specified call.
* @ingroup call_control
*/
LINPHONE_PUBLIC LinphoneCore *linphone_call_get_core(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_state(const LinphoneCall *call);
/**
* Tell whether a call has been asked to autoanswer
* @param[in] call LinphoneCall object
* @return A boolean value telling whether the call has been asked to autoanswer
**/
LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
/**
* Get the remote address of the current call.
* @param[in] lc LinphoneCore object.
@ -611,265 +516,6 @@ LINPHONE_PUBLIC bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
*/
LINPHONE_PUBLIC const LinphoneAddress * linphone_core_get_current_call_remote_address(LinphoneCore *lc);
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
LINPHONE_PUBLIC char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneAddress * linphone_call_get_diversion_address(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
LINPHONE_PUBLIC const char *linphone_call_get_refer_to(const LinphoneCall *call);
LINPHONE_PUBLIC bool_t linphone_call_has_transfer_pending(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCall *linphone_call_get_transferer_call(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCall *linphone_call_get_transfer_target_call(const LinphoneCall *call);
LINPHONE_PUBLIC LinphoneCall *linphone_call_get_replaced_call(LinphoneCall *call);
LINPHONE_PUBLIC int linphone_call_get_duration(const LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneCallParams * linphone_call_get_remote_params(LinphoneCall *call);
LINPHONE_PUBLIC void linphone_call_enable_camera(LinphoneCall *lc, bool_t enabled);
LINPHONE_PUBLIC bool_t linphone_call_camera_enabled(const LinphoneCall *lc);
LINPHONE_PUBLIC int linphone_call_take_video_snapshot(LinphoneCall *call, const char *file);
LINPHONE_PUBLIC int linphone_call_take_preview_snapshot(LinphoneCall *call, const char *file);
LINPHONE_PUBLIC LinphoneReason linphone_call_get_reason(const LinphoneCall *call);
LINPHONE_PUBLIC const LinphoneErrorInfo *linphone_call_get_error_info(const LinphoneCall *call);
LINPHONE_PUBLIC const char *linphone_call_get_remote_user_agent(LinphoneCall *call);
LINPHONE_PUBLIC const char *linphone_call_get_remote_contact(LinphoneCall *call);
/**
* Get the mesured playback volume level.
*
* @param call The call.
* @return float Volume level in percentage.
*/
LINPHONE_PUBLIC float linphone_call_get_play_volume(LinphoneCall *call);
/**
* Get the mesured record volume level
*
* @param call The call.
* @return float Volume level in percentage.
*/
LINPHONE_PUBLIC float linphone_call_get_record_volume(LinphoneCall *call);
/**
* Create a new chat room for messaging from a call if not already existing, else return existing one.
* No reference is given to the caller: the chat room will be deleted when the call is ended.
* @param call #LinphoneCall object
* @return #LinphoneChatRoom where messaging can take place.
*/
LINPHONE_PUBLIC struct _LinphoneChatRoom * linphone_call_get_chat_room(LinphoneCall *call);
/**
* Get speaker volume gain.
* If the sound backend supports it, the returned gain is equal to the gain set
* with the system mixer.
*
* @param call The call.
* @return Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
* In case of failure, a negative value is returned
*/
LINPHONE_PUBLIC float linphone_call_get_speaker_volume_gain(const LinphoneCall *call);
/**
* Set speaker volume gain.
* If the sound backend supports it, the new gain will synchronized with the system mixer.
*
* @param call The call.
* @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
*/
LINPHONE_PUBLIC void linphone_call_set_speaker_volume_gain(LinphoneCall *call, float volume);
/**
* Get microphone volume gain.
* If the sound backend supports it, the returned gain is equal to the gain set
* with the system mixer.
*
* @param call The call.
* @return double Percenatge of the max supported volume gain. Valid values are in [ 0.0 : 1.0 ].
* In case of failure, a negative value is returned
*/
LINPHONE_PUBLIC float linphone_call_get_microphone_volume_gain(const LinphoneCall *call);
/**
* Set microphone volume gain.
* If the sound backend supports it, the new gain will synchronized with the system mixer.
*
* @param call The call.
* @param volume Percentage of the max supported gain. Valid values are in [ 0.0 : 1.0 ].
*/
LINPHONE_PUBLIC void linphone_call_set_microphone_volume_gain(LinphoneCall *call, float volume);
LINPHONE_PUBLIC float linphone_call_get_current_quality(LinphoneCall *call);
LINPHONE_PUBLIC float linphone_call_get_average_quality(LinphoneCall *call);
LINPHONE_PUBLIC const char* linphone_call_get_authentication_token(LinphoneCall *call);
LINPHONE_PUBLIC bool_t linphone_call_get_authentication_token_verified(LinphoneCall *call);
LINPHONE_PUBLIC void linphone_call_set_authentication_token_verified(LinphoneCall *call, bool_t verified);
LINPHONE_PUBLIC void linphone_call_send_vfu_request(LinphoneCall *call);
/** @deprecated Use linphone_call_get_user_data() instead. */
#define linphone_call_get_user_pointer(call) linphone_call_get_user_data(call)
/** @deprecated Use linphone_call_set_user_data() instead. */
#define linphone_call_set_user_pointer(call, ud) linphone_call_set_user_data(call, ud)
LINPHONE_PUBLIC void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, LinphoneCallCbFunc cb, void* user_data);
LINPHONE_PUBLIC LinphoneCallState linphone_call_get_transfer_state(LinphoneCall *call);
LINPHONE_PUBLIC void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy);
LINPHONE_PUBLIC void linphone_call_start_recording(LinphoneCall *call);
LINPHONE_PUBLIC void linphone_call_stop_recording(LinphoneCall *call);
LINPHONE_PUBLIC LinphonePlayer * linphone_call_get_player(LinphoneCall *call);
LINPHONE_PUBLIC bool_t linphone_call_media_in_progress(LinphoneCall *call);
/**
* Send the specified dtmf.
*
* The dtmf is automatically played to the user.
* @param call The LinphoneCall object
* @param dtmf The dtmf name specified as a char, such as '0', '#' etc...
* @return 0 if successful, -1 on error.
* @ingroup call_control
**/
LINPHONE_PUBLIC int linphone_call_send_dtmf(LinphoneCall *call,char dtmf);
/**
* Send a list of dtmf.
*
* The dtmfs are automatically sent to remote, separated by some needed customizable delay.
* Sending is canceled if the call state changes to something not LinphoneCallStreamsRunning.
* @param call The LinphoneCall object
* @param dtmfs A dtmf sequence such as '123#123123'
* @return -2 if there is already a DTMF sequence, -1 if call is not ready, 0 otherwise.
* @ingroup call_control
**/
LINPHONE_PUBLIC int linphone_call_send_dtmfs(LinphoneCall *call,const char *dtmfs);
/**
* Stop current DTMF sequence sending.
*
* Please note that some DTMF could be already sent,
* depending on when this function call is delayed from #linphone_call_send_dtmfs. This
* function will be automatically called if call state change to anything but LinphoneCallStreamsRunning.
*
* @param call The LinphoneCall object
* @ingroup call_control
**/
LINPHONE_PUBLIC void linphone_call_cancel_dtmfs(LinphoneCall *call);
/**
* Get the native window handle of the video window, casted as an unsigned long.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC void * linphone_call_get_native_video_window_id(const LinphoneCall *call);
/**
* Set the native video window id where the video is to be displayed.
* For MacOS, Linux, Windows: if not set or 0 a window will be automatically created, unless the special id -1 is given.
* @ingroup media_parameters
**/
LINPHONE_PUBLIC void linphone_call_set_native_video_window_id(LinphoneCall *call, void * id);
/**
* Return TRUE if this call is currently part of a conference
* @param call #LinphoneCall
* @return TRUE if part of a conference.
*
* @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
* @param val
*
* @ingroup media_parameters
**/
LINPHONE_PUBLIC void linphone_call_enable_echo_cancellation(LinphoneCall *call, bool_t val) ;
/**
* Returns TRUE if echo cancellation is enabled.
*
* @ingroup media_parameters
**/
LINPHONE_PUBLIC bool_t linphone_call_echo_cancellation_enabled(LinphoneCall *lc);
/**
* Enables or disable echo limiter for this call
* @param call
* @param val
*
* @ingroup media_parameters
**/
LINPHONE_PUBLIC void linphone_call_enable_echo_limiter(LinphoneCall *call, bool_t val);
/**
* Returns TRUE if echo limiter is enabled.
*
* @ingroup media_parameters
**/
LINPHONE_PUBLIC bool_t linphone_call_echo_limiter_enabled(const LinphoneCall *call);
/**
* Enum describing type of audio route.
* @ingroup call_control
**/
enum _LinphoneAudioRoute {
LinphoneAudioRouteEarpiece = MSAudioRouteEarpiece,
LinphoneAudioRouteSpeaker = MSAudioRouteSpeaker
};
/**
* Enum describing type of audio route.
* @ingroup call_control
**/
typedef enum _LinphoneAudioRoute LinphoneAudioRoute;
/**
* Change the playback output device (currently only used for blackberry)
* @param call
* @param route the wanted audio route (earpiece, speaker, ...)
*
* @ingroup call_control
**/
LINPHONE_PUBLIC void linphone_call_set_audio_route(LinphoneCall *call, LinphoneAudioRoute route);
/**
* Returns the number of stream for the given call.
* Currently there is only two (Audio, Video), but later there will be more.
* @param call
*
* @return 2
**/
LINPHONE_PUBLIC int linphone_call_get_stream_count(LinphoneCall *call);
/**
* Returns the type of stream for the given stream index.
* @param call
* @param stream_index
*
* @return the type (MSAudio, MSVideo, MSText) of the stream of given index.
**/
LINPHONE_PUBLIC MSFormatType linphone_call_get_stream_type(LinphoneCall *call, int stream_index);
/**
* Returns the meta rtp transport for the given stream index.
* @param call
* @param stream_index
*
* @return a pointer to the meta rtp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport* linphone_call_get_meta_rtp_transport(LinphoneCall *call, int stream_index);
/**
* Returns the meta rtcp transport for the given stream index.
* @param call
* @param stream_index
*
* @return a pointer to the meta rtcp transport if it exists, NULL otherwise
**/
LINPHONE_PUBLIC RtpTransport* linphone_call_get_meta_rtcp_transport(LinphoneCall *call, int stream_index);
/*keep this in sync with mediastreamer2/msvolume.h*/