call->localdesc->streams[i].proto = SalProtoRtpAvp;
memset(call->localdesc->streams[i].crypto, 0, sizeof(call->localdesc->streams[i].crypto));
}
- linphone_core_start_invite(lc, call, NULL);
+ linphone_core_start_invite(lc, call);
}
return;
}
LinphoneAddress *addr=linphone_address_new(me);
const char *username=linphone_address_get_username (addr);
SalMediaDescription *md=sal_media_description_new();
+
+ if (call->ping_time>0) {
+ linphone_core_adapt_to_network(lc,call->ping_time,&call->params);
+ }
md->session_id=session_id;
md->session_ver=session_ver;
LinphoneCall * linphone_call_new_outgoing(struct _LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, const LinphoneCallParams *params)
{
LinphoneCall *call=ms_new0(LinphoneCall,1);
- int ping_time=-1;
call->dir=LinphoneCallOutgoing;
call->op=sal_op_new(lc->sal);
sal_op_set_user_pointer(call->op,call);
ice_session_set_role(call->ice_session, IR_Controlling);
}
if (linphone_core_get_firewall_policy(call->core) == LinphonePolicyUseStun) {
- ping_time=linphone_core_run_stun_tests(call->core,call);
- }
- if (ping_time>=0) {
- linphone_core_adapt_to_network(lc,ping_time,&call->params);
+ call->ping_time=linphone_core_run_stun_tests(call->core,call);
}
call->camera_active=params->has_video;
LinphoneCall * linphone_call_new_incoming(LinphoneCore *lc, LinphoneAddress *from, LinphoneAddress *to, SalOp *op){
LinphoneCall *call=ms_new0(LinphoneCall,1);
char *from_str;
- int ping_time=-1;
call->dir=LinphoneCallIncoming;
sal_op_set_user_pointer(op,call);
}
break;
case LinphonePolicyUseStun:
- ping_time=linphone_core_run_stun_tests(call->core,call);
+ call->ping_time=linphone_core_run_stun_tests(call->core,call);
/* No break to also destroy ice session in this case. */
default:
break;
}
- if (ping_time>=0) {
- linphone_core_adapt_to_network(lc,ping_time,&call->params);
- };
call->camera_active=call->params.has_video;
discover_mtu(lc,linphone_address_get_domain(from));
static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
OrtpEventType evt=ortp_event_get_type(ev);
OrtpEventData *evd=ortp_event_get_data(ev);
+ int ping_time;
if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) {
switch (ice_session_state(call->ice_session)) {
}
linphone_core_update_ice_state_in_call_stats(call);
} else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) {
- int ping_time = -1;
+
if (evd->info.ice_processing_successful==TRUE) {
ice_session_compute_candidates_foundations(call->ice_session);
ice_session_eliminate_redundant_candidates(call->ice_session);
ping_time = ice_session_gathering_duration(call->ice_session);
if (ping_time >=0) {
ping_time /= ice_session_nb_check_lists(call->ice_session);
+ call->ping_time=ping_time;
}
} else {
ms_warning("No STUN answer from [%s], disabling ICE",linphone_core_get_stun_server(call->core));
linphone_core_start_accept_call_update(call->core, call);
break;
case LinphoneCallOutgoingInit:
- if (ping_time >= 0) {
- linphone_core_adapt_to_network(call->core, ping_time, &call->params);
- }
linphone_call_stop_media_streams(call);
linphone_core_proceed_with_invite_if_ready(call->core, call, NULL);
break;
default:
- if (ping_time >= 0) {
- linphone_core_adapt_to_network(call->core, ping_time, &call->params);
- }
linphone_call_stop_media_streams(call);
linphone_core_notify_incoming_call(call->core, call);
break;
linphone_call_delete_ice_session(call);
linphone_call_stop_media_streams(call);
}
- linphone_core_start_invite(lc,call,NULL);
+ linphone_core_start_invite(lc,call);
}
if (call->state==LinphoneCallIncomingReceived){
elapsed=curtime-call->start_time;
}
if ((ice_ready == TRUE) && (ping_ready == TRUE)) {
- return linphone_core_start_invite(lc, call, dest_proxy);
+ return linphone_core_start_invite(lc, call);
}
return 0;
}
-int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call, LinphoneProxyConfig *dest_proxy){
+int linphone_core_start_invite(LinphoneCore *lc, LinphoneCall *call){
int err;
char *contact;
char *real_url,*barmsg;
char *from;
+ LinphoneProxyConfig *dest_proxy=call->dest_proxy;
/*try to be best-effort in giving real local or routable contact address */
contact=get_fixed_contact(lc,call,dest_proxy);
{
const char *route=NULL;
const char *from=NULL;
- LinphoneProxyConfig *proxy=NULL;
+ LinphoneProxyConfig *proxy=NULL,*dest_proxy=NULL;
LinphoneAddress *parsed_url2=NULL;
char *real_url=NULL;
- LinphoneProxyConfig *dest_proxy=NULL;
LinphoneCall *call;
bool_t use_ice = FALSE;
parsed_url2=linphone_address_new(from);
call=linphone_call_new_outgoing(lc,parsed_url2,linphone_address_clone(addr),params);
+ call->dest_proxy=dest_proxy;
sal_op_set_route(call->op,route);
if(linphone_core_add_call(lc,call)!= 0)
}
}
- if (dest_proxy==NULL && lc->sip_conf.ping_with_options==TRUE){
+ if (call->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_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 (use_ice==FALSE) linphone_core_start_invite(lc,call);
}
if (real_url!=NULL) ms_free(real_url);
**/
int linphone_core_accept_call_with_params(LinphoneCore *lc, LinphoneCall *call, const LinphoneCallParams *params)
{
- LinphoneProxyConfig *cfg=NULL,*dest_proxy=NULL;
+ LinphoneProxyConfig *cfg=NULL;
const char *contact=NULL;
SalOp *replaced;
SalMediaDescription *new_md;
}
linphone_core_get_default_proxy(lc,&cfg);
- dest_proxy=cfg;
- dest_proxy=linphone_core_lookup_known_proxy(lc,call->log->to);
+ call->dest_proxy=cfg;
+ call->dest_proxy=linphone_core_lookup_known_proxy(lc,call->log->to);
- if (cfg!=dest_proxy && dest_proxy!=NULL) {
+ if (cfg!=call->dest_proxy && call->dest_proxy!=NULL) {
ms_message("Overriding default proxy setting for this call:");
- ms_message("The used identity will be %s",linphone_proxy_config_get_identity(dest_proxy));
+ ms_message("The used identity will be %s",linphone_proxy_config_get_identity(call->dest_proxy));
}
/*try to be best-effort in giving real local or routable contact address*/
- contact=get_fixed_contact(lc,call,dest_proxy);
+ contact=get_fixed_contact(lc,call,call->dest_proxy);
if (contact)
sal_op_set_contact(call->op,contact);
void linphone_core_init_default_params(LinphoneCore*lc, LinphoneCallParams *params) {
params->has_video=linphone_core_video_enabled(lc) && lc->video_policy.automatically_initiate;
- params->media_encryption=linphone_core_get_media_encryption(lc);
+ params->media_encryption=linphone_core_get_media_encryption(lc);
params->in_conference=FALSE;
}
LinphoneCallState state;
LinphoneCallState transfer_state; /*idle if no transfer*/
LinphoneReason reason;
+ LinphoneProxyConfig *dest_proxy;
int refcnt;
void * user_pointer;
int audio_port;
LinphoneCallParams remote_params;
int up_bw; /*upload bandwidth setting at the time the call is started. Used to detect if it changes during a call */
int audio_bw; /*upload bandwidth used by audio */
+ OrtpEvQueue *audiostream_app_evq;
+ char *auth_token;
+ OrtpEvQueue *videostream_app_evq;
+ CallCallbackObj nextVideoFrameDecoded;
+ LinphoneCallStats stats[2];
+ IceSession *ice_session;
+ LinphoneChatMessage* pending_message;
+ int ping_time;
bool_t refer_pending;
bool_t media_pending;
bool_t audio_muted;
bool_t camera_active;
+
bool_t all_muted; /*this flag is set during early medias*/
bool_t playing_ringbacktone;
bool_t owns_call_log;
bool_t ringing_beep; /* whether this call is ringing through an already existent current call*/
- OrtpEvQueue *audiostream_app_evq;
- char *auth_token;
- OrtpEvQueue *videostream_app_evq;
+
bool_t videostream_encrypted;
bool_t audiostream_encrypted;
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;
- LinphoneChatMessage* pending_message;
};
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_invite(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_start_update_call(LinphoneCore *lc, LinphoneCall *call);
int linphone_core_start_accept_call_update(LinphoneCore *lc, LinphoneCall *call);
void linphone_core_start_refered_call(LinphoneCore *lc, LinphoneCall *call);