Update coreapi to improve Android app

parent 0ce2d7cd
/*
linphone
Copyright (C) 2010 Belledonne Communications SARL
Copyright (C) 2010 Belledonne Communications SARL
(simon.morlat@linphone.org)
This program is free software; you can redistribute it and/or
......@@ -165,14 +165,14 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
LinphoneAddress *addr=linphone_address_new(me);
const char *username=linphone_address_get_username (addr);
SalMediaDescription *md=sal_media_description_new();
md->session_id=session_id;
md->session_ver=session_ver;
md->nstreams=1;
strncpy(md->addr,call->localip,sizeof(md->addr));
strncpy(md->username,username,sizeof(md->username));
md->bandwidth=linphone_core_get_download_bandwidth(lc);
/*set audio capabilities */
strncpy(md->streams[0].addr,call->localip,sizeof(md->streams[0].addr));
md->streams[0].port=call->audio_port;
......@@ -183,7 +183,7 @@ static SalMediaDescription *_create_local_media_description(LinphoneCore *lc, Li
pt=payload_type_clone(rtp_profile_get_payload_from_mime(&av_profile,"telephone-event"));
l=ms_list_append(l,pt);
md->streams[0].payloads=l;
if (call->params.has_video){
md->nstreams++;
......@@ -250,7 +250,7 @@ static void linphone_call_init_common(LinphoneCall *call, LinphoneAddress *from,
if (port_offset==-1) return;
call->audio_port=linphone_core_get_audio_port(call->core)+port_offset;
call->video_port=linphone_core_get_video_port(call->core)+port_offset;
}
static void discover_mtu(LinphoneCore *lc, const char *remote){
......@@ -306,7 +306,7 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
sal_ping(call->ping_op,linphone_core_find_best_identity(lc,from,NULL),from_str);
ms_free(from_str);
}
linphone_address_clean(from);
linphone_core_get_local_ip(lc,linphone_address_get_domain(from),call->localip);
linphone_call_init_common(call, from, to);
......@@ -327,13 +327,13 @@ LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *fro
static void linphone_call_set_terminated(LinphoneCall *call){
LinphoneCore *lc=call->core;
linphone_core_update_allocated_audio_bandwidth(lc);
call->owns_call_log=FALSE;
linphone_call_log_completed(call);
if (call == lc->current_call){
ms_message("Resetting the current call");
lc->current_call=NULL;
......@@ -342,10 +342,10 @@ static void linphone_call_set_terminated(LinphoneCall *call){
if (linphone_core_del_call(lc,call) != 0){
ms_error("Could not remove the call from the list !!!");
}
if (ms_list_size(lc->calls)==0)
linphone_core_notify_all_friends(lc,lc->presence_mode);
}
const char *linphone_call_state_to_string(LinphoneCallState cs){
......@@ -419,7 +419,7 @@ void linphone_call_set_state(LinphoneCall *call, LinphoneCallState cstate, const
if (cstate == LinphoneCallConnected) {
call->log->status=LinphoneCallSuccess;
}
if (lc->vtable.call_state_changed)
lc->vtable.call_state_changed(lc,call,cstate,message);
if (cstate==LinphoneCallReleased){
......@@ -588,7 +588,7 @@ const char *linphone_call_get_remote_user_agent(LinphoneCall *call){
* 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
* 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){
......@@ -746,7 +746,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){
LinphoneCore *lc=call->core;
SalMediaDescription *md=call->localdesc;
AudioStream *audiostream;
call->audiostream=audiostream=audio_stream_new(md->streams[0].port,linphone_core_ipv6_enabled(lc));
if (linphone_core_echo_limiter_enabled(lc)){
const char *type=lp_config_get_string(lc->config,"sound","el_type","mic");
......@@ -772,7 +772,7 @@ void linphone_call_init_media_streams(LinphoneCall *call){
int enabled=lp_config_get_int(lc->config,"sound","noisegate",0);
audio_stream_enable_noise_gate(audiostream,enabled);
}
if (lc->a_rtp)
rtp_session_set_transports(audiostream->session,lc->a_rtp,lc->a_rtcp);
......@@ -844,10 +844,10 @@ static void post_configure_audio_streams(LinphoneCall*call){
float ng_thres=lp_config_get_float(lc->config,"sound","ng_thres",0.05);
float ng_floorgain=lp_config_get_float(lc->config,"sound","ng_floorgain",0);
int dc_removal=lp_config_get_int(lc->config,"sound","dc_removal",0);
if (!call->audio_muted)
audio_stream_set_mic_gain(st,mic_gain);
else
else
audio_stream_set_mic_gain(st,0);
recv_gain = lc->sound_conf.soft_play_lev;
......@@ -900,11 +900,11 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
LinphoneCore *lc=call->core;
int up_ptime=0;
*used_pt=-1;
for(elem=desc->payloads;elem!=NULL;elem=elem->next){
PayloadType *pt=(PayloadType*)elem->data;
int number;
if ((pt->flags & PAYLOAD_TYPE_FLAG_CAN_SEND) && first) {
if (desc->type==SalAudio){
linphone_core_update_allocated_audio_bandwidth_in_call(call,pt);
......@@ -921,8 +921,8 @@ static RtpProfile *make_profile(LinphoneCall *call, const SalMediaDescription *m
remote_bw=get_video_bandwidth(remote_bw,call->audio_bw);
}
}
if (desc->type==SalAudio){
if (desc->type==SalAudio){
bw=get_min_bandwidth(call->audio_bw,remote_bw);
}else bw=get_min_bandwidth(get_video_bandwidth(linphone_core_get_upload_bandwidth (lc),call->audio_bw),remote_bw);
if (bw>0) pt->normal_bitrate=bw*1000;
......@@ -965,7 +965,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
SalProtoRtpAvp,SalVideo);
#endif
bool_t use_arc=linphone_core_adaptive_rate_control_enabled(lc);
if(call->audiostream == NULL)
{
ms_fatal("start_media_stream() called without prior init !");
......@@ -982,7 +982,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalAudio);
if (stream && stream->dir!=SalStreamInactive && stream->port!=0){
MSSndCard *playcard=lc->sound_conf.lsd_card ?
MSSndCard *playcard=lc->sound_conf.lsd_card ?
lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
MSSndCard *captcard=lc->sound_conf.capt_sndcard;
const char *playfile=lc->play_file;
......@@ -1061,7 +1061,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
}
#ifdef VIDEO_ENABLED
{
used_pt=-1;
/* shutdown preview */
if (lc->previewstream!=NULL) {
......@@ -1078,7 +1078,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
bool_t is_inactive=FALSE;
call->current_params.has_video=TRUE;
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
video_stream_enable_self_view(call->videostream,lc->video_conf.selfview);
if (lc->video_window_id!=0)
......@@ -1086,7 +1086,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
if (lc->preview_window_id!=0)
video_stream_set_native_preview_window_id (call->videostream,lc->preview_window_id);
video_stream_use_preview_video_window (call->videostream,lc->use_preview_window);
if (vstream->dir==SalStreamSendOnly && lc->video_conf.capture ){
cam=get_nowebcam_device();
dir=VideoStreamSendOnly;
......@@ -1109,6 +1109,8 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
}
if (!is_inactive){
video_stream_set_direction (call->videostream, dir);
ms_message("%s lc rotation:%d\n", __FUNCTION__, lc->device_rotation);
video_stream_set_device_rotation(call->videostream, lc->device_rotation);
video_stream_start(call->videostream,
call->video_profile, addr, vstream->port,
vstream->port+1,
......@@ -1124,7 +1126,7 @@ void linphone_call_start_media_streams(LinphoneCall *call, bool_t all_inputs_mut
call->all_muted=all_inputs_muted;
call->playing_ringbacktone=send_ringbacktone;
call->up_bw=linphone_core_get_upload_bandwidth(lc);
if (ortp_zrtp_available()) {
OrtpZrtpParams params;
params.zid=get_hexa_zrtp_identifier(lc);
......@@ -1172,7 +1174,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
call->videostream=NULL;
}
ms_event_queue_skip(call->core->msevq);
#endif
if (call->audio_profile){
rtp_profile_clear_all(call->audio_profile);
......@@ -1229,11 +1231,11 @@ 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.
* It is expressed in dbm0.
**/
float linphone_call_get_play_volume(LinphoneCall *call){
AudioStream *st=call->audiostream;
......@@ -1241,14 +1243,14 @@ float linphone_call_get_play_volume(LinphoneCall *call){
float vol=0;
ms_filter_call_method(st->volsend,MS_VOLUME_GET,&vol);
return vol;
}
return LINPHONE_VOLUME_DB_LOWEST;
}
/**
* Returns the measured sound volume recorded locally (sent to remote)
* It is expressed in dbm0.
* It is expressed in dbm0.
**/
float linphone_call_get_record_volume(LinphoneCall *call){
AudioStream *st=call->audiostream;
......@@ -1256,7 +1258,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){
float vol=0;
ms_filter_call_method(st->volrecv,MS_VOLUME_GET,&vol);
return vol;
}
return LINPHONE_VOLUME_DB_LOWEST;
}
......@@ -1275,7 +1277,7 @@ float linphone_call_get_record_volume(LinphoneCall *call){
* 1-2 = very poor quality <br>
* 0-1 = can't be worse, mostly unusable <br>
*
* @returns The function returns -1 if no quality measurement is available, for example if no
* @returns 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){
......@@ -1318,7 +1320,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
{
snprintf(temp,sizeof(temp),"Remote end %s seems to have disconnected, the call is going to be closed.",from);
free(from);
}
}
else
{
snprintf(temp,sizeof(temp),"Remote end seems to have disconnected, the call is going to be closed.");
......@@ -1331,7 +1333,7 @@ static void linphone_core_disconnected(LinphoneCore *lc, LinphoneCall *call){
void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapsed){
int disconnect_timeout = linphone_core_get_nortp_timeout(call->core);
bool_t disconnected=FALSE;
if (call->state==LinphoneCallStreamsRunning && one_second_elapsed){
RtpSession *as=NULL,*vs=NULL;
float audio_load=0, video_load=0;
......@@ -1395,9 +1397,9 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
void linphone_call_log_completed(LinphoneCall *call){
LinphoneCore *lc=call->core;
call->log->duration=time(NULL)-call->start_time;
if (call->log->status==LinphoneCallMissed){
char *info;
lc->missed_calls++;
......@@ -1424,5 +1426,3 @@ void linphone_call_log_completed(LinphoneCall *call){
}
call_logs_write_to_config_file(lc);
}
......@@ -67,7 +67,7 @@ int lc_callback_obj_invoke(LCCallbackObj *obj, LinphoneCore *lc){
return 0;
}
/*prevent a gcc bug with %c*/
static size_t my_strftime(char *s, size_t max, const char *fmt, const struct tm *tm){
#if !defined(_WIN32_WCE)
......@@ -109,7 +109,7 @@ void call_logs_write_to_config_file(LinphoneCore *lc){
LpConfig *cfg=lc->config;
if (linphone_core_get_global_state (lc)==LinphoneGlobalStartup) return;
for(i=0,elem=lc->call_logs;elem!=NULL;elem=elem->next,++i){
LinphoneCallLog *cl=(LinphoneCallLog*)elem->data;
snprintf(logsection,sizeof(logsection),"call_log_%i",i);
......@@ -154,7 +154,7 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){
if (tmp) cl->refkey=ms_strdup(tmp);
cl->quality=lp_config_get_float(cfg,logsection,"quality",-1);
lc->call_logs=ms_list_append(lc->call_logs,cl);
}else break;
}else break;
}
}
......@@ -167,7 +167,7 @@ static void call_logs_read_from_config_file(LinphoneCore *lc){
/**
* Returns a human readable string describing the call.
*
*
* @note: the returned char* must be freed by the application (use ms_free()).
**/
char * linphone_call_log_to_str(LinphoneCallLog *cl){
......@@ -203,7 +203,7 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl){
/**
* Returns RTP statistics computed locally regarding the call.
*
*
**/
const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl){
return &cl->local_stats;
......@@ -293,7 +293,7 @@ const LinphoneAddress *linphone_core_get_current_call_remote_address(struct _Lin
* @ingroup misc
*
* @param file a C FILE* where to fprintf logs. If null stdout is used.
*
*
**/
void linphone_core_enable_logs(FILE *file){
if (file==NULL) file=stdout;
......@@ -308,7 +308,7 @@ void linphone_core_enable_logs(FILE *file){
*
* @param logfunc The address of a OrtpLogFunc callback whose protoype is
* typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args);
*
*
**/
void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){
ortp_set_log_level_mask(ORTP_MESSAGE|ORTP_WARNING|ORTP_ERROR|ORTP_FATAL);
......@@ -433,7 +433,7 @@ static void sound_config_read(LinphoneCore *lc)
lc->sound_conf.latency=0;
#if !defined(TARGET_OS_IPHONE) && !defined(ANDROID)
tmp=TRUE;
#else
#else
tmp=FALSE;
#endif
tmp=lp_config_get_int(lc->config,"sound","echocancellation",tmp);
......@@ -546,7 +546,7 @@ static void sip_config_read(LinphoneCore *lc)
break;
}
}
/*for tuning or test*/
lc->sip_conf.sdp_200_ack=lp_config_get_int(lc->config,"sip","sdp_200_ack",0);
lc->sip_conf.register_only_when_network_is_up=
......@@ -581,7 +581,7 @@ static void rtp_config_read(LinphoneCore *lc)
nortp_timeout=lp_config_get_int(lc->config,"rtp","nortp_timeout",30);
linphone_core_set_nortp_timeout(lc,nortp_timeout);
rtp_no_xmit_on_audio_mute=lp_config_get_int(lc->config,"rtp","rtp_no_xmit_on_audio_mute",FALSE);
linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_no_xmit_on_audio_mute);
linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_no_xmit_on_audio_mute);
}
static PayloadType * find_payload(RtpProfile *prof, const char *mime_type, int clock_rate, const char *recv_fmtp){
......@@ -673,7 +673,7 @@ static MSList *add_missing_codecs(SalStreamType mtype, MSList *l){
if (pt){
if (mtype==SalVideo && pt->type!=PAYLOAD_VIDEO)
pt=NULL;
else if (mtype==SalAudio && (pt->type!=PAYLOAD_AUDIO_PACKETIZED
else if (mtype==SalAudio && (pt->type!=PAYLOAD_AUDIO_PACKETIZED
&& pt->type!=PAYLOAD_AUDIO_CONTINUOUS)){
pt=NULL;
}
......@@ -963,13 +963,13 @@ static void misc_config_read (LinphoneCore *lc) {
lc->max_call_logs=lp_config_get_int(config,"misc","history_max_size",15);
}
static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path,
static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vtable, const char *config_path,
const char *factory_config_path, void * userdata)
{
memset (lc, 0, sizeof (LinphoneCore));
lc->data=userdata;
lc->ringstream_autorelease=TRUE;
memcpy(&lc->vtable,vtable,sizeof(LinphoneCoreVTable));
linphone_core_set_state(lc,LinphoneGlobalStartup,"Starting up");
......@@ -1041,7 +1041,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
lc->sal=sal_init();
sal_set_user_pointer(lc->sal,lc);
sal_set_callbacks(lc->sal,&linphone_sal_callbacks);
sip_setup_register_all();
sound_config_read(lc);
net_config_read(lc);
......@@ -1062,7 +1062,7 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
/**
* Instanciates a LinphoneCore object.
* @ingroup initializing
*
*
* The LinphoneCore object is the primary handle for doing all phone actions.
* It should be unique within your application.
* @param vtable a LinphoneCoreVTable structure holding your application callbacks
......@@ -1070,13 +1070,13 @@ static void linphone_core_init (LinphoneCore * lc, const LinphoneCoreVTable *vta
* The config file is used to store all settings, call logs, friends, proxies... so that all these settings
* become persistent over the life of the LinphoneCore object.
* It is allowed to set a NULL config file. In that case LinphoneCore will not store any settings.
* @param factory_config_path a path to a read-only config file that can be used to
* @param factory_config_path a path to a read-only config file that can be used to
* to store hard-coded preference such as proxy settings or internal preferences.
* The settings in this factory file always override the one in the normal config file.
* It is OPTIONAL, use NULL if unneeded.
* @param userdata an opaque user pointer that can be retrieved at any time (for example in
* callbacks) using linphone_core_get_user_data().
*
*
**/
LinphoneCore *linphone_core_new(const LinphoneCoreVTable *vtable,
const char *config_path, const char *factory_config_path, void * userdata)
......@@ -1185,7 +1185,7 @@ static void update_primary_contact(LinphoneCore *lc){
**/
const char *linphone_core_get_primary_contact(LinphoneCore *lc){
char *identity;
if (lc->sip_conf.guess_hostname){
if (lc->sip_conf.guessed_contact==NULL || lc->sip_conf.loopback_only){
update_primary_contact(lc);
......@@ -1340,7 +1340,7 @@ void linphone_core_set_video_port(LinphoneCore *lc, int port){
/**
* Sets the no-rtp timeout value in seconds.
*
*
* @ingroup media_parameters
* See linphone_core_get_nortp_timeout() for details.
**/
......@@ -1485,11 +1485,11 @@ static int apply_transports(LinphoneCore *lc){
* @ingroup network_parameters
**/
int linphone_core_set_sip_transports(LinphoneCore *lc, const LCSipTransports * tr){
if (transports_unchanged(tr,&lc->sip_conf.transports))
return 0;
memcpy(&lc->sip_conf.transports,tr,sizeof(*tr));
if (lc->sal==NULL) return 0;
return apply_transports(lc);
}
......@@ -1704,7 +1704,7 @@ void linphone_core_iterate(LinphoneCore *lc){
lc_callback_obj_invoke(&lc->preview_finished_cb,lc);
}
if (lc->ringstream && lc->ringstream_autorelease && lc->dmfs_playing_start_time!=0
if (lc->ringstream && lc->ringstream_autorelease && lc->dmfs_playing_start_time!=0
&& (curtime-lc->dmfs_playing_start_time)>5){
ring_stop(lc->ringstream);
lc->ringstream=NULL;
......@@ -1776,7 +1776,7 @@ void linphone_core_iterate(LinphoneCore *lc){
* configuration, eventually escape the '+' by 00.
* - if no domain part is supplied, append the domain name of the default proxy
* - if no sip: is present, prepend it
*
*
* The result is a syntaxically correct SIP address.
**/
......@@ -1786,7 +1786,7 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
LinphoneProxyConfig *proxy=lc->default_proxy;;
char *tmpurl;
LinphoneAddress *uri;
if (is_enum(url,&enum_domain)){
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Looking for telephone number destination..."));
......@@ -1814,7 +1814,7 @@ LinphoneAddress * linphone_core_interpret_url(LinphoneCore *lc, const char *url)
return uri;
}
}
if (proxy!=NULL){
/* append the proxy domain suffix */
const char *identity=linphone_proxy_config_get_identity(proxy);
......@@ -1940,9 +1940,9 @@ static char *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call , LinphonePr
return ms_strdup(fixed_contact);
}
}
ctt=linphone_core_get_primary_contact_parsed(lc);
if (ctt!=NULL){
char *ret;
/*otherwise use supllied localip*/
......@@ -1961,17 +1961,17 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro
char *contact;
char *real_url,*barmsg;
char *from;
/*try to be best-effort in giving real local or routable contact address */
contact=get_fixed_contact(lc,call,dest_proxy);
if (contact){
sal_op_set_contact(call->op, contact);
ms_free(contact);
}
//TODO : should probably not be done here
linphone_call_init_media_streams(call);
if (!lc->sip_conf.sdp_200_ack){
if (!lc->sip_conf.sdp_200_ack){
call->media_pending=TRUE;
sal_call_set_local_media_description(call->op,call->localdesc);
}
......@@ -1987,7 +1987,7 @@ int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphonePro
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,barmsg);
ms_free(barmsg);
if (err<0){
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Could not call"));
......@@ -2052,7 +2052,7 @@ LinphoneCall * linphone_core_invite_with_params(LinphoneCore *lc, const char *ur
* @ingroup call_control
* @param lc the LinphoneCore object
* @param addr the destination of the call (sip address).
*
*
* The LinphoneAddress can be constructed directly using linphone_address_new(), or
* created by linphone_core_interpret_url().
* The application doesn't own a reference to the returned LinphoneCall object.
......@@ -2076,7 +2076,7 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
* @param lc the LinphoneCore object
* @param addr the destination of the call (sip address).
@param params call parameters
*
*
* The LinphoneAddress can be constructed directly using linphone_address_new(), or
* created by linphone_core_interpret_url().
* The application doesn't own a reference to the returned LinphoneCall object.
......@@ -2093,7 +2093,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
char *real_url=NULL;
LinphoneProxyConfig *dest_proxy=NULL;
LinphoneCall *call;
if (linphone_core_in_call(lc)){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call first !"));
......@@ -2106,7 +2106,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
}
linphone_core_get_default_proxy(lc,&proxy);
route=linphone_core_get_route(lc);
real_url=linphone_address_as_string(addr);
dest_proxy=linphone_core_lookup_known_proxy(lc,addr);
......@@ -2127,7 +2127,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
call=linphone_call_new_outgoing(lc,parsed_url2,linphone_address_clone(addr),params);
sal_op_set_route(call->op,route);
if(linphone_core_add_call(lc,call)!= 0)
{
ms_warning("we had a problem in adding the call into the invite ... weird");
......@@ -2146,7 +2146,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
sal_op_set_user_pointer(call->ping_op,call);
call->start_time=time(NULL);
}
if (real_url!=NULL) ms_free(real_url);
return call;
}
......@@ -2250,7 +2250,7 @@ int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const Linpho
* this method.
* @param lc the LinphoneCore object
* @param call the LinphoneCall object representing the call to be answered.
*
*
**/
int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
{
......@@ -2258,7 +2258,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
const char *contact=NULL;
SalOp *replaced;
SalMediaDescription *new_md;
if (call==NULL){
//if just one call is present answer the only one ...
if(linphone_core_get_calls_nb (lc) != 1)
......@@ -2271,7 +2271,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
/*call already accepted*/
return -1;
}
/* check if this call is supposed to replace an already running one*/
replaced=sal_call_get_replaces(call->op);
if (replaced){
......@@ -2287,7 +2287,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
ms_warning("Cannot accept this call, there is already one running.");
return -1;
}
/*can accept a new call only if others are on hold */
{
MSList *elem;
......@@ -2307,7 +2307,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
ms_message("ring stopped");
lc->ringstream=NULL;
}
linphone_core_get_default_proxy(lc,&cfg);
dest_proxy=cfg;
dest_proxy=linphone_core_lookup_known_proxy(lc,call->log->to);
......@@ -2323,7 +2323,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
if (call->audiostream==NULL)
linphone_call_init_media_streams(call);
sal_call_accept(call->op);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Connected."));
......@@ -2334,7 +2334,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
if (new_md){
linphone_call_set_state(call,LinphoneCallStreamsRunning,"Connected (streams running)");
}else call->media_pending=TRUE;
ms_message("call answered.");
return 0;
}
......@@ -2407,7 +2407,7 @@ int linphone_core_terminate_call(LinphoneCore *lc, LinphoneCall *the_call)
}
sal_call_terminate(call->op);
terminate_call(lc,call);
linphone_call_set_state(call,LinphoneCallEnd,"Call terminated");
return 0;
}
......@@ -2524,7 +2524,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
{
char temp[255]={0};
LinphoneCall *call = the_call;
if(call->state!=LinphoneCallPaused ){
ms_warning("we cannot resume a call that has not been established and paused before");
return -1;
......@@ -2542,7 +2542,7 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
}
linphone_call_set_state (call,LinphoneCallResuming,"Resuming");
snprintf(temp,sizeof(temp)-1,"Resuming the call with %s",linphone_call_get_remote_address_as_string(call));
if (lc->vtable.display_status)
if (lc->vtable.display_status)
lc->vtable.display_status(lc,temp);
return 0;
}
......@@ -2580,7 +2580,7 @@ int linphone_core_send_publish(LinphoneCore *lc,
* Set the incoming call timeout in seconds.
*
* @ingroup call_control
* If an incoming call isn't answered for this timeout period, it is
* If an incoming call isn't answered for this timeout period, it is
* automatically declined.
**/
void linphone_core_set_inc_timeout(LinphoneCore *lc, int seconds){
......@@ -2602,7 +2602,7 @@ void linphone_core_set_presence_info(LinphoneCore *lc,int minutes_away,
LinphoneOnlineStatus presence_mode)
{
if (minutes_away>0) lc->minutes_away=minutes_away;
if (lc->alt_contact!=NULL) {
ms_free(lc->alt_contact);
lc->alt_contact=NULL;
......@@ -3031,7 +3031,7 @@ void linphone_core_mute_mic(LinphoneCore *lc, bool_t val){
}
if (call->audiostream!=NULL){
audio_stream_set_mic_gain(call->audiostream,
(val==TRUE) ? 0 : lp_config_get_float(lc->config,"sound","mic_gain",1));
(val==TRUE) ? 0 : lp_config_get_float(lc->config,"sound","mic_gain",1));
if ( linphone_core_get_rtp_no_xmit_on_audio_mute(lc) ){
audio_stream_mute_rtp(call->audiostream,val);
}
......@@ -3049,7 +3049,7 @@ bool_t linphone_core_is_mic_muted(LinphoneCore *lc) {
}
// returns rtp transmission status for an active stream
// if audio is muted and config parameter rtp_no_xmit_on_audio_mute
// if audio is muted and config parameter rtp_no_xmit_on_audio_mute
// was set on then rtp transmission is also muted
bool_t linphone_core_is_rtp_muted(LinphoneCore *lc){
LinphoneCall *call=linphone_core_get_current_call(lc);
......@@ -3161,8 +3161,8 @@ const char *linphone_core_get_nat_address_resolved(LinphoneCore *lc)
ipstring, sizeof(ipstring), NULL, 0, NI_NUMERICHOST);
if (error) {
return lc->net_conf.nat_address;
}
}
if (lc->net_conf.nat_address_ip!=NULL){
ms_free(lc->net_conf.nat_address_ip);
}
......@@ -3390,7 +3390,7 @@ int linphone_core_set_static_picture_fps(LinphoneCore *lc, float fps) {
VideoStream *vs = NULL;
vs=get_active_video_stream(lc);
/* If we have a video stream (either preview, either from call), we
have a source and it is using the static picture filter, then
force the filter to use that picture. */
......@@ -3414,9 +3414,9 @@ float linphone_core_get_static_picture_fps(LinphoneCore *lc) {
force the filter to use that picture. */
if (vs && vs->source) {
if (ms_filter_get_id(vs->source) == MS_STATIC_IMAGE_ID) {
float fps;
ms_filter_call_method(vs->source, MS_FILTER_GET_FPS,(void *)&fps);
return fps;
}
......@@ -3480,6 +3480,12 @@ unsigned long linphone_core_get_native_preview_window_id(const LinphoneCore *lc)
**/
void linphone_core_set_native_preview_window_id(LinphoneCore *lc, unsigned long id){
lc->preview_window_id=id;
#ifdef VIDEO_ENABLED
LinphoneCall *call=linphone_core_get_current_call(lc);
if (call!=NULL && call->videostream){
video_stream_set_native_preview_window_id(call->videostream,id);
}
#endif
}