Can now use ICE and ping OPTIONS in parallel.

This commit is contained in:
Ghislain MARY 2012-08-09 15:45:22 +02:00
parent ccfd3c7b2d
commit 4b8a215735
4 changed files with 33 additions and 7 deletions

View file

@ -755,7 +755,8 @@ static void ping_reply(SalOp *op){
ms_message("ping reply !");
if (call){
if (call->state==LinphoneCallOutgoingInit){
linphone_core_start_invite(call->core,call,NULL);
call->ping_replied=TRUE;
linphone_core_proceed_with_invite_if_ready(call->core,call,NULL);
}
}
else

View file

@ -1732,7 +1732,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
break;
case LinphoneCallOutgoingInit:
linphone_call_stop_media_streams(call);
linphone_core_start_invite(call->core, call, NULL);
linphone_core_proceed_with_invite_if_ready(call->core, call, NULL);
break;
default:
linphone_call_stop_media_streams(call);

View file

@ -2105,6 +2105,27 @@ static char *get_fixed_contact(LinphoneCore *lc, LinphoneCall *call , LinphonePr
return NULL;
}
int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy){
bool_t ice_ready = FALSE;
bool_t ping_ready = FALSE;
if (call->ice_session != NULL) {
if (ice_session_candidates_gathered(call->ice_session)) ice_ready = TRUE;
} else {
ice_ready = TRUE;
}
if (call->ping_op != NULL) {
if (call->ping_replied == TRUE) ping_ready = TRUE;
} else {
ping_ready = TRUE;
}
if ((ice_ready == TRUE) && (ping_ready == TRUE)) {
return linphone_core_start_invite(lc, call, dest_proxy);
}
return 0;
}
int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy){
int err;
char *contact;
@ -2247,6 +2268,7 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
char *real_url=NULL;
LinphoneProxyConfig *dest_proxy=NULL;
LinphoneCall *call;
bool_t use_ice = FALSE;
linphone_core_preempt_sound_resources(lc);
@ -2298,18 +2320,19 @@ LinphoneCall * linphone_core_invite_address_with_params(LinphoneCore *lc, const
linphone_call_delete_ice_session(call);
linphone_call_stop_media_streams(call);
} else {
if (real_url!=NULL) ms_free(real_url);
return call;
use_ice = TRUE;
}
}
if (dest_proxy!=NULL || lc->sip_conf.ping_with_options==FALSE){
linphone_core_start_invite(lc,call,dest_proxy);
}else{
if (dest_proxy==NULL && lc->sip_conf.ping_with_options==TRUE){
/*defer the start of the call after the OPTIONS ping*/
call->ping_replied=FALSE;
call->ping_op=sal_op_new(lc->sal);
sal_ping(call->ping_op,from,real_url);
sal_op_set_user_pointer(call->ping_op,call);
call->start_time=time(NULL);
}else{
if (use_ice==FALSE) linphone_core_start_invite(lc,call,dest_proxy);
}
if (real_url!=NULL) ms_free(real_url);

View file

@ -134,6 +134,7 @@ struct _LinphoneCall
bool_t auth_token_verified;
bool_t defer_update;
bool_t was_automatically_paused;
bool_t ping_replied;
CallCallbackObj nextVideoFrameDecoded;
LinphoneCallStats stats[2];
IceSession *ice_session;
@ -260,6 +261,7 @@ void linphone_core_start_waiting(LinphoneCore *lc, const char *purpose);
void linphone_core_update_progress(LinphoneCore *lc, const char *purpose, float progresses);
void linphone_core_stop_waiting(LinphoneCore *lc);
int linphone_core_proceed_with_invite_if_ready(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy);
int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy);
int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call);