diff --git a/coreapi/CMakeLists.txt b/coreapi/CMakeLists.txt index f53b41c06..ba5277382 100644 --- a/coreapi/CMakeLists.txt +++ b/coreapi/CMakeLists.txt @@ -35,6 +35,7 @@ set(LINPHONE_HEADER_FILES buffer.h call_log.h call_params.h + conference.h content.h event.h friendlist.h diff --git a/coreapi/Makefile.am b/coreapi/Makefile.am index 0dd8febe0..353071c07 100644 --- a/coreapi/Makefile.am +++ b/coreapi/Makefile.am @@ -29,6 +29,7 @@ linphone_include_HEADERS=\ buffer.h \ call_log.h \ call_params.h \ + conference.h \ content.h \ event.h \ friendlist.h \ @@ -57,7 +58,7 @@ liblinphone_la_SOURCES=\ call_params.c \ chat.c \ chat_file_transfer.c \ - conference.cc conference.h conference_private.h \ + conference.cc conference_private.h \ contactprovider.c contactprovider.h contact_providers_priv.h \ content.c \ dict.c \ diff --git a/coreapi/bellesip_sal/sal_sdp.c b/coreapi/bellesip_sal/sal_sdp.c index 126aca340..80cfb032b 100644 --- a/coreapi/bellesip_sal/sal_sdp.c +++ b/coreapi/bellesip_sal/sal_sdp.c @@ -320,7 +320,7 @@ static void stream_description_to_sdp ( belle_sdp_session_description_t *session belle_sdp_media_description_add_attribute(media_desc,belle_sdp_attribute_create ("rtcp",buffer)); } } - if (stream->ice_completed == TRUE) { + if (stream->set_nortpproxy == TRUE) { belle_sdp_media_description_add_attribute(media_desc,belle_sdp_attribute_create ("nortpproxy","yes")); } if (stream->ice_mismatch == TRUE) { @@ -423,7 +423,7 @@ belle_sdp_session_description_t * media_description_to_sdp ( const SalMediaDescr belle_sdp_session_description_set_bandwidth ( session_desc,"AS",desc->bandwidth ); } - if (desc->ice_completed == TRUE) belle_sdp_session_description_add_attribute(session_desc, belle_sdp_attribute_create("nortpproxy","yes")); + if (desc->set_nortpproxy == TRUE) belle_sdp_session_description_add_attribute(session_desc, belle_sdp_attribute_create("nortpproxy","yes")); if (desc->ice_pwd[0] != '\0') belle_sdp_session_description_add_attribute(session_desc, belle_sdp_attribute_create("ice-pwd",desc->ice_pwd)); if (desc->ice_ufrag[0] != '\0') belle_sdp_session_description_add_attribute(session_desc, belle_sdp_attribute_create("ice-ufrag",desc->ice_ufrag)); diff --git a/coreapi/conference.h b/coreapi/conference.h index 90da4b0b7..a043a8a33 100644 --- a/coreapi/conference.h +++ b/coreapi/conference.h @@ -37,6 +37,11 @@ extern "C" { * @{ */ +/** + * Parameters for initialization of conferences + */ +typedef struct _LinphoneCorferenceParams LinphoneConferenceParams; + /** * Create a #LinphoneConferenceParams with default parameters set. * @param core #LinphoneCore to use to find out the default parameters. Can be NULL. @@ -67,6 +72,12 @@ LINPHONE_PUBLIC void linphone_conference_params_enable_video(LinphoneConferenceP LINPHONE_PUBLIC bool_t linphone_conference_params_video_requested(const LinphoneConferenceParams *params); + +/** + * LinphoneConference class + */ +typedef struct _LinphoneConference LinphoneConference; + /** * Remove a participant from a conference * @param obj A #LinphoneConference diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c index b29ebe941..76747b7b5 100644 --- a/coreapi/linphonecall.c +++ b/coreapi/linphonecall.c @@ -579,8 +579,11 @@ void linphone_call_increment_local_media_description(LinphoneCall *call){ } void linphone_call_update_local_media_description_from_ice_or_upnp(LinphoneCall *call){ + LinphoneCore *lc = call->core; if (call->ice_session != NULL) { - _update_local_media_description_from_ice(call->localdesc, call->ice_session); + /*set this to FALSE once flexisip are updated*/ + bool_t use_nortpproxy = lp_config_get_int(lc->config, "sip", "ice_uses_nortpproxy", TRUE); + _update_local_media_description_from_ice(call->localdesc, call->ice_session, use_nortpproxy); linphone_core_update_ice_state_in_call_stats(call); } #ifdef BUILD_UPNP diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index a99aa7ef1..02ea2c21b 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -288,24 +288,19 @@ static void linphone_core_log_collection_handler(OrtpLogLevel level, const char ortp_gettimeofday(&tp, NULL); tt = (time_t)tp.tv_sec; lt = localtime((const time_t*)&tt); - switch(level){ - case ORTP_DEBUG: - lname = "DEBUG"; - break; - case ORTP_MESSAGE: - lname = "MESSAGE"; - break; - case ORTP_WARNING: - lname = "WARNING"; - break; - case ORTP_ERROR: - lname = "ERROR"; - break; - case ORTP_FATAL: - lname = "FATAL"; - break; - default: - ortp_fatal("Bad level !"); + + if ((level & ORTP_DEBUG) != 0) { + lname = "DEBUG"; + } else if ((level & ORTP_MESSAGE) != 0) { + lname = "MESSAGE"; + } else if ((level & ORTP_WARNING) != 0) { + lname = "WARNING"; + } else if ((level & ORTP_ERROR) != 0) { + lname = "ERROR"; + } else if ((level & ORTP_FATAL) != 0) { + lname = "FATAL"; + } else { + ortp_fatal("Bad level !"); } msg = ortp_strdup_vprintf(fmt, args); @@ -726,42 +721,17 @@ void linphone_core_reset_log_collection(void) { ortp_mutex_unlock(&liblinphone_log_collection_mutex); } -/** - * Enable logs in supplied FILE*. - * - * @ingroup misc - * @deprecated Use #linphone_core_set_log_file and #linphone_core_set_log_level instead. - * - * @param file a C FILE* where to fprintf logs. If null stdout is used. - * -**/ void linphone_core_enable_logs(FILE *file){ if (file==NULL) file=stdout; ortp_set_log_file(file); linphone_core_set_log_level(ORTP_MESSAGE); } -/** - * Enable logs through the user's supplied log callback. - * - * @ingroup misc - * @deprecated Use #linphone_core_set_log_handler and #linphone_core_set_log_level instead. - * - * @param logfunc The address of a OrtpLogFunc callback whose protoype is - * typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args); - * -**/ void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc){ linphone_core_set_log_level(ORTP_MESSAGE); linphone_core_set_log_handler(logfunc); } -/** - * Entirely disable logging. - * - * @ingroup misc - * @deprecated Use #linphone_core_set_log_level instead. -**/ void linphone_core_disable_logs(void){ linphone_core_set_log_level(ORTP_ERROR); } diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index 07ce58813..0fb78538e 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -66,18 +66,6 @@ struct _LinphoneInfoMessage; */ typedef struct _LinphoneCore LinphoneCore; -/** - * Internal object of LinphoneCore representing a conference - * @ingroup call_control - */ -typedef struct _LinphoneConference LinphoneConference; - -/** - * Parameters for initialization of conferences - * @ingroup call_control - */ -typedef struct _LinphoneCorferenceParams LinphoneConferenceParams; - /** * Disable a sip transport @@ -423,6 +411,7 @@ LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy); #include "event.h" #include "linphonefriend.h" #include "xmlrpc.h" +#include "conference.h" #else #include "linphone/buffer.h" #include "linphone/call_log.h" @@ -431,6 +420,7 @@ LINPHONE_PUBLIC const char* linphone_privacy_to_string(LinphonePrivacy privacy); #include "linphone/event.h" #include "linphone/linphonefriend.h" #include "linphone/xmlrpc.h" +#include "linphone/conference.h" #endif LINPHONE_PUBLIC LinphoneAddress * linphone_address_new(const char *addr); @@ -2313,8 +2303,36 @@ LINPHONE_PUBLIC void linphone_core_set_log_level(OrtpLogLevel loglevel); * @param loglevel A bitmask of the log levels to set. */ LINPHONE_PUBLIC void linphone_core_set_log_level_mask(OrtpLogLevel loglevel); + +/** + * Enable logs in supplied FILE*. + * + * @ingroup misc + * @deprecated Use #linphone_core_set_log_file and #linphone_core_set_log_level instead. + * + * @param file a C FILE* where to fprintf logs. If null stdout is used. + * +**/ LINPHONE_PUBLIC void linphone_core_enable_logs(FILE *file); + +/** + * Enable logs through the user's supplied log callback. + * + * @ingroup misc + * @deprecated Use #linphone_core_set_log_handler and #linphone_core_set_log_level instead. + * + * @param logfunc The address of a OrtpLogFunc callback whose protoype is + * typedef void (*OrtpLogFunc)(OrtpLogLevel lev, const char *fmt, va_list args); + * +**/ LINPHONE_PUBLIC void linphone_core_enable_logs_with_cb(OrtpLogFunc logfunc); + +/** + * Entirely disable logging. + * + * @ingroup misc + * @deprecated Use #linphone_core_set_log_level instead. +**/ LINPHONE_PUBLIC void linphone_core_disable_logs(void); /** diff --git a/coreapi/misc.c b/coreapi/misc.c index 2537394ce..b80a437b9 100644 --- a/coreapi/misc.c +++ b/coreapi/misc.c @@ -807,7 +807,7 @@ void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDes linphone_core_update_ice_state_in_call_stats(call); } -void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session) { +void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session, bool_t use_nortpproxy) { const char *rtp_addr, *rtcp_addr; IceSessionState session_state = ice_session_state(session); int nb_candidates; @@ -815,7 +815,7 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess bool_t result; if (session_state == IS_Completed) { - desc->ice_completed = TRUE; + if (use_nortpproxy) desc->set_nortpproxy = TRUE; result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, 0), &rtp_addr, NULL, NULL, NULL); if (result == TRUE) { strncpy(desc->addr, rtp_addr, sizeof(desc->addr)); @@ -824,7 +824,7 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess } } else { - desc->ice_completed = FALSE; + desc->set_nortpproxy = FALSE; } strncpy(desc->ice_pwd, ice_session_local_pwd(session), sizeof(desc->ice_pwd)); strncpy(desc->ice_ufrag, ice_session_local_ufrag(session), sizeof(desc->ice_ufrag)); @@ -834,10 +834,10 @@ void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSess nb_candidates = 0; if (!sal_stream_description_active(stream) || (cl == NULL)) continue; if (ice_check_list_state(cl) == ICL_Completed) { - stream->ice_completed = TRUE; + if (use_nortpproxy) stream->set_nortpproxy = TRUE; result = ice_check_list_selected_valid_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port); } else { - stream->ice_completed = FALSE; + stream->set_nortpproxy = FALSE; result = ice_check_list_default_local_candidate(ice_session_check_list(session, i), &rtp_addr, &stream->rtp_port, &rtcp_addr, &stream->rtcp_port); } if (result == TRUE) { @@ -1179,6 +1179,16 @@ static int get_local_ip_with_getifaddrs(int type, char *address, int size){ } #endif +static const char *ai_family_to_string(int af){ + switch(af){ + case AF_INET: return "AF_INET"; + case AF_INET6: return "AF_INET6"; + case AF_UNSPEC: return "AF_UNSPEC"; + default: + return "invalid address family"; + } + return ""; +} static int get_local_ip_for_with_connect(int type, const char *dest, char *result){ int err,tmp; @@ -1203,13 +1213,18 @@ static int get_local_ip_for_with_connect(int type, const char *dest, char *resul return -1; } sock=socket(res->ai_family,SOCK_DGRAM,0); + if (sock == (ortp_socket_t)-1){ + ms_error("get_local_ip_for_with_connect() could not create [%s] socket: %s", + ai_family_to_string(res->ai_family), getSocketError()); + return -1; + } tmp=1; err=setsockopt(sock,SOL_SOCKET,SO_REUSEADDR,(SOCKET_OPTION_VALUE)&tmp,sizeof(int)); - if (err<0){ + if (err == -1){ ms_warning("Error in setsockopt: %s",strerror(errno)); } err=connect(sock,res->ai_addr,(int)res->ai_addrlen); - if (err<0) { + if (err == -1) { /*the network isn't reachable*/ if (getSocketErrorCode()!=ENETUNREACH) ms_error("Error in connect: %s",strerror(errno)); freeaddrinfo(res); diff --git a/coreapi/offeranswer.c b/coreapi/offeranswer.c index 7616b3499..bc115001a 100644 --- a/coreapi/offeranswer.c +++ b/coreapi/offeranswer.c @@ -485,7 +485,7 @@ static void initiate_incoming(const SalStreamDescription *local_cap, strcpy(result->ice_pwd, local_cap->ice_pwd); strcpy(result->ice_ufrag, local_cap->ice_ufrag); result->ice_mismatch = local_cap->ice_mismatch; - result->ice_completed = local_cap->ice_completed; + result->set_nortpproxy = local_cap->set_nortpproxy; memcpy(result->ice_candidates, local_cap->ice_candidates, sizeof(result->ice_candidates)); memcpy(result->ice_remote_candidates, local_cap->ice_remote_candidates, sizeof(result->ice_remote_candidates)); strcpy(result->name,local_cap->name); @@ -603,7 +603,7 @@ int offer_answer_initiate_incoming(const SalMediaDescription *local_capabilities strcpy(result->ice_pwd, local_capabilities->ice_pwd); strcpy(result->ice_ufrag, local_capabilities->ice_ufrag); result->ice_lite = local_capabilities->ice_lite; - result->ice_completed = local_capabilities->ice_completed; + result->set_nortpproxy = local_capabilities->set_nortpproxy; result->custom_sdp_attributes = sal_custom_sdp_attribute_clone(local_capabilities->custom_sdp_attributes); strcpy(result->name,local_capabilities->name); diff --git a/coreapi/private.h b/coreapi/private.h index d3e3b9a7a..f866f7477 100644 --- a/coreapi/private.h +++ b/coreapi/private.h @@ -485,7 +485,7 @@ int linphone_core_gather_ice_candidates(LinphoneCore *lc, LinphoneCall *call); void linphone_core_update_ice_state_in_call_stats(LinphoneCall *call); void linphone_call_stats_fill(LinphoneCallStats *stats, MediaStream *ms, OrtpEvent *ev); void linphone_call_stop_ice_for_inactive_streams(LinphoneCall *call, SalMediaDescription *result); -void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session); +void _update_local_media_description_from_ice(SalMediaDescription *desc, IceSession *session, bool_t use_nortpproxy); void linphone_call_update_local_media_description_from_ice_or_upnp(LinphoneCall *call); void linphone_call_update_ice_from_remote_media_description(LinphoneCall *call, const SalMediaDescription *md); void linphone_call_clear_unused_ice_candidates(LinphoneCall *call, const SalMediaDescription *md); diff --git a/include/sal/sal.h b/include/sal/sal.h index 721cefbea..58c63f0c5 100644 --- a/include/sal/sal.h +++ b/include/sal/sal.h @@ -246,8 +246,8 @@ typedef struct SalStreamDescription{ SalSrtpCryptoAlgo crypto[SAL_CRYPTO_ALGO_MAX]; unsigned int crypto_local_tag; int max_rate; - bool_t implicit_rtcp_fb; - OrtpRtcpFbConfiguration rtcp_fb; + bool_t implicit_rtcp_fb; + OrtpRtcpFbConfiguration rtcp_fb; OrtpRtcpXrConfiguration rtcp_xr; SalCustomSdpAttribute *custom_sdp_attributes; SalIceCandidate ice_candidates[SAL_MEDIA_DESCRIPTION_MAX_ICE_CANDIDATES]; @@ -255,7 +255,7 @@ typedef struct SalStreamDescription{ char ice_ufrag[SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN]; char ice_pwd[SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN]; bool_t ice_mismatch; - bool_t ice_completed; + bool_t set_nortpproxy; /*Formely set by ICE to indicate to the proxy that it has nothing to do*/ bool_t rtcp_mux; bool_t pad[1]; char dtls_fingerprint[256]; @@ -285,7 +285,7 @@ typedef struct SalMediaDescription{ char ice_ufrag[SAL_MEDIA_DESCRIPTION_MAX_ICE_UFRAG_LEN]; char ice_pwd[SAL_MEDIA_DESCRIPTION_MAX_ICE_PWD_LEN]; bool_t ice_lite; - bool_t ice_completed; + bool_t set_nortpproxy; bool_t pad[2]; } SalMediaDescription; diff --git a/mediastreamer2 b/mediastreamer2 index c50b270e9..9f7e7fe39 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit c50b270e9a7459dee00b7ac87cc1b96df99771e9 +Subproject commit 9f7e7fe39f8f6d0a62c5264d2de6bc6c3b2441df diff --git a/oRTP b/oRTP index 35b2e7354..761cfd7c0 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit 35b2e735421bcbaedd4422b637256987893368bc +Subproject commit 761cfd7c0eb76359b0dabeffd6533071b41a2914 diff --git a/tester/call_tester.c b/tester/call_tester.c index f87481486..2b3d7a974 100644 --- a/tester/call_tester.c +++ b/tester/call_tester.c @@ -4569,6 +4569,7 @@ static void video_call_with_re_invite_inactive_followed_by_re_invite_base(Linpho LinphoneCallParams *params; const LinphoneCallParams *current_params; MSList *lcs=NULL; + bool_t calls_ok; marie = linphone_core_manager_new( "marie_rc"); pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc"); @@ -4581,7 +4582,10 @@ static void video_call_with_re_invite_inactive_followed_by_re_invite_base(Linpho video_call_base_2(marie,pauline,TRUE,mode,TRUE,TRUE); - if (linphone_core_get_current_call(marie->lc)) { + calls_ok = linphone_core_get_current_call(marie->lc) != NULL && linphone_core_get_current_call(pauline->lc) != NULL; + BC_ASSERT_TRUE(calls_ok); + + if (calls_ok) { params=linphone_core_create_call_params(marie->lc,linphone_core_get_current_call(marie->lc)); linphone_call_params_set_audio_direction(params,LinphoneMediaDirectionInactive); linphone_call_params_set_video_direction(params,LinphoneMediaDirectionInactive);