Commit d53f71aa authored by Sylvain Berfini's avatar Sylvain Berfini 🐮
Browse files

Merge branch 'master' into dev_audio_bypass

parents 137a48c0 a78509cf
......@@ -239,57 +239,62 @@ static void process_request_event(void *ud, const belle_sip_request_event_t *eve
ms_warning("Receiving request for null or terminated op [%p], ignored",op);
return;
}
}else if (strcmp("INVITE",method)==0) {
}else{
/*handle the case where we are receiving a request with to tag but it is not belonging to any dialog*/
belle_sip_header_to_t *to = belle_sip_message_get_header_by_type(req, belle_sip_header_to_t);
if (belle_sip_header_to_get_tag(to) != NULL){
ms_warning("Receiving INVITE with to-tag but no know dialog here. Rejecting.");
resp=belle_sip_response_create_from_request(req,481);
if (strcmp("INVITE",method)==0 || strcmp("NOTIFY",method)==0) {
belle_sip_header_to_t *to = belle_sip_message_get_header_by_type(req, belle_sip_header_to_t);
if (belle_sip_header_to_get_tag(to) != NULL){
ms_warning("Receiving %s with to-tag but no know dialog here. Rejecting.", method);
resp=belle_sip_response_create_from_request(req,481);
belle_sip_provider_send_response(sal->prov,resp);
return;
}
}
if (strcmp("INVITE",method)==0) {
op=sal_op_new(sal);
op->dir=SalOpDirIncoming;
sal_op_call_fill_cbs(op);
}else if ((strcmp("SUBSCRIBE",method)==0 || strcmp("NOTIFY",method)==0) && (evh=belle_sip_message_get_header(BELLE_SIP_MESSAGE(req),"Event"))!=NULL) {
op=sal_op_new(sal);
op->dir=SalOpDirIncoming;
if (strncmp(belle_sip_header_get_unparsed_value(evh),"presence",strlen("presence"))==0){
sal_op_presence_fill_cbs(op);
}else
sal_op_subscribe_fill_cbs(op);
}else if (strcmp("MESSAGE",method)==0) {
op=sal_op_new(sal);
op->dir=SalOpDirIncoming;
sal_op_message_fill_cbs(op);
}else if (strcmp("OPTIONS",method)==0) {
resp=belle_sip_response_create_from_request(req,200);
belle_sip_provider_send_response(sal->prov,resp);
return;
}else if (strcmp("INFO",method)==0) {
resp=belle_sip_response_create_from_request(req,481);/*INFO out of call dialogs are not allowed*/
belle_sip_provider_send_response(sal->prov,resp);
return;
}else if (strcmp("BYE",method)==0) {
resp=belle_sip_response_create_from_request(req,481);/*out of dialog BYE */
belle_sip_provider_send_response(sal->prov,resp);
return;
}else if (strcmp("CANCEL",method)==0) {
resp=belle_sip_response_create_from_request(req,481);/*out of dialog CANCEL */
belle_sip_provider_send_response(sal->prov,resp);
return;
}else if (sal->enable_test_features && strcmp("PUBLISH",method)==0) {
resp=belle_sip_response_create_from_request(req,200);/*out of dialog BYE */
belle_sip_message_add_header((belle_sip_message_t*)resp,belle_sip_header_create("SIP-Etag","4441929FFFZQOA"));
belle_sip_provider_send_response(sal->prov,resp);
return;
}else {
ms_error("sal process_request_event not implemented yet for method [%s]",belle_sip_request_get_method(req));
resp=belle_sip_response_create_from_request(req,405);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp)
,BELLE_SIP_HEADER(belle_sip_header_allow_create("INVITE, CANCEL, ACK, BYE, SUBSCRIBE, NOTIFY, MESSAGE, OPTIONS, INFO")));
belle_sip_provider_send_response(sal->prov,resp);
return;
}
op=sal_op_new(sal);
op->dir=SalOpDirIncoming;
sal_op_call_fill_cbs(op);
}else if ((strcmp("SUBSCRIBE",method)==0 || strcmp("NOTIFY",method)==0) && (evh=belle_sip_message_get_header(BELLE_SIP_MESSAGE(req),"Event"))!=NULL) {
op=sal_op_new(sal);
op->dir=SalOpDirIncoming;
if (strncmp(belle_sip_header_get_unparsed_value(evh),"presence",strlen("presence"))==0){
sal_op_presence_fill_cbs(op);
}else
sal_op_subscribe_fill_cbs(op);
}else if (strcmp("MESSAGE",method)==0) {
op=sal_op_new(sal);
op->dir=SalOpDirIncoming;
sal_op_message_fill_cbs(op);
}else if (strcmp("OPTIONS",method)==0) {
resp=belle_sip_response_create_from_request(req,200);
belle_sip_provider_send_response(sal->prov,resp);
return;
}else if (strcmp("INFO",method)==0) {
resp=belle_sip_response_create_from_request(req,481);/*INFO out of call dialogs are not allowed*/
belle_sip_provider_send_response(sal->prov,resp);
return;
}else if (strcmp("BYE",method)==0) {
resp=belle_sip_response_create_from_request(req,481);/*out of dialog BYE */
belle_sip_provider_send_response(sal->prov,resp);
return;
}else if (strcmp("CANCEL",method)==0) {
resp=belle_sip_response_create_from_request(req,481);/*out of dialog CANCEL */
belle_sip_provider_send_response(sal->prov,resp);
return;
}else if (sal->enable_test_features && strcmp("PUBLISH",method)==0) {
resp=belle_sip_response_create_from_request(req,200);/*out of dialog BYE */
belle_sip_message_add_header((belle_sip_message_t*)resp,belle_sip_header_create("SIP-Etag","4441929FFFZQOA"));
belle_sip_provider_send_response(sal->prov,resp);
return;
}else {
ms_error("sal process_request_event not implemented yet for method [%s]",belle_sip_request_get_method(req));
resp=belle_sip_response_create_from_request(req,405);
belle_sip_message_add_header(BELLE_SIP_MESSAGE(resp)
,BELLE_SIP_HEADER(belle_sip_header_allow_create("INVITE, CANCEL, ACK, BYE, SUBSCRIBE, NOTIFY, MESSAGE, OPTIONS, INFO")));
belle_sip_provider_send_response(sal->prov,resp);
return;
}
if (!op->base.from_address) {
......@@ -1010,7 +1015,7 @@ int sal_generate_uuid(char *uuid, size_t len) {
sal_uuid_t uuid_struct;
int i;
int written;
if (len==0) return -1;
/*create an UUID as described in RFC4122, 4.4 */
belle_sip_random_bytes((unsigned char*)&uuid_struct, sizeof(sal_uuid_t));
......
......@@ -126,7 +126,7 @@ static void add_rtcp_fb_attributes(belle_sdp_media_description_t *media_desc, co
uint16_t trr_int = 0;
general_trr_int = is_rtcp_fb_trr_int_the_same_for_all_payloads(stream, &trr_int);
if (general_trr_int == TRUE && trr_int != 0) {
if (general_trr_int == TRUE && trr_int != 0) {
add_rtcp_fb_trr_int_attribute(media_desc, -1, trr_int);
}
if (stream->rtcp_fb.generic_nack_enabled == TRUE) {
......@@ -737,7 +737,7 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md,
belle_sip_list_t *custom_attribute_it;
const char* value;
const char *mtype,*proto;
bool_t has_avpf_attributes;
bool_t has_avpf_attributes;
stream=&md->streams[md->nb_streams];
media=belle_sdp_media_description_get_media ( media_desc );
......@@ -850,16 +850,15 @@ static SalStreamDescription * sdp_to_stream_description(SalMediaDescription *md,
/* Get ICE candidate attributes if any */
sdp_parse_media_ice_parameters(media_desc, stream);
has_avpf_attributes = sdp_parse_rtcp_fb_parameters(media_desc, stream);
has_avpf_attributes = sdp_parse_rtcp_fb_parameters(media_desc, stream);
/* Get RTCP-FB attributes if any */
if (sal_stream_description_has_avpf(stream)) {
enable_avpf_for_stream(stream);
}else if (has_avpf_attributes ){
enable_avpf_for_stream(stream);
stream->implicit_rtcp_fb = TRUE;
}
else if (has_avpf_attributes ){
stream->implicit_rtcp_fb = TRUE;
}
/* Get RTCP-XR attributes if any */
stream->rtcp_xr = md->rtcp_xr; // Use session parameters if no stream parameters are defined
......
......@@ -495,7 +495,7 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o
if (call->params->internal_call_update)
call->params->internal_call_update = FALSE;
#ifdef BUILD_UPNP
if (call->upnp_session != NULL && rmd) {
linphone_core_update_upnp_from_remote_media_description(call, rmd);
......@@ -511,12 +511,12 @@ static void process_call_accepted(LinphoneCore *lc, LinphoneCall *call, SalOp *o
md = NULL;
}
if (md){ /*there is a valid SDP in the response, either offer or answer, and we're able to start/update the streams*/
/* Handle remote ICE attributes if any. */
if (call->ice_session != NULL && rmd) {
linphone_call_update_ice_from_remote_media_description(call, rmd, FALSE);
}
switch (call->state){
case LinphoneCallResuming:
linphone_core_notify_display_status(lc,_("Call resumed."));
......@@ -1063,7 +1063,7 @@ static void refer_received(Sal *sal, SalOp *op, const char *referto){
LinphoneCall *call=(LinphoneCall*)sal_op_get_user_pointer(op);
LinphoneAddress *refer_to_addr = linphone_address_new(referto);
char method[20] = "";
if(refer_to_addr) {
const char *tmp = linphone_address_get_method_param(refer_to_addr);
if(tmp) strncpy(method, tmp, sizeof(method));
......@@ -1131,7 +1131,7 @@ static void parse_presence_requested(SalOp *op, const char *content_type, const
static void convert_presence_to_xml_requested(SalOp *op, SalPresenceModel *presence, const char *contact, char **content) {
/*for backward compatibility because still used by notify. No loguer used for publish*/
if(linphone_presence_model_get_presentity((LinphonePresenceModel*)presence) == NULL) {
LinphoneAddress * presentity = linphone_address_new(contact);
linphone_presence_model_set_presentity((LinphonePresenceModel*)presence, presentity);
......@@ -1313,8 +1313,8 @@ static void subscribe_response(SalOp *op, SalSubscribeStatus status){
static void notify(SalOp *op, SalSubscribeStatus st, const char *eventname, SalBodyHandler *body_handler){
LinphoneEvent *lev=(LinphoneEvent*)sal_op_get_user_pointer(op);
LinphoneCore *lc=(LinphoneCore *)sal_get_user_pointer(sal_op_get_sal(op));
if (lev==NULL) {
bool_t out_of_dialog = (lev==NULL);
if (out_of_dialog) {
/*out of subscribe notify */
lev=linphone_event_new_with_out_of_dialog_op(lc,op,LinphoneSubscriptionOutgoing,eventname);
}
......@@ -1328,6 +1328,11 @@ static void notify(SalOp *op, SalSubscribeStatus st, const char *eventname, SalB
if (st!=SalSubscribeNone){
linphone_event_set_state(lev,linphone_subscription_state_from_sal(st));
}
if (out_of_dialog) {
linphone_event_unref(lev);
}
}
static void subscribe_received(SalOp *op, const char *eventname, const SalBodyHandler *body_handler){
......
......@@ -332,7 +332,17 @@ const char* linphone_event_get_custom_header(LinphoneEvent* ev, const char* name
void linphone_event_terminate(LinphoneEvent *lev){
// if event was already terminated (including on error), we should not terminate it again
// otherwise it will be unreffed twice.
if (lev->publish_state == LinphonePublishError || lev->publish_state == LinphonePublishCleared) {
return;
}
if (lev->subscription_state == LinphoneSubscriptionError || lev->subscription_state == LinphoneSubscriptionTerminated) {
return;
}
lev->terminating=TRUE;
if (lev->dir==LinphoneSubscriptionIncoming){
sal_notify_close(lev->op);
}else if (lev->dir==LinphoneSubscriptionOutgoing){
......@@ -404,10 +414,10 @@ LinphoneCore *linphone_event_get_core(const LinphoneEvent *lev){
static belle_sip_error_code _linphone_event_marshall(belle_sip_object_t *obj, char* buff, size_t buff_size, size_t *offset) {
LinphoneEvent *ev = (LinphoneEvent*)obj;
belle_sip_error_code err = BELLE_SIP_OK;
err = belle_sip_snprintf(buff, buff_size, offset, "%s of %s", ev->dir == LinphoneSubscriptionIncoming ?
err = belle_sip_snprintf(buff, buff_size, offset, "%s of %s", ev->dir == LinphoneSubscriptionIncoming ?
"Incoming Subscribe" : (ev->dir == LinphoneSubscriptionOutgoing ? "Outgoing subscribe" : "Publish"), ev->name);
return err;
}
......
......@@ -1005,6 +1005,10 @@ bool_t linphone_friend_create_vcard(LinphoneFriend *fr, const char *name) {
return TRUE;
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) {
LinphoneAddress* linphone_address = NULL;
LinphoneFriend *fr;
......@@ -1018,14 +1022,7 @@ LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) {
name = linphone_vcard_get_full_name(vcard);
sipAddresses = linphone_vcard_get_sip_addresses(vcard);
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
fr = linphone_friend_new();
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
// Currently presence takes too much time when dealing with hundreds of friends, so I disabled it for now
fr->pol = LinphoneSPDeny;
fr->subscribe = FALSE;
......@@ -1046,6 +1043,9 @@ LinphoneFriend *linphone_friend_new_from_vcard(LinphoneVcard *vcard) {
return fr;
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
/*drops all references to the core and unref*/
void _linphone_friend_release(LinphoneFriend *lf){
......@@ -1172,6 +1172,10 @@ static int create_friend_list(void *data, int argc, char **argv, char **colName)
return 0;
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
/* DB layout:
* | 0 | storage_id
* | 1 | friend_list_id
......@@ -1198,14 +1202,7 @@ static int create_friend(void *data, int argc, char **argv, char **colName) {
}
if (!lf) {
LinphoneAddress *addr = linphone_address_new(argv[2]);
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
lf = linphone_friend_new();
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
linphone_friend_set_address(lf, addr);
linphone_address_unref(addr);
}
......@@ -1219,6 +1216,9 @@ static int create_friend(void *data, int argc, char **argv, char **colName) {
linphone_friend_unref(lf);
return 0;
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
static int linphone_sql_request_friend(sqlite3* db, const char *stmt, MSList **list) {
char* errmsg = NULL;
......
......@@ -285,7 +285,7 @@ static bool_t linphone_friend_list_has_subscribe_inactive(const LinphoneFriendLi
static LinphoneFriendList * linphone_friend_list_new(void) {
LinphoneFriendList *list = belle_sip_object_new(LinphoneFriendList);
list->cbs = linphone_friend_list_cbs_new();
list->enable_subscriptions = FALSE;
list->enable_subscriptions = TRUE;
belle_sip_object_ref(list);
return list;
}
......@@ -619,48 +619,52 @@ static void linphone_friend_list_close_subscriptions(LinphoneFriendList *list) {
void linphone_friend_list_update_subscriptions(LinphoneFriendList *list, LinphoneProxyConfig *cfg, bool_t only_when_registered) {
const MSList *elem;
if (list->enable_subscriptions && list->rls_uri != NULL) {
LinphoneAddress *address = linphone_address_new(list->rls_uri);
char *xml_content = create_resource_list_xml(list);
if ((address != NULL) && (xml_content != NULL) && (linphone_friend_list_has_subscribe_inactive(list) == TRUE)) {
unsigned char digest[16];
bctoolbox_md5((unsigned char *)xml_content, strlen(xml_content), digest);
if ((list->event != NULL) && (list->content_digest != NULL) && (memcmp(list->content_digest, digest, sizeof(digest)) == 0)) {
/* The content has not changed, only refresh the event. */
linphone_event_refresh_subscribe(list->event);
} else {
LinphoneContent *content;
int expires = lp_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600);
list->expected_notification_version = 0;
if (list->content_digest != NULL) ms_free(list->content_digest);
list->content_digest = ms_malloc(sizeof(digest));
memcpy(list->content_digest, digest, sizeof(digest));
if (list->event != NULL) {
linphone_event_terminate(list->event);
linphone_event_unref(list->event);
}
list->event = linphone_core_create_subscribe(list->lc, address, "presence", expires);
linphone_event_ref(list->event);
linphone_event_set_internal(list->event, TRUE);
linphone_event_add_custom_header(list->event, "Require", "recipient-list-subscribe");
linphone_event_add_custom_header(list->event, "Supported", "eventlist");
linphone_event_add_custom_header(list->event, "Accept", "multipart/related, application/pidf+xml, application/rlmi+xml");
linphone_event_add_custom_header(list->event, "Content-Disposition", "recipient-list");
content = linphone_core_create_content(list->lc);
linphone_content_set_type(content, "application");
linphone_content_set_subtype(content, "resource-lists+xml");
linphone_content_set_string_buffer(content, xml_content);
if (linphone_core_content_encoding_supported(list->lc, "deflate")) {
linphone_content_set_encoding(content, "deflate");
linphone_event_add_custom_header(list->event, "Accept-Encoding", "deflate");
if (list->rls_uri != NULL) {
if (list->enable_subscriptions) {
LinphoneAddress *address = linphone_address_new(list->rls_uri);
char *xml_content = create_resource_list_xml(list);
if ((address != NULL) && (xml_content != NULL) && (linphone_friend_list_has_subscribe_inactive(list) == TRUE)) {
unsigned char digest[16];
bctoolbox_md5((unsigned char *)xml_content, strlen(xml_content), digest);
if ((list->event != NULL) && (list->content_digest != NULL) && (memcmp(list->content_digest, digest, sizeof(digest)) == 0)) {
/* The content has not changed, only refresh the event. */
linphone_event_refresh_subscribe(list->event);
} else {
LinphoneContent *content;
int expires = lp_config_get_int(list->lc->config, "sip", "rls_presence_expires", 3600);
list->expected_notification_version = 0;
if (list->content_digest != NULL) ms_free(list->content_digest);
list->content_digest = ms_malloc(sizeof(digest));
memcpy(list->content_digest, digest, sizeof(digest));
if (list->event != NULL) {
linphone_event_terminate(list->event);
linphone_event_unref(list->event);
}
list->event = linphone_core_create_subscribe(list->lc, address, "presence", expires);
linphone_event_ref(list->event);
linphone_event_set_internal(list->event, TRUE);
linphone_event_add_custom_header(list->event, "Require", "recipient-list-subscribe");
linphone_event_add_custom_header(list->event, "Supported", "eventlist");
linphone_event_add_custom_header(list->event, "Accept", "multipart/related, application/pidf+xml, application/rlmi+xml");
linphone_event_add_custom_header(list->event, "Content-Disposition", "recipient-list");
content = linphone_core_create_content(list->lc);
linphone_content_set_type(content, "application");
linphone_content_set_subtype(content, "resource-lists+xml");
linphone_content_set_string_buffer(content, xml_content);
if (linphone_core_content_encoding_supported(list->lc, "deflate")) {
linphone_content_set_encoding(content, "deflate");
linphone_event_add_custom_header(list->event, "Accept-Encoding", "deflate");
}
linphone_event_send_subscribe(list->event, content);
linphone_content_unref(content);
linphone_event_set_user_data(list->event, list);
}
linphone_event_send_subscribe(list->event, content);
linphone_content_unref(content);
linphone_event_set_user_data(list->event, list);
}
if (address != NULL) linphone_address_unref(address);
if (xml_content != NULL) ms_free(xml_content);
} else {
ms_message("Friends list [%p] subscription update skipped since subscriptions not enabled yet", list);
}
if (address != NULL) linphone_address_unref(address);
if (xml_content != NULL) ms_free(xml_content);
} else {
for (elem = list->friends; elem != NULL; elem = elem->next) {
LinphoneFriend *lf = (LinphoneFriend *)elem->data;
......
......@@ -735,10 +735,10 @@ void linphone_call_make_local_media_description(LinphoneCall *call) {
/*set audio capabilities */
codec_hints.bandwidth_limit=params->audio_bw;
codec_hints.max_codecs=-1;
codec_hints.previously_used=old_md ? old_md->streams[call->main_audio_stream_index].already_assigned_payloads : NULL;
l=make_codec_list(lc, &codec_hints, SalAudio, lc->codecs_conf.audio_codecs);
codec_hints.bandwidth_limit=params->audio_bw;
codec_hints.max_codecs=-1;
codec_hints.previously_used=old_md ? old_md->streams[call->main_audio_stream_index].already_assigned_payloads : NULL;
l=make_codec_list(lc, &codec_hints, SalAudio, lc->codecs_conf.audio_codecs);
if (params->has_audio && l != NULL) {
strncpy(md->streams[call->main_audio_stream_index].rtp_addr,linphone_call_get_public_ip_for_stream(call,call->main_audio_stream_index),sizeof(md->streams[call->main_audio_stream_index].rtp_addr));
......@@ -1503,7 +1503,14 @@ void linphone_call_fix_call_parameters(LinphoneCall *call, SalMediaDescription *
if (rmd) {
linphone_call_compute_streams_indexes(call, rmd);
linphone_call_update_biggest_desc(call, rmd);
call->params->implicit_rtcp_fb &= sal_media_description_has_implicit_avpf(rmd);
/* Why disabling implicit_rtcp_fb ? It is a local policy choice actually. It doesn't disturb to propose it again and again
* even if the other end apparently doesn't support it.
* The following line of code is causing trouble, while for example making an audio call, then adding video.
* Due to the 200Ok response of the audio-only offer where no rtcp-fb attribute is present, implicit_rtcp_fb is set to
* FALSE, which is then preventing it to be eventually used when video is later added to the call.
* I did the choice of commenting it out.
*/
/*call->params->implicit_rtcp_fb &= sal_media_description_has_implicit_avpf(rmd);*/
}
rcp = linphone_call_get_remote_params(call);
if (rcp){
......@@ -1827,9 +1834,9 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
} else {
call->current_params->media_encryption=LinphoneMediaEncryptionNone;
}
break;
break;
}
call->current_params->avpf_enabled = linphone_call_all_streams_avpf_enabled(call) && sal_media_description_has_avpf(md);
call->current_params->avpf_enabled = linphone_call_all_streams_avpf_enabled(call) && sal_media_description_has_avpf(md);
if (call->current_params->avpf_enabled == TRUE) {
call->current_params->avpf_rr_interval = linphone_call_get_avpf_rr_interval(call);
} else {
......@@ -1848,7 +1855,7 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
call->current_params->audio_multicast_enabled = FALSE;
sd=sal_media_description_find_best_stream(md,SalVideo);
call->current_params->implicit_rtcp_fb = sd ? sal_stream_description_has_implicit_avpf(sd): FALSE;
call->current_params->implicit_rtcp_fb = sd ? sal_stream_description_has_implicit_avpf(sd): FALSE;
call->current_params->video_dir=sd ? media_direction_from_sal_stream_dir(sd->dir) : LinphoneMediaDirectionInactive;
if (call->current_params->video_dir != LinphoneMediaDirectionInactive) {
rtp_addr = sd->rtp_addr[0]!='\0' ? sd->rtp_addr : call->resultdesc->addr;
......@@ -1856,8 +1863,6 @@ const LinphoneCallParams * linphone_call_get_current_params(LinphoneCall *call){
} else
call->current_params->video_multicast_enabled = FALSE;
}
return call->current_params;
......@@ -4348,27 +4353,16 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
OrtpEventData *evd=ortp_event_get_data(ev);
if (evt == ORTP_EVENT_ICE_SESSION_PROCESSING_FINISHED) {
LinphoneCallParams *params = linphone_call_params_copy(call->current_params);
switch (call->params->media_encryption) {
case LinphoneMediaEncryptionZRTP:
case LinphoneMediaEncryptionDTLS:
/* preserve media encryption param because at that time ZRTP/SRTP-DTLS negociation may still be ongoing*/
params->media_encryption=call->params->media_encryption;
break;
case LinphoneMediaEncryptionSRTP:
case LinphoneMediaEncryptionNone:
/*keep all values to make sure a warning will be generated by compiler if new enum value is added*/
break;
}
switch (ice_session_state(call->ice_session)) {
case IS_Completed:
case IS_Failed:
/* At least one ICE session has succeeded, so perform a call update. */
if (ice_session_has_completed_check_list(call->ice_session) == TRUE) {
if (ice_session_role(call->ice_session) == IR_Controlling && params->update_call_when_ice_completed ) {
if (ice_session_role(call->ice_session) == IR_Controlling && call->params->update_call_when_ice_completed ) {
LinphoneCallParams *params = linphone_core_create_call_params(call->core, call);
params->internal_call_update = TRUE;
linphone_core_update_call(call->core, call, params);
linphone_call_params_unref(params);
}
start_dtls_on_all_streams(call);
}
......@@ -4376,9 +4370,7 @@ static void handle_ice_events(LinphoneCall *call, OrtpEvent *ev){
default:
break;
}
linphone_core_update_ice_state_in_call_stats(call);
linphone_call_params_unref(params);
} else if (evt == ORTP_EVENT_ICE_GATHERING_FINISHED) {
if (evd->info.ice_processing_successful==FALSE) {
ms_warning("No STUN answer from [%s], continuing without STUN",linphone_core_get_stun_server(call->core));
......
......@@ -1571,6 +1571,8 @@ void linphone_core_reload_ms_plugins(LinphoneCore *lc, const char *path){
}
static void linphone_core_start(LinphoneCore * lc) {
linphone_core_add_friend_list(lc, NULL);
sip_setup_register_all(lc->factory);
sound_config_read(lc);
net_config_read(lc);
......@@ -1588,6 +1590,7 @@ static void linphone_core_start(LinphoneCore * lc) {
}
#endif
linphone_core_notify_display_status(lc,_("Ready"));
lc->auto_net_state_mon=lc->sip_conf.auto_net_state_mon;
linphone_core_set_state(lc,LinphoneGlobalOn,"Ready");
......@@ -1702,7 +1705,7 @@ static void linphone_core_internal_notify_received(LinphoneCore *lc, LinphoneEve
const MSList* friendLists = linphone_core_get_friends_lists(lc);
while( friendLists != NULL ){
LinphoneFriendList* list = friendLists->data;
ms_warning("notify presence for list %p", list);
ms_message("notify presence for list %p", list);
linphone_friend_list_notify_presence_received(list, lev, body);
friendLists = friendLists->next;
}
......@@ -1726,8 +1729,6 @@ static void linphone_core_init(LinphoneCore * lc, const LinphoneCoreVTable *vtab
lc->data=userdata;
lc->ringstream_autorelease=TRUE;
linphone_core_add_friend_list(lc, NULL);
linphone_task_list_init(&lc->hooks);
internal_vtable->notify_received = linphone_core_internal_notify_received;
......@@ -2781,7 +2782,7 @@ void linphone_core_iterate(LinphoneCore *lc){
if (elapsed>lc->sip_conf.inc_timeout){
LinphoneReason decline_reason;
ms_message("incoming call timeout (%i)",lc->sip_conf.inc_timeout);
decline_reason=lc->current_call ? LinphoneReasonBusy : LinphoneReasonDeclined;
decline_reason = (lc->current_call != call) ? LinphoneReasonBusy : LinphoneReasonDeclined;
call->log->status=LinphoneCallMissed;
sal_error_info_set(&call->non_op_error,SalReasonRequestTimeout,408,"Not answered",NULL);
linphone_core_decline_call(lc,call,decline_reason);
......@@ -6512,7 +6513,7 @@ static void codecs_config_uninit(LinphoneCore *lc)
ms_list_free_with_data(lc->codecs_conf.text_codecs, (void (*)(void*))payload_type_destroy);
}
void ui_config_uninit(LinphoneCore* lc)
void friends_config_uninit(LinphoneCore* lc)
{
ms_message("Destroying friends.");
lc->friends_lists = ms_list_free_with_data(lc->friends_lists, (void (*)(void*))_linphone_friend_list_release);
......@@ -6554,19 +6555,19 @@ static void linphone_core_uninit(LinphoneCore *lc)
LinphoneCall *the_call = lc->calls->data;
linphone_core_terminate_call(lc,the_call);
linphone_core_iterate(lc);
ms_usleep(50000);
ms_usleep(10000);
}
for (elem = lc->friends_lists; elem != NULL; elem = ms_list_next(elem)) {
LinphoneFriendList *list = (LinphoneFriendList *)elem->data;
linphone_friend_list_enable_subscriptions(list, FALSE);
linphone_friend_list_enable_subscriptions(list,FALSE);