Commit 5de380f5 authored by Simon Morlat's avatar Simon Morlat

multicall again

parent 675f7bcd
......@@ -407,19 +407,20 @@ lpc_cmd_call(LinphoneCore *lc, char *args)
}
if(!strcmp(args,"show"))
{
MSList *calls = linphone_core_get_calls(lc);
const MSList *calls = linphone_core_get_calls(lc);
if(calls)
{
MSList *p_calls = calls;
const MSList *p_calls = calls;
linphonec_out("<remote>\t\t\t\t<status>\r\n");
while(p_calls != NULL)
{
char *tmp=linphone_call_get_remote_address_as_string(p_calls->data);
linphonec_out("%s\t\t\t%s\r\n",
linphone_call_get_remote_address_as_string(p_calls->data),
tmp,
(((LinphoneCall *)p_calls->data)==linphone_core_get_current_call(lc))?"yes":"no");
p_calls = p_calls->next;
ms_free(tmp);
}
ms_list_free(calls);
}
else
{
......@@ -639,7 +640,7 @@ lpc_cmd_nat(LinphoneCore *lc, char *args)
}
nat = linphone_core_get_nat_address(lc);
use = linphone_core_get_firewall_policy(lc)==LINPHONE_POLICY_USE_NAT_ADDRESS;
use = linphone_core_get_firewall_policy(lc)==LinphonePolicyUseNatAddress;
linphonec_out("Nat address: %s%s\n", nat ? nat : "unspecified" , use ? "" : " (disabled - use 'firewall nat' to enable)");
return 1;
......@@ -660,7 +661,7 @@ lpc_cmd_stun(LinphoneCore *lc, char *args)
}
stun = linphone_core_get_stun_server(lc);
use = linphone_core_get_firewall_policy(lc)==LINPHONE_POLICY_USE_STUN;
use = linphone_core_get_firewall_policy(lc)==LinphonePolicyUseStun;
linphonec_out("Stun server: %s%s\n", stun ? stun : "unspecified" , use? "" : " (disabled - use 'firewall stun' to enable)");
return 1;
......@@ -677,7 +678,7 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
{
if (strcmp(args,"none")==0)
{
linphone_core_set_firewall_policy(lc,LINPHONE_POLICY_NO_FIREWALL);
linphone_core_set_firewall_policy(lc,LinphonePolicyNoFirewall);
}
else if (strcmp(args,"stun")==0)
{
......@@ -687,7 +688,7 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
linphonec_out("No stun server address is defined, use 'stun <address>' first\n");
return 1;
}
linphone_core_set_firewall_policy(lc,LINPHONE_POLICY_USE_STUN);
linphone_core_set_firewall_policy(lc,LinphonePolicyUseStun);
}
else if (strcmp(args,"nat")==0)
{
......@@ -697,19 +698,19 @@ lpc_cmd_firewall(LinphoneCore *lc, char *args)
linphonec_out("No nat address is defined, use 'nat <address>' first");
return 1;
}
linphone_core_set_firewall_policy(lc,LINPHONE_POLICY_USE_NAT_ADDRESS);
linphone_core_set_firewall_policy(lc,LinphonePolicyUseNatAddress);
}
}
switch(linphone_core_get_firewall_policy(lc))
{
case LINPHONE_POLICY_NO_FIREWALL:
case LinphonePolicyNoFirewall:
linphonec_out("No firewall\n");
break;
case LINPHONE_POLICY_USE_STUN:
case LinphonePolicyUseStun:
linphonec_out("Using stun server %s to discover firewall address\n", setting ? setting : linphone_core_get_stun_server(lc));
break;
case LINPHONE_POLICY_USE_NAT_ADDRESS:
case LinphonePolicyUseNatAddress:
linphonec_out("Using supplied nat address %s.\n", setting ? setting : linphone_core_get_nat_address(lc));
break;
}
......@@ -1229,7 +1230,7 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
else
{
int returned = 0;
MSList *calls = linphone_core_get_calls(lc);
const MSList *calls = linphone_core_get_calls(lc);
if(ms_list_size(calls) == 1)
{
if(linphone_core_resume_call(lc,calls->data) < 0)
......@@ -1241,7 +1242,6 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
{
returned = 1;
}
ms_list_free(calls);
return returned;
}
}
......@@ -1775,31 +1775,31 @@ static int lpc_cmd_status(LinphoneCore *lc, char *args)
}
else if (strstr(args,"hook"))
{
gstate_t call_state=linphone_core_get_state(lc,GSTATE_GROUP_CALL);
/*
if (!cfg || !linphone_proxy_config_is_registered(cfg)){
linphonec_out("unregistered\n");
return 1;
}
*/
LinphoneCall *call=linphone_core_get_current_call (lc);
LinphoneCallState call_state=LinphoneCallIdle;
if (call) call_state=linphone_call_get_state(call);
switch(call_state){
case GSTATE_CALL_OUT_INVITE:
case LinphoneCallOutgoingInit:
case LinphoneCallOutgoingProgress:
linphonec_out("hook=dialing\n");
break;
case GSTATE_CALL_IDLE:
case LinphoneCallIdle:
linphonec_out("hook=offhook\n");
break;
case GSTATE_CALL_OUT_CONNECTED:
linphonec_out("Call out, hook=%s duration=%i, muted=%s rtp-xmit-muted=%s\n", linphonec_get_callee(),
case LinphoneCallStreamsRunning:
case LinphoneCallConnected:
if (linphone_call_get_dir(call)==LinphoneCallOutgoing){
linphonec_out("Call out, hook=%s duration=%i, muted=%s rtp-xmit-muted=%s\n", linphonec_get_callee(),
linphone_core_get_current_call_duration(lc),
lc->audio_muted ? "yes" : "no",
linphone_core_is_mic_muted (lc) ? "yes" : "no",
linphone_core_is_rtp_muted(lc) ? "yes" : "no");
break;
case GSTATE_CALL_IN_CONNECTED:
linphonec_out("hook=answered duration=%i\n" ,
linphone_core_get_current_call_duration(lc));
}else{
linphonec_out("hook=answered duration=%i\n" ,
linphone_core_get_current_call_duration(lc));
}
break;
case GSTATE_CALL_IN_INVITE:
case LinphoneCallIncomingReceived:
linphonec_out("Incoming call from %s\n",linphonec_get_caller());
break;
default:
......@@ -2048,22 +2048,21 @@ static int lpc_cmd_unmute_mic(LinphoneCore *lc, char *args){
static int lpc_cmd_rtp_no_xmit_on_audio_mute(LinphoneCore *lc, char *args)
{
bool_t rtp_xmit_off=FALSE;
char *status;
gstate_t call_state=linphone_core_get_state(lc,GSTATE_GROUP_CALL);
if(args){
if(strstr(args,"1"))rtp_xmit_off=TRUE;
if(call_state == GSTATE_CALL_IDLE)
linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_xmit_off);
else
linphonec_out("nortp-on-audio-mute: call in progress - cannot change state\n");
}
rtp_xmit_off=linphone_core_get_rtp_no_xmit_on_audio_mute(lc);
if(rtp_xmit_off)status="off";
else status="on";
linphonec_out("rtp transmit %s when audio muted\n",status);
return 1;
bool_t rtp_xmit_off=FALSE;
char *status;
if(args){
if(strstr(args,"1"))rtp_xmit_off=TRUE;
if(linphone_core_get_current_call (lc)==NULL)
linphone_core_set_rtp_no_xmit_on_audio_mute(lc,rtp_xmit_off);
else
linphonec_out("nortp-on-audio-mute: call in progress - cannot change state\n");
}
rtp_xmit_off=linphone_core_get_rtp_no_xmit_on_audio_mute(lc);
if (rtp_xmit_off) status="off";
else status="on";
linphonec_out("rtp transmit %s when audio muted\n",status);
return 1;
}
......
This diff is collapsed.
......@@ -95,7 +95,7 @@ static void call_received(SalOp *h){
linphone_address_clean(from_parsed);
tmp=linphone_address_as_string(from_parsed);
linphone_address_destroy(from_parsed);
linphone_call_set_state(call,LinphoneCallIncomingProgress,"Incoming call");
linphone_call_set_state(call,LinphoneCallIncomingReceived,"Incoming call");
barmesg=ortp_strdup_printf("%s %s%s",tmp,_("is contacting you"),
(sal_call_autoanswer_asked(h)) ?_(" and asked autoanswer."):_("."));
if (lc->vtable.show) lc->vtable.show(lc);
......@@ -190,10 +190,16 @@ static void call_accepted(SalOp *op){
call->media_pending=FALSE;
}
if (call->resultdesc && !sal_media_description_empty(call->resultdesc)){
if (call->state==LinphoneCallPausing || sal_media_description_has_dir(call->resultdesc,SalStreamSendOnly)){
if (sal_media_description_has_dir(call->resultdesc,SalStreamSendOnly)){
/*we initiated a pause*/
if (lc->vtable.display_status){
char *tmp=linphone_call_get_remote_address_as_string (call);
char *msg=ms_strdup_printf(_("Call with %s is paused."),tmp);
lc->vtable.display_status(lc,msg);
ms_free(tmp);
ms_free(msg);
}
linphone_call_set_state(call,LinphoneCallPaused,"Call paused");
linphone_call_set_media_streams_dir (call,SalStreamSendOnly);
linphone_call_start_media_streams (call);
}else{
linphone_connect_incoming(lc,call);
......@@ -252,21 +258,17 @@ static void call_updated(SalOp *op){
if(lc->vtable.display_status)
lc->vtable.display_status(lc,_("We have been resumed..."));
linphone_call_set_state (call,LinphoneCallStreamsRunning,"Connected (streams running)");
linphone_call_set_media_streams_dir (call,SalStreamSendRecv);
}
else if(call->state==LinphoneCallStreamsRunning &&
sal_media_description_has_dir(call->resultdesc,SalStreamRecvOnly) && !strcmp(call->resultdesc->addr,"0.0.0.0")){
if(lc->vtable.display_status)
lc->vtable.display_status(lc,_("We are being paused..."));
linphone_call_set_state (call,LinphoneCallPaused,"Call paused");
linphone_call_set_media_streams_dir (call,SalStreamRecvOnly);
}
else
{
linphone_call_stop_media_streams (call);
linphone_call_init_media_streams (call);
linphone_connect_incoming(lc,call);
}
linphone_call_stop_media_streams (call);
linphone_call_init_media_streams (call);
linphone_connect_incoming(lc,call);
}
}
......@@ -457,9 +459,17 @@ static void dtmf_received(SalOp *op, char dtmf){
static void refer_received(Sal *sal, SalOp *op, const char *referto){
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal);
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
if (lc->vtable.refer_received){
lc->vtable.refer_received(lc,call,referto);
if (op) sal_refer_accept(op);
if (call){
linphone_call_set_state(call,LinphoneCallRefered,"Refered");
if (lc->vtable.display_status){
char *msg=ms_strdup_printf(_("We are transferred to %s"),referto);
lc->vtable.display_status(lc,msg);
ms_free(msg);
}
sal_refer_accept(op);
}else if (lc->vtable.refer_received){
lc->vtable.refer_received(lc,referto);
sal_refer_accept(op);
}
}
......
......@@ -335,6 +335,16 @@ LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call){
return call->log;
}
/**
* Returns the refer-to uri (if the call received was transfered).
**/
const char *linphone_call_get_refer_to(const LinphoneCall *call){
return call->refer_to;
}
LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call){
return call->log->dir;
}
/**
* @}
......@@ -550,21 +560,35 @@ void linphone_call_start_media_streams(LinphoneCall *call){
{
const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalAudio);
if (stream && stream->port!=0){
if (stream){
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;
const char *recfile=lc->rec_file;
call->audio_profile=make_profile(lc,call->resultdesc,stream,&used_pt);
if (!lc->use_files){
MSSndCard *playcard=lc->sound_conf.lsd_card ?
lc->sound_conf.lsd_card : lc->sound_conf.play_sndcard;
MSSndCard *captcard=lc->sound_conf.capt_sndcard;
if (used_pt!=-1){
if (playcard==NULL) {
ms_warning("No card defined for playback !");
goto end;
}
if (captcard==NULL) {
ms_warning("No card defined for capture !");
goto end;
}
audio_stream_start_now(
ms_message("streamdir is %i",stream->dir);
/*Replace soundcard filters by inactive file players or recorders
when placed in recvonly or sendonly mode*/
if (stream->port==0 || stream->dir==SalStreamRecvOnly){
captcard=NULL;
playfile=NULL;
}else if (stream->dir==SalStreamSendOnly){
playcard=NULL;
captcard=NULL;
recfile=NULL;
}
/*if playfile are supplied don't use soundcards*/
if (playfile) captcard=NULL;
if (recfile) playcard=NULL;
audio_stream_start_full(
call->audiostream,
call->audio_profile,
stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr,
......@@ -572,54 +596,63 @@ void linphone_call_start_media_streams(LinphoneCall *call){
stream->port+1,
used_pt,
jitt_comp,
playfile,
recfile,
playcard,
captcard,
linphone_core_echo_cancellation_enabled(lc));
}else{
audio_stream_start_with_files(
call->audiostream,
call->audio_profile,
stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr,
stream->port,
stream->port+1,
used_pt,
100,
lc->play_file,
lc->rec_file);
}
post_configure_audio_streams(call);
audio_stream_set_rtcp_information(call->audiostream, cname, tool);
}else ms_warning("No audio stream defined ?");
post_configure_audio_streams(call);
audio_stream_set_rtcp_information(call->audiostream, cname, tool);
}else ms_warning("No audio stream accepted ?");
}
}
#ifdef VIDEO_ENABLED
{
const SalStreamDescription *stream=sal_media_description_find_stream(call->resultdesc,
SalProtoRtpAvp,SalVideo);
used_pt=-1;
/* shutdown preview */
if (lc->previewstream!=NULL) {
video_preview_stop(lc->previewstream);
lc->previewstream=NULL;
}
if (stream && stream->port!=0 && (lc->video_conf.display || lc->video_conf.capture)) {
if (stream) {
const char *addr=stream->addr[0]!='\0' ? stream->addr : call->resultdesc->addr;
call->video_profile=make_profile(lc,call->resultdesc,stream,&used_pt);
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_conf.display && lc->video_conf.capture)
video_stream_start(call->videostream,
call->video_profile, addr, stream->port,
stream->port+1,
used_pt, jitt_comp, lc->video_conf.device);
else if (lc->video_conf.display)
video_stream_recv_only_start(call->videostream,
call->video_profile, addr, stream->port,
used_pt, jitt_comp);
else if (lc->video_conf.capture)
video_stream_send_only_start(call->videostream,
call->video_profile, addr, stream->port,
stream->port+1,
used_pt, jitt_comp, lc->video_conf.device);
video_stream_set_rtcp_information(call->videostream, cname,tool);
if (used_pt!=-1){
VideoStreamDir dir=VideoStreamSendRecv;
MSWebCam *cam=lc->video_conf.device;
bool_t is_inactive=FALSE;
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 (stream->dir==SalStreamSendOnly && lc->video_conf.capture ){
cam=ms_web_cam_manager_get_cam(ms_web_cam_manager_get(),"Static picture");
dir=VideoStreamSendOnly;
}else if (stream->dir==SalStreamRecvOnly && lc->video_conf.display ){
dir=VideoStreamRecvOnly;
}else if (stream->dir==SalStreamSendRecv){
if (lc->video_conf.display && lc->video_conf.capture)
dir=VideoStreamSendRecv;
else if (lc->video_conf.display)
dir=VideoStreamRecvOnly;
else
dir=VideoStreamSendOnly;
}else{
ms_warning("video stream is inactive.");
/*either inactive or incompatible with local capabilities*/
is_inactive=TRUE;
}
if (!is_inactive){
video_stream_set_direction (call->videostream, dir);
video_stream_start(call->videostream,
call->video_profile, addr, stream->port,
stream->port+1,
used_pt, jitt_comp, cam);
video_stream_set_rtcp_information(call->videostream, cname,tool);
}
}else ms_warning("No video stream accepted.");
}else{
ms_warning("No valid video stream defined.");
}
......@@ -638,7 +671,6 @@ static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){
}
void linphone_call_stop_media_streams(LinphoneCall *call){
LinphoneCore *lc=call->core;
if (call->audiostream!=NULL) {
linphone_call_log_fill_stats (call->log,call->audiostream);
audio_stream_stop(call->audiostream);
......@@ -646,12 +678,7 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
}
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL){
if (lc->video_conf.display && lc->video_conf.capture)
video_stream_stop(call->videostream);
else if (lc->video_conf.display)
video_stream_recv_only_stop(call->videostream);
else if (lc->video_conf.capture)
video_stream_send_only_stop(call->videostream);
video_stream_stop(call->videostream);
call->videostream=NULL;
}
......@@ -668,6 +695,4 @@ void linphone_call_stop_media_streams(LinphoneCall *call){
}
}
void linphone_call_set_media_streams_dir(LinphoneCall *call, SalStreamDir dir){
}
......@@ -1980,11 +1980,13 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
LinphoneCall *call;
if (linphone_core_in_call(lc)){
lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call first !"));
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call first !"));
return NULL;
}
if(!linphone_core_can_we_add_call(lc)){
lc->vtable.display_warning(lc,_("Sorry, we have reached the maximum number of simultaneous calls"));
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Sorry, we have reached the maximum number of simultaneous calls"));
return NULL;
}
linphone_core_get_default_proxy(lc,&proxy);
......@@ -2013,10 +2015,12 @@ LinphoneCall * linphone_core_invite_address(LinphoneCore *lc, const LinphoneAddr
if(linphone_core_add_call(lc,call)!= 0)
{
ms_warning("we had a problem in adding the call into the invite ... weird\n");
ms_warning("we had a problem in adding the call into the invite ... weird");
linphone_call_unref(call);
return NULL;
}
/* this call becomes now the current one*/
lc->current_call=call;
if (dest_proxy!=NULL || lc->sip_conf.ping_with_options==FALSE){
err=linphone_core_start_invite(lc,call,dest_proxy);
}else{
......@@ -2089,12 +2093,17 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
if (call==NULL){
//if just one call is present answer the only one ...
if(ms_list_size(linphone_core_get_calls(lc)) != 1)
if(linphone_core_get_calls_nb (lc) != 1)
return -1;
else
call = linphone_core_get_calls(lc)->data;
call = (LinphoneCall*)linphone_core_get_calls(lc)->data;
}
if (lc->current_call){
ms_warning("Cannot accept this call, there is already one running.");
return -1;
}
if (call->state==LinphoneCallConnected){
/*call already accepted*/
return -1;
......@@ -2119,10 +2128,6 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
ms_message("ring stopped");
lc->ringstream=NULL;
}
if(linphone_core_set_as_current_call(lc,call)!=0)
{
ms_message("another call is already in process\n");
}
linphone_core_get_default_proxy(lc,&cfg);
/*try to be best-effort in giving real local or routable contact address*/
......@@ -2135,6 +2140,7 @@ int linphone_core_accept_call(LinphoneCore *lc, LinphoneCall *call)
sal_call_accept(call->op);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Connected."));
lc->current_call=call;
linphone_call_set_state(call,LinphoneCallConnected,"Connected");
call->resultdesc=sal_call_get_final_media_description(call->op);
if (call->resultdesc){
......@@ -2214,13 +2220,17 @@ int linphone_core_terminate_all_calls(LinphoneCore *lc){
}
/**
* Returns the calls MSList
* Returns the current list of calls.
*
* Note that this list is read-only and might be changed by the core after a function call to linphone_core_iterate().
* Similarly the LinphoneCall objects inside it might be destroyed without prior notice.
* To hold references to LinphoneCall object into your program, you must use linphone_call_ref().
*
* @ingroup call_control
**/
MSList *linphone_core_get_calls(LinphoneCore *lc)
const MSList *linphone_core_get_calls(LinphoneCore *lc)
{
return ms_list_copy(lc->calls);
return lc->calls;
}
/**
......@@ -2250,23 +2260,7 @@ LinphoneCall *linphone_core_get_current_call(const LinphoneCore *lc)
int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
{
LinphoneCall *call = the_call;
if(lc == NULL)
{
ms_error("LinphoneCore was null\n");
return -1;
}
if(call == NULL)
{
if(linphone_core_in_call(lc))
{
call = linphone_core_get_current_call(lc);
}
else
{
ms_error("LinphoneCall was null");
return -1;
}
}
if(linphone_core_get_current_call(lc) != call)
{
ms_error("The call asked to be paused was not the current on");
......@@ -2280,6 +2274,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
linphone_call_set_state(call,LinphoneCallPausing,"Pausing call");
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Pausing the current call..."));
lc->current_call=NULL;
return 0;
}
......@@ -2292,46 +2287,24 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
{
char temp[255]={0};
LinphoneCall *call = the_call;
if(lc == NULL)
{
ms_error("LinphoneCore was null\n");
return -1;
}
if(call == NULL)
{
MSList *calls = linphone_core_get_calls(lc);
if(ms_list_size(calls) == 1)
{
call = ((LinphoneCall *)calls->data);
ms_list_free(calls);
}
else
{
ms_error("LinphoneCall was null\n");
ms_list_free(calls);
return -2;
}
}
if(call->state!=LinphoneCallPaused )
{
if(call->state!=LinphoneCallPaused ){
ms_warning("we cannot resume a call when the communication is not established");
return -1;
}
if(linphone_core_get_current_call(lc) != NULL)
{
ms_error("There is already a call in process pause or stop it first\n");
if(linphone_core_get_current_call(lc) != NULL){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("There is already a call in process, pause or stop it first."));
return -1;
}
if(sal_call_hold(call->op,FALSE) != 0)
{
lc->vtable.display_warning(lc,_("Could not resume the call"));
if(sal_call_hold(call->op,FALSE) != 0){
return -1;
}
linphone_call_set_state (call,LinphoneCallResuming,"Resuming");
linphone_core_set_as_current_call(lc,call);
snprintf(temp,sizeof(temp)-1,"Resuming the call with %s",linphone_call_get_remote_address_as_string(call));
if (lc->vtable.display_status)
lc->vtable.display_status(lc,temp);
lc->current_call=call;
return 0;
}
......@@ -3145,7 +3118,7 @@ int linphone_core_set_static_picture(LinphoneCore *lc, const char *path) {
unsigned long linphone_core_get_native_video_window_id(const LinphoneCore *lc){
#ifdef VIDEO_ENABLED
LinphoneCall *call=linphone_core_get_current_call (lc);
if (call->videostream)
if (call && call->videostream)
return video_stream_get_native_window_id(call->videostream);
if (lc->previewstream)
return video_stream_get_native_window_id(lc->previewstream);
......@@ -3617,18 +3590,8 @@ void linphone_core_destroy(LinphoneCore *lc){
*
* @ingroup call_control
**/
int linphone_core_get_calls_nb(const LinphoneCore *lc)
{
int returned;
if(lc->calls == NULL)
{
returned = 0;
}
else
{
returned = ms_list_size(lc->calls);
}
return returned;
int linphone_core_get_calls_nb(const LinphoneCore *lc){
return ms_list_size(lc->calls);;
}
/**
......@@ -3644,44 +3607,12 @@ bool_t linphone_core_can_we_add_call(LinphoneCore *lc)
return FALSE;
}
/**
* Unset the current call
*
* @ingroup call_control
**/
int linphone_core_unset_the_current_call(LinphoneCore *lc)
{
if(lc->current_call == NULL)
return -1;
lc->current_call = NULL;
ms_message("Current call unset\n");
return 0;
}
/**
* Set the call in parameter as the new current call
*
* @ingroup call_control
**/
int linphone_core_set_as_current_call(LinphoneCore *lc, LinphoneCall *call)
{
if(lc->current_call != NULL)
return -1;
lc->current_call = call;
return 0;
}
int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call)
{
if(linphone_core_can_we_add_call(lc))
{
MSList *the_calls = lc->calls;
if (the_calls==NULL){
lc->current_call=call;
}
the_calls = ms_list_append(the_calls,call);
lc->calls = the_calls;
lc->calls = ms_list_append(lc->calls,call);
return 0;
}
return -1;
......@@ -3690,12 +3621,8 @@ int linphone_core_add_call( LinphoneCore *lc, LinphoneCall *call)
int linphone_core_del_call( LinphoneCore *lc, LinphoneCall *call)
{
MSList *it;
MSList *the_calls = lc->calls;
if(call == linphone_core_get_current_call(lc))
{
linphone_core_unset_the_current_call(lc);
}
it=ms_list_find(the_calls,call);
if (it)
{
......
......@@ -167,9 +167,11 @@ bool_t linphone_call_asked_to_autoanswer(LinphoneCall *call);
const LinphoneAddress * linphone_core_get_current_call_remote_address(struct _LinphoneCore *lc);
const LinphoneAddress * linphone_call_get_remote_address(const LinphoneCall *call);
char *linphone_call_get_remote_address_as_string(const LinphoneCall *call);
LinphoneCallDir linphone_call_get_dir(const LinphoneCall *call);
void linphone_call_ref(LinphoneCall *call);
void linphone_call_unref(LinphoneCall *call);
LinphoneCallLog *linphone_call_get_call_log(const LinphoneCall *call);
const char *linphone_call_get_refer_to(const LinphoneCall *call);
void *linphone_call_get_user_pointer(LinphoneCall *call);
void linphone_call_set_user_pointer(LinphoneCall *call, void *user_pointer);
......@@ -364,7 +366,7 @@ void * linphone_chat_room_get_user_data(LinphoneChatRoom *cr);
typedef enum _LinphoneCallState{
LinphoneCallIdle,
LinphoneCallIncomingProgress,
LinphoneCallIncomingReceived,
LinphoneCallOutgoingInit,
LinphoneCallOutgoingProgress,
LinphoneCallOutgoingRinging,