]> sjero.net Git - linphone/blobdiff - coreapi/linphonecore.c
Merge branch 'dev_conference'
[linphone] / coreapi / linphonecore.c
index 417751776ab186f983a3b140a05b7e2f3b94ef05..4fd1d700d152b2a41bad0f5009a9376252a110c7 100644 (file)
@@ -1725,6 +1725,7 @@ void linphone_core_iterate(LinphoneCore *lc){
                 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);
@@ -1738,9 +1739,7 @@ void linphone_core_iterate(LinphoneCore *lc){
                        }
                }
        }
-       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);
@@ -2096,7 +2095,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
 
        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 !"));
+                       lc->vtable.display_warning(lc,_("Sorry, you have to pause or stop the current call or conference first !"));
                return NULL;
        }
        if(!linphone_core_can_we_add_call(lc)){
@@ -2219,13 +2218,20 @@ bool_t linphone_core_inc_invite_pending(LinphoneCore*lc){
 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){
@@ -2365,6 +2371,11 @@ static void terminate_call(LinphoneCore *lc, LinphoneCall *call){
                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") );
@@ -2450,7 +2461,7 @@ const MSList *linphone_core_get_calls(LinphoneCore *lc)
  * @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);
 }
 
 /**
@@ -2488,8 +2499,7 @@ int linphone_core_pause_call(LinphoneCore *lc, LinphoneCall *the_call)
                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"));
        }
@@ -2526,20 +2536,24 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *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){
+               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;
+               }
+               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");
@@ -3701,6 +3715,25 @@ void linphone_core_play_dtmf(LinphoneCore *lc, char dtmf, int duration_ms){
        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
  *