Commit 41029c78 authored by Simon Morlat's avatar Simon Morlat
Browse files

conferencing in progress

parent 98c4a9bb
......@@ -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);
}
}
......
......@@ -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);
......
......@@ -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){
......
......@@ -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);
......
mediastreamer2 @ 22816808
Subproject commit a8ca8f204ca57d18f6e1c0515adaf7edb0c905dd
Subproject commit 22816808514255867ae8fa5347b854f4570784f7
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment