]> sjero.net Git - linphone/commitdiff
conferencing in progress
authorSimon Morlat <simon.morlat@linphone.org>
Tue, 13 Sep 2011 12:43:20 +0000 (14:43 +0200)
committerSimon Morlat <simon.morlat@linphone.org>
Tue, 13 Sep 2011 12:43:20 +0000 (14:43 +0200)
console/commands.c
coreapi/linphonecall.c
coreapi/linphonecore.c
coreapi/linphonecore.h
mediastreamer2

index 32482bad740058b30cb5bd99e6b7ff0715dfcfb4..27ea8dc5c7b8fe51948265e9382b93bc52dd241c 100644 (file)
@@ -102,6 +102,7 @@ static int lpc_cmd_vfureq(LinphoneCore *lc, char *arg);
 static int lpc_cmd_states(LinphoneCore *lc, char *args);
 static int lpc_cmd_identify(LinphoneCore *lc, char *args);
 static int lpc_cmd_ringback(LinphoneCore *lc, char *args);
+static int lpc_cmd_conference(LinphoneCore *lc, char *args);
 
 /* Command handler helpers */
 static void linphonec_proxy_add(LinphoneCore *lc);
@@ -124,7 +125,6 @@ static void linphonec_codec_enable(int type, LinphoneCore *lc, int index);
 static void linphonec_codec_disable(int type, LinphoneCore *lc, int index);
 
 
-
 /* Command table management */
 static LPC_COMMAND *lpc_find_command(const char *name);
 
@@ -184,6 +184,10 @@ static LPC_COMMAND commands[] = {
                "'transfer <call id> <sip-uri>': transfers the call with 'id' to the destination sip-uri\n"
                "'transfer <call id1> --to-call <call id2>': transfers the call with 'id1' to the destination of call 'id2' (attended transfer)\n"
        },
+       { "conference", lpc_cmd_conference, "Create and manage an audio conference.",
+               "'conference add <call id> : join the call with id 'call id' into the audio conference."
+               "'conference rm <call id> : remove the call with id 'call id' from the audio conference."
+       },
        { "mute", lpc_cmd_mute_mic, 
          "Mute microphone and suspend voice transmission."},
 #ifdef VIDEO_ENABLED
@@ -1461,6 +1465,24 @@ static int lpc_cmd_resume(LinphoneCore *lc, char *args){
     
 }
 
+static int lpc_cmd_conference(LinphoneCore *lc, char *args){
+       long id;
+       char subcommand[32]={0};
+       int n;
+       if (args==NULL) return 0;
+       n=sscanf(args, "%31s %li", subcommand,&id);
+       if (n == 2){
+               LinphoneCall *call=linphonec_get_call(id);
+               if (call==NULL) return 1;
+               if (strcmp(subcommand,"add")==0){
+                       linphone_core_add_to_conference(lc,call);
+               }else if (strcmp(subcommand,"rm")==0){
+                       linphone_core_remove_from_conference(lc,call);
+               }
+       }
+       return 0;
+}
+
 /***************************************************************************
  *
  *  Commands helper functions
@@ -2411,9 +2433,11 @@ static void lpc_display_call_states(LinphoneCore *lc){
        }else{
                for(;elem!=NULL;elem=elem->next){
                        call=(LinphoneCall*)elem->data;
+                       bool_t in_conference=linphone_call_params_local_conference_mode(linphone_call_get_current_params(call));
                        tmp=linphone_call_get_remote_address_as_string (call);
-                       linphonec_out("%-2i | %-35s | %s\n",(int)(long)linphone_call_get_user_pointer(call),
-                                                 tmp,linphone_call_state_to_string(linphone_call_get_state(call)));
+                       linphonec_out("%-2i | %-35s | %s %s\n",(int)(long)linphone_call_get_user_pointer(call),
+                                                 tmp,linphone_call_state_to_string(linphone_call_get_state(call)),
+                                     in_conference ? "(conferencing)" : "");
                        ms_free(tmp);
                }
        }
index 80f681f4495bcf3fb6e8eaa307818e32ce1c3769..a568b8ba95c3e48a5d5bb1a2de524792cf038a06 100644 (file)
@@ -680,6 +680,13 @@ bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams
        return cp->real_early_media;
 }
 
+/**
+ * Returns true if the call is part of the locally managed conference.
+**/
+bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp){
+       return cp->in_conference;
+}
+
 /**
  * Refine bandwidth settings for this call by setting a bandwidth limit for audio streams.
  * As a consequence, codecs whose bitrates are not compatible with this limit won't be used.
@@ -1405,7 +1412,7 @@ void linphone_call_background_tasks(LinphoneCall *call, bool_t one_second_elapse
                        }
                }
        }
-       if (one_second_elapsed && call->audiostream!=NULL && disconnect_timeout>0 )
+       if (call->state==LinphoneCallStreamsRunning && one_second_elapsed && call->audiostream!=NULL && disconnect_timeout>0 )
                disconnected=!audio_stream_alive(call->audiostream,disconnect_timeout);
        if (disconnected)
                linphone_core_disconnected(call->core,call);
index 17cb06d9d6498178fc07df3cda84c24a6bae4461..1d985f54484de34213b440a52ffb03e40fd03fc8 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);
@@ -2536,13 +2535,15 @@ int linphone_core_resume_call(LinphoneCore *lc, LinphoneCall *the_call)
                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 (call->params.in_conference) subject="Resuming conference";
        if(sal_call_update(call->op,subject) != 0){
index b2b09f855c24ba8e60a0831a966797e17a238514..e0f3145fff1b99d9c5ff9eb6cc4b05af43585d84 100644 (file)
@@ -181,6 +181,7 @@ void linphone_call_params_enable_video(LinphoneCallParams *cp, bool_t enabled);
 bool_t linphone_call_params_video_enabled(const LinphoneCallParams *cp);
 void linphone_call_params_enable_early_media_sending(LinphoneCallParams *cp, bool_t enabled);
 bool_t linphone_call_params_early_media_sending_enabled(const LinphoneCallParams *cp);
+bool_t linphone_call_params_local_conference_mode(const LinphoneCallParams *cp);
 void linphone_call_params_set_audio_bandwidth_limit(LinphoneCallParams *cp, int bw);
 void linphone_call_params_destroy(LinphoneCallParams *cp);
 
index a8ca8f204ca57d18f6e1c0515adaf7edb0c905dd..22816808514255867ae8fa5347b854f4570784f7 160000 (submodule)
@@ -1 +1 @@
-Subproject commit a8ca8f204ca57d18f6e1c0515adaf7edb0c905dd
+Subproject commit 22816808514255867ae8fa5347b854f4570784f7