From: Simon Morlat Date: Tue, 13 Sep 2011 12:43:20 +0000 (+0200) Subject: conferencing in progress X-Git-Url: http://sjero.net/git/?p=linphone;a=commitdiff_plain;h=41029c78b13f62975fc6cee3658cfe28b9de6007 conferencing in progress --- diff --git a/console/commands.c b/console/commands.c index 32482bad..27ea8dc5 100644 --- a/console/commands.c +++ b/console/commands.c @@ -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 ': transfers the call with 'id' to the destination sip-uri\n" "'transfer --to-call ': 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 : join the call with id 'call id' into the audio conference." + "'conference rm : 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); } } diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index 80f681f4..a568b8ba 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -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); diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 17cb06d9..1d985f54 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -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){ diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index b2b09f85..e0f3145f 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -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); diff --git a/mediastreamer2 b/mediastreamer2 index a8ca8f20..22816808 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit a8ca8f204ca57d18f6e1c0515adaf7edb0c905dd +Subproject commit 22816808514255867ae8fa5347b854f4570784f7