static void transport_error(LinphoneCore *lc, const char* transport, int port){
char *msg=ortp_strdup_printf("Could not start %s transport on port %i, maybe this port is already used.",transport,port);
- ms_warning(msg);
+ ms_warning("%s",msg);
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,msg);
ms_free(msg);
we are going to examine is destroy and removed during
linphone_core_start_invite() */
calls=calls->next;
+ linphone_call_background_tasks(call,one_second_elapsed);
if (call->state==LinphoneCallOutgoingInit && (curtime-call->start_time>=2)){
/*start the call even if the OPTIONS reply did not arrive*/
linphone_core_start_invite(lc,call,NULL);
}
}
}
- call = linphone_core_get_current_call(lc);
- if(call)
- linphone_call_background_tasks(call,one_second_elapsed);
+
if (linphone_core_video_preview_enabled(lc)){
if (lc->previewstream==NULL && lc->calls==NULL)
toggle_video_preview(lc,TRUE);
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 !"));
- return NULL;
- }
+ linphone_core_preempt_sound_resources(lc);
+
if(!linphone_core_can_we_add_call(lc)){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Sorry, we have reached the maximum number of simultaneous calls"));
int linphone_core_update_call(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params){
int err=0;
if (params!=NULL){
+ const char *subject;
call->params=*params;
update_local_media_description(lc,call,&call->localdesc);
call->camera_active=params->has_video;
+
+ if (params->in_conference){
+ subject="Conference";
+ }else{
+ subject="Media change";
+ }
if (lc->vtable.display_status)
lc->vtable.display_status(lc,_("Modifying call parameters..."));
sal_call_set_local_media_description (call->op,call->localdesc);
- err=sal_call_update(call->op,"Media parameters update");
+ err=sal_call_update(call->op,subject);
}else{
#ifdef VIDEO_ENABLED
if (call->videostream!=NULL){
video_stream_set_sent_video_size(call->videostream,linphone_core_get_preferred_video_size(lc));
- if (call->camera_active)
- call->videostream->cam=lc->video_conf.device; /*to take into account eventual cam changes*/
- video_stream_update_video_params (call->videostream);
+ if (call->camera_active && call->videostream->cam!=lc->video_conf.device){
+ video_stream_change_camera(call->videostream,lc->video_conf.device);
+ }else video_stream_update_video_params(call->videostream);
}
#endif
}
if (rc){
ms_message("Call %p replaces call %p. This last one is going to be terminated automatically.",
call,rc);
- linphone_core_terminate_call (lc,rc);
+ linphone_core_terminate_call(lc,rc);
}
}
- if (lc->current_call!=NULL && lc->current_call!=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;
- for(elem=lc->calls;elem!=NULL;elem=elem->next){
- LinphoneCall *c=(LinphoneCall*)elem->data;
- if (c!=call && (c->state!=LinphoneCallPaused && c->state!=LinphoneCallPausing)){
- ms_warning("Cannot accept this call as another one is running, pause it before.");
- return -1;
- }
- }
+ if (lc->current_call!=call){
+ linphone_core_preempt_sound_resources(lc);
}
/*stop ringing */
ring_stop(lc->ringstream);
lc->ringstream=NULL;
}
+
+ /*stop any dtmf tone still playing */
+ ms_message("test");
+ linphone_core_stop_dtmf(lc);
+
linphone_call_stop_media_streams(call);
if (lc->vtable.display_status!=NULL)
lc->vtable.display_status(lc,_("Call ended") );
* @param lc The LinphoneCore
**/
int linphone_core_terminate_all_calls(LinphoneCore *lc){
- while(lc->calls)
- {
- LinphoneCall *the_call = lc->calls->data;
- linphone_core_terminate_call(lc,the_call);
+ MSList *calls=lc->calls;
+ while(calls) {
+ LinphoneCall *c=(LinphoneCall*)calls->data;
+ calls=calls->next;
+ linphone_core_terminate_call(lc,c);
}
- ms_list_free(lc->calls);
- return -1;
+ return 0;
}
/**
* @ingroup call_control
**/
bool_t linphone_core_in_call(const LinphoneCore *lc){
- return linphone_core_get_current_call((LinphoneCore *)lc)!=NULL;
+ return linphone_core_get_current_call((LinphoneCore *)lc)!=NULL || linphone_core_is_in_conference(lc);
}
/**
ms_error("No reason to pause this call, it is already paused or inactive.");
return -1;
}
- if (sal_call_update(call->op,subject) != 0)
- {
+ if (sal_call_update(call->op,subject) != 0){
if (lc->vtable.display_warning)
lc->vtable.display_warning(lc,_("Could not pause the call"));
}
return 0;
}
+void linphone_core_preempt_sound_resources(LinphoneCore *lc){
+ LinphoneCall *current_call;
+ if (linphone_core_is_in_conference(lc)){
+ linphone_core_leave_conference(lc);
+ return;
+ }
+ current_call=linphone_core_get_current_call(lc);
+ if(current_call != NULL){
+ ms_message("Pausing automatically the current call.");
+ linphone_core_pause_call(lc,current_call);
+ }
+}
+
/**
* Resumes the call.
*
{
char temp[255]={0};
LinphoneCall *call = the_call;
-
+ const char *subject="Call resuming";
+
if(call->state!=LinphoneCallPaused ){
ms_warning("we cannot resume a call that has not been established and paused before");
return -1;
}
- if(linphone_core_get_current_call(lc) != NULL){
- ms_warning("There is already a call in process, pause or stop it first.");
- 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 (call->params.in_conference==FALSE){
+ linphone_core_preempt_sound_resources(lc);
+ ms_message("Resuming call %p",call);
}
- ms_message("Resuming call %p",call);
sal_media_description_set_dir(call->localdesc,SalStreamSendRecv);
- if(sal_call_update(call->op,"Call resuming") != 0){
+ if (call->params.in_conference) subject="Resuming conference";
+ if(sal_call_update(call->op,subject) != 0){
return -1;
}
linphone_call_set_state (call,LinphoneCallResuming,"Resuming");
else ms_filter_call_method(f, MS_DTMF_GEN_START, &dtmf);
}
+/**
+ * @ingroup media_parameters
+ * Plays a repeated tone to the local user until next further call to #linphone_core_stop_dtmf()
+ * @param lc #LinphoneCore
+**/
+void linphone_core_play_tone(LinphoneCore *lc){
+ MSFilter *f=get_dtmf_gen(lc);
+ MSDtmfGenCustomTone def;
+ if (f==NULL){
+ ms_error("No dtmf generator at this time !");
+ return;
+ }
+ def.duration=300;
+ def.frequency=500;
+ def.amplitude=1;
+ def.interval=800;
+ ms_filter_call_method(f, MS_DTMF_GEN_PLAY_CUSTOM,&def);
+}
+
/**
* @ingroup media_parameters
*