Merge branch 'master' into dev_audio_bypass

This commit is contained in:
Sylvain Berfini 2016-05-02 17:12:27 +02:00
commit d53f71aa21
28 changed files with 401 additions and 278 deletions

View file

@ -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));

View file

@ -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

View file

@ -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){

View file

@ -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;
}

View file

@ -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;

View file

@ -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);
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);
}
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);
}
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;

View file

@ -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));

View file

@ -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);
if (list->event)
wait_until_unsubscribe = TRUE;
}
/*give a chance to unsubscribe, might be optimized*/
for (i=0; wait_until_unsubscribe && i<20; i++) {
for (i=0; wait_until_unsubscribe && i<50; i++) {
linphone_core_iterate(lc);
ms_usleep(50000);
ms_usleep(10000);
}
lc->chatrooms = ms_list_free_with_data(lc->chatrooms, (MSIterateFunc)linphone_chat_room_release);
@ -6581,7 +6582,7 @@ static void linphone_core_uninit(LinphoneCore *lc)
lc->msevq=NULL;
/* save all config */
ui_config_uninit(lc);
friends_config_uninit(lc);
sip_config_uninit(lc);
net_config_uninit(lc);
rtp_config_uninit(lc);

View file

@ -1649,6 +1649,14 @@ extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInCall(JNIEnv* env
return (jboolean)linphone_core_in_call((LinphoneCore*)lc);
}
extern "C" jboolean Java_org_linphone_core_LinphoneFriendImpl_isPresenceReceived(JNIEnv* env
,jobject thiz
,jlong lf) {
return (jboolean)linphone_friend_is_presence_received((LinphoneFriend*)lf);
}
extern "C" jboolean Java_org_linphone_core_LinphoneCoreImpl_isInComingInvitePending(JNIEnv* env
,jobject thiz
,jlong lc) {
@ -2061,6 +2069,10 @@ extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_exportFriendsToVCa
env->ReleaseStringUTFChars(jpath, path);
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_enableSubscriptions(JNIEnv* env, jobject thiz, jlong list, jboolean enable) {
linphone_friend_list_enable_subscriptions((LinphoneFriendList*)list, enable);
}
extern "C" void Java_org_linphone_core_LinphoneCoreImpl_addFriendList(JNIEnv* env
,jobject thiz
,jlong lc
@ -3454,10 +3466,6 @@ extern "C" jobjectArray Java_org_linphone_core_LinphoneFriendListImpl_getFriendL
return jFriends;
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_closeSubscriptions(JNIEnv* env, jobject thiz, jlong friendListptr) {
linphone_friend_list_close_subscriptions((LinphoneFriendList*)friendListptr);
}
extern "C" void Java_org_linphone_core_LinphoneFriendListImpl_updateSubscriptions(JNIEnv* env
,jobject thiz
,jlong friendListptr

View file

@ -166,6 +166,12 @@ static void processSection_cb(const char *entry, struct __processSectionCtx *ctx
ctx->ret = 0;
return;
}
if (lp_config_get_skip_flag_for_entry(ctx->ctx->lpc, ctx->section, entry)) {
lpc2xml_log(ctx->ctx, LPC2XML_WARNING, "Skipped entry %s", entry);
ctx->ret = 0;
return;
}
node = xmlNewChild(ctx->node, NULL, (const xmlChar *)"entry", NULL);
if(node == NULL) {
@ -200,8 +206,16 @@ struct __processConfigCtx {
static void processConfig_cb(const char *section, struct __processConfigCtx *ctx) {
if(ctx->ret == 0) {
xmlNode *node = xmlNewChild(ctx->node, NULL, (const xmlChar *)"section", NULL);
xmlNode *node;
xmlAttr *name_attr;
if (lp_config_get_skip_flag_for_section(ctx->ctx->lpc, section)) {
lpc2xml_log(ctx->ctx, LPC2XML_WARNING, "Skipped section %s", section);
ctx->ret = 0;
return;
}
node = xmlNewChild(ctx->node, NULL, (const xmlChar *)"section", NULL);
if(node == NULL) {
lpc2xml_log(ctx->ctx, LPC2XML_ERROR, "Can't create \"section\" element");
ctx->ret = -1;

View file

@ -63,6 +63,7 @@ typedef struct _LpItem{
char *value;
int is_comment;
bool_t overwrite; // If set to true, will add overwrite=true when converted to xml
bool_t skip; // If set to true, won't be dumped when converted to xml
} LpItem;
typedef struct _LpSectionParam{
@ -75,6 +76,7 @@ typedef struct _LpSection{
MSList *items;
MSList *params;
bool_t overwrite; // If set to true, will add overwrite=true to all items of this section when converted to xml
bool_t skip; // If set to true, won't be dumped when converted to xml
} LpSection;
struct _LpConfig{
@ -576,7 +578,7 @@ bool_t lp_config_get_overwrite_flag_for_entry(const LpConfig *lpconfig, const ch
item = lp_section_find_item(sec, key);
if (item != NULL) return item->overwrite;
}
return 0;
return FALSE;
}
bool_t lp_config_get_overwrite_flag_for_section(const LpConfig *lpconfig, const char *section) {
@ -585,7 +587,27 @@ bool_t lp_config_get_overwrite_flag_for_section(const LpConfig *lpconfig, const
if (sec != NULL){
return sec->overwrite;
}
return 0;
return FALSE;
}
bool_t lp_config_get_skip_flag_for_entry(const LpConfig *lpconfig, const char *section, const char *key) {
LpSection *sec;
LpItem *item;
sec = lp_config_find_section(lpconfig, section);
if (sec != NULL){
item = lp_section_find_item(sec, key);
if (item != NULL) return item->skip;
}
return FALSE;
}
bool_t lp_config_get_skip_flag_for_section(const LpConfig *lpconfig, const char *section) {
LpSection *sec;
sec = lp_config_find_section(lpconfig, section);
if (sec != NULL){
return sec->skip;
}
return FALSE;
}
void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *key, const char *value){
@ -658,6 +680,24 @@ void lp_config_set_overwrite_flag_for_section(LpConfig *lpconfig, const char *se
}
}
void lp_config_set_skip_flag_for_entry(LpConfig *lpconfig, const char *section, const char *key, bool_t value) {
LpSection *sec;
LpItem *item;
sec = lp_config_find_section(lpconfig, section);
if (sec != NULL) {
item = lp_section_find_item(sec, key);
if (item != NULL) item->skip = value;
}
}
void lp_config_set_skip_flag_for_section(LpConfig *lpconfig, const char *section, bool_t value) {
LpSection *sec;
sec = lp_config_find_section(lpconfig, section);
if (sec != NULL) {
sec->skip = value;
}
}
void lp_item_write(LpItem *item, FILE *file){
if (item->is_comment)
fprintf(file,"%s\n",item->value);

View file

@ -348,6 +348,34 @@ LINPHONE_PUBLIC bool_t lp_config_get_overwrite_flag_for_section(const LpConfig *
**/
LINPHONE_PUBLIC void lp_config_set_overwrite_flag_for_section(LpConfig *lpconfig, const char *section, bool_t value);
/**
* Retrieves the skip flag for a config item
*
* @ingroup misc
**/
LINPHONE_PUBLIC bool_t lp_config_get_skip_flag_for_entry(const LpConfig *lpconfig, const char *section, const char *key);
/**
* Sets the skip flag for a config item (used when dumping config as xml)
*
* @ingroup misc
**/
LINPHONE_PUBLIC void lp_config_set_skip_flag_for_entry(LpConfig *lpconfig, const char *section, const char *key, bool_t value);
/**
* Retrieves the skip flag for a config section
*
* @ingroup misc
**/
LINPHONE_PUBLIC bool_t lp_config_get_skip_flag_for_section(const LpConfig *lpconfig, const char *section);
/**
* Sets the skip flag for a config section (used when dumping config as xml)
*
* @ingroup misc
**/
LINPHONE_PUBLIC void lp_config_set_skip_flag_for_section(LpConfig *lpconfig, const char *section, bool_t value);
#ifdef __cplusplus
}
#endif

View file

@ -198,7 +198,7 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL
}
matched->flags|=PAYLOAD_TYPE_FLAG_CAN_RECV|PAYLOAD_TYPE_FLAG_CAN_SEND;
if (p2->flags & PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED) {
matched->flags |= PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED;
payload_type_set_flag(matched, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
/* Negotiation of AVPF features (keep common features) */
matched->avpf.features &= p2->avpf.features;
matched->avpf.rpsi_compatibility = p2->avpf.rpsi_compatibility;
@ -206,6 +206,8 @@ static MSList *match_payloads(MSFactory *factory, const MSList *local, const MSL
if (p2->avpf.trr_interval < matched->avpf.trr_interval) {
matched->avpf.trr_interval = matched->avpf.trr_interval;
}
}else{
payload_type_unset_flag(matched, PAYLOAD_TYPE_RTCP_FEEDBACK_ENABLED);
}
res=ms_list_append(res,matched);
/* we should use the remote numbering even when parsing a response */
@ -518,7 +520,7 @@ static void initiate_incoming(MSFactory *factory, const SalStreamDescription *lo
result->dtls_role = SalDtlsRoleInvalid;
}
result->rtcp_mux = remote_offer->rtcp_mux && local_cap->rtcp_mux;
result->implicit_rtcp_fb = local_cap->implicit_rtcp_fb && remote_offer->implicit_rtcp_fb;
result->implicit_rtcp_fb = local_cap->implicit_rtcp_fb && remote_offer->implicit_rtcp_fb;
}

View file

@ -198,6 +198,7 @@ void _linphone_proxy_config_release_ops(LinphoneProxyConfig *cfg){
cfg->op=NULL;
}
if (cfg->long_term_event){
linphone_event_terminate(cfg->long_term_event);
linphone_event_unref(cfg->long_term_event);
cfg->long_term_event=NULL;
}

View file

@ -221,10 +221,7 @@ bool_t sal_stream_description_has_avpf(const SalStreamDescription *sd) {
}
bool_t sal_stream_description_has_implicit_avpf(const SalStreamDescription *sd){
if (sd->implicit_rtcp_fb){
return TRUE;
}
return FALSE;
return sd->implicit_rtcp_fb;
}
/*these are switch case, so that when a new proto is added we can't forget to modify this function*/
bool_t sal_stream_description_has_srtp(const SalStreamDescription *sd) {

View file

@ -461,9 +461,9 @@ void linphone_gtk_create_in_call_view(LinphoneCall *call){
static void video_button_clicked(GtkWidget *button, LinphoneCall *call){
gboolean adding=GPOINTER_TO_INT(g_object_get_data(G_OBJECT(button),"adding_video"));
LinphoneCore *lc=linphone_call_get_core(call);
LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call));
LinphoneCallParams *params = linphone_core_create_call_params(lc, call);
gtk_widget_set_sensitive(button,FALSE);
linphone_call_params_enable_video(params,adding);
linphone_call_params_enable_video(params, adding);
linphone_core_update_call(lc,call,params);
linphone_call_params_destroy(params);
}

View file

@ -1277,7 +1277,7 @@ static void on_call_updated_response(GtkWidget *dialog, gint responseid, gpointe
LinphoneCall *call = (LinphoneCall *)g_object_get_data(G_OBJECT(dialog), "call");
if (linphone_call_get_state(call)==LinphoneCallUpdatedByRemote){
LinphoneCore *lc=linphone_call_get_core(call);
LinphoneCallParams *params=linphone_call_params_copy(linphone_call_get_current_params(call));
LinphoneCallParams *params = linphone_core_create_call_params(lc, call);
linphone_call_params_enable_video(params,responseid==GTK_RESPONSE_YES);
linphone_core_accept_call_update(lc,call,params);
linphone_call_params_destroy(params);

View file

@ -102,6 +102,12 @@ public interface LinphoneFriend {
* @return true is subscription is activated for this friend.
*/
boolean isSubscribesEnabled();
/**
* get presence received status if already setted
* @return true if presence is received from this friend.
*/
boolean isPresenceReceived();
/**
* @brief Get the status of a friend
* @return OnlineStatus

View file

@ -28,7 +28,7 @@ public interface LinphoneFriendList {
public void addLocalFriend(LinphoneFriend friend);
public LinphoneFriend[] getFriendList();
public void updateSubscriptions(LinphoneProxyConfig proxyConfig,boolean onlyWhenRegistered);
public void closeSubscriptions();
public void enableSubscriptions(boolean enable);
public LinphoneFriend findFriendByUri(String uri);
public void setUri(String uri);
public void synchronizeFriendsFromServer();

View file

@ -30,6 +30,7 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
private native int getIncSubscribePolicy(long nativePtr);
private native void enableSubscribes(long nativePtr,boolean value);
private native boolean isSubscribesEnabled(long nativePtr);
private native boolean isPresenceReceived(long nativePtr);
private native int getStatus(long nativePtr);
private native Object getPresenceModel(long nativePtr);
private native void setPresenceModel(long nativePtr, long presencePtr);
@ -82,6 +83,9 @@ class LinphoneFriendImpl implements LinphoneFriend, Serializable {
public boolean isSubscribesEnabled() {
return isSubscribesEnabled(nativePtr);
}
public boolean isPresenceReceived() {
return isPresenceReceived(nativePtr);
}
public OnlineStatus getStatus() {
return OnlineStatus.fromInt(getStatus(nativePtr));
}

View file

@ -30,7 +30,7 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable {
private native void addLocalFriend(long nativePtr, long friendPtr);
private native LinphoneFriend[] getFriendList(long nativePtr);
private native void updateSubscriptions(long nativePtr, long proxyConfigPtr, boolean onlyWhenRegistered);
private native void closeSubscriptions(long nativePtr);
private native void enableSubscriptions(long nativePtr, boolean enable);
private native Object getCore(long ptr);
private native LinphoneFriend findFriendByUri(long nativePtr, String uri);
private native void setListener(long ptr, LinphoneFriendListListener listener);
@ -75,9 +75,9 @@ class LinphoneFriendListImpl implements LinphoneFriendList, Serializable {
}
@Override
public void closeSubscriptions() {
public void enableSubscriptions(boolean enable) {
synchronized(getSyncObject()) {
closeSubscriptions(nativePtr);
enableSubscriptions(nativePtr, enable);
}
}

@ -1 +1 @@
Subproject commit 75fe8bcf69ecb6e08153242d5b5c2b7fa0c36e11
Subproject commit 3a480a10e36a55a3c3bd56651b41a70297bc72eb

View file

@ -193,6 +193,9 @@ typedef struct _stats {
int number_of_LinphonePresenceActivityWorking;
int number_of_LinphonePresenceActivityWorship;
const LinphonePresenceModel *last_received_presence;
int number_of_LinphonePresenceBasicStatusOpen;
int number_of_LinphonePresenceBasicStatusClosed;
int number_of_inforeceived;
LinphoneInfoMessage* last_received_info_message;

View file

@ -33,19 +33,14 @@ static void eof_callback(LinphonePlayer *player, void *user_data) {
}
static void play_file(const char *filename, bool_t supported_format, const char *audio_mime, const char *video_mime) {
LinphoneCoreManager *lc_manager;
LinphoneCoreManager *lc_manager = linphone_core_manager_new("marie_rc");
LinphonePlayer *player;
int res, time = 0;
int res, timer = 0;
bool_t eof = FALSE;
bool_t audio_codec_supported;
bool_t video_codec_supported;
lc_manager = linphone_core_manager_new("marie_rc");
BC_ASSERT_PTR_NOT_NULL(lc_manager);
if(lc_manager == NULL) return;
audio_codec_supported = (audio_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), audio_mime));
video_codec_supported = (video_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), video_mime));
bool_t audio_codec_supported = (audio_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), audio_mime));
bool_t video_codec_supported = (video_mime && ms_factory_get_decoder(linphone_core_get_ms_factory((void *)lc_manager->lc), video_mime));
int expected_res = (supported_format && (audio_codec_supported || video_codec_supported)) ? 0 : -1;
player = linphone_core_create_local_player(lc_manager->lc,
ms_snd_card_manager_get_default_card(ms_factory_get_snd_card_manager(linphone_core_get_ms_factory((void *)lc_manager->lc))),
@ -54,19 +49,15 @@ static void play_file(const char *filename, bool_t supported_format, const char
if(player == NULL) goto fail;
res = linphone_player_open(player, filename, eof_callback, &eof);
if(supported_format && (audio_codec_supported || video_codec_supported)) {
BC_ASSERT_EQUAL(res, 0, int, "%d");
} else {
BC_ASSERT_EQUAL(res, -1, int, "%d");
}
BC_ASSERT_EQUAL(res, expected_res, int, "%d");
if(res == -1) goto fail;
res = linphone_player_start(player);
BC_ASSERT_EQUAL(res, 0, int, "%d");
if(res == -1) goto fail;
BC_ASSERT_TRUE(wait_for_eof(&eof, &time, 100, (int)(linphone_player_get_duration(player) * 1.05)));
BC_ASSERT_TRUE(wait_for_eof(&eof, &timer, 100, (int)(linphone_player_get_duration(player) * 1.05)));
linphone_player_close(player);

View file

@ -66,11 +66,13 @@ static void simple(void) {
BC_ASSERT_EQUAL(linphone_presence_activity_get_type(activity), LinphonePresenceActivityDinner, int, "%d");
}
linphone_friend_unref(f);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
static void fast_activity_change(void) {
#if FIX_ME
LinphoneCoreManager* marie = linphone_core_manager_new("marie_rc");
LinphoneCoreManager* pauline = linphone_core_manager_new(transport_supported(LinphoneTransportTls) ? "pauline_rc" : "pauline_tcp_rc");
LinphonePresenceModel *pauline_presence;
@ -112,6 +114,7 @@ static void fast_activity_change(void) {
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
#endif
}
static void subscriber_no_longer_reachable(void){
@ -138,7 +141,7 @@ static void subscriber_no_longer_reachable(void){
linphone_core_add_friend(marie->lc, lf);
linphone_friend_unref(lf);
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOnline,1, 2000));
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceBasicStatusOpen,1, 2000));
/*make sure marie subscribe is not reset by accident because of code below located in linphone_core_iterate
@ -160,8 +163,8 @@ static void subscriber_no_longer_reachable(void){
//sal_set_send_error(marie->lc->sal,0);
/*because of notify timeout detected by server, so subscription is reset*/
previous_number_of_LinphonePresenceActivityOffline = marie->stat.number_of_LinphonePresenceActivityOffline;
BC_ASSERT_TRUE(wait_for_list(lcs,&previous_number_of_LinphonePresenceActivityOffline,1, 4000));
previous_number_of_LinphonePresenceActivityOffline = marie->stat.number_of_LinphonePresenceBasicStatusClosed;
BC_ASSERT_TRUE(wait_for_list(lcs,&marie->stat.number_of_LinphonePresenceActivityOffline,previous_number_of_LinphonePresenceActivityOffline+1, 4000));
// now subscription is supposed to be dead because notify was not answered in time.
presence =linphone_presence_model_new_with_activity(LinphonePresenceActivityOnline,NULL);
@ -247,7 +250,7 @@ static void subscribe_with_late_publish(void) {
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePresenceActivityBreakfast, 0, int,"%i");
BC_ASSERT_EQUAL(pauline->stat.number_of_LinphonePresenceActivityAppointment, 1, int,"%i");
linphone_friend_unref(lf);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(pauline);
}
@ -314,6 +317,7 @@ static void test_forked_subscribe_notify_publish(void) {
/*wait for new status*/
BC_ASSERT_TRUE(wait_for_list(lcs,&pauline->stat.number_of_LinphonePresenceActivityMeeting,1,3000));
linphone_friend_unref(lf);
linphone_core_manager_destroy(marie);
linphone_core_manager_destroy(marie2);
linphone_core_manager_destroy(pauline);
@ -471,7 +475,6 @@ static void test_presence_list_base(bool_t enable_compression) {
/*BC_ASSERT_EQUAL(linphone_presence_activity_get_type(linphone_presence_model_get_activity(linphone_friend_get_presence_model(lf)))
, LinphonePresenceActivityOnline, int, "%d"); fixme, should be LinphonePresenceActivityUnknown*/
end:
linphone_core_manager_destroy(laure);
linphone_core_manager_destroy(marie);
@ -553,12 +556,12 @@ static void test_presence_list_subscription_expire_for_unknown(void) {
linphone_core_remove_friend_list(laure->lc, linphone_core_get_default_friend_list(laure->lc));
linphone_core_add_friend_list(laure->lc, lfl);
linphone_friend_list_update_subscriptions(lfl,NULL,FALSE);
linphone_friend_list_unref(lfl);
/* wait for refresh*/
BC_ASSERT_FALSE(wait_for_until(laure->lc, NULL, &laure->stat.number_of_NotifyPresenceReceived, 1, 4000));
linphone_friend_unref(lf);
linphone_core_manager_destroy(laure);
}
@ -582,8 +585,10 @@ static void test_presence_list_subscribe_with_error(bool_t io_error) {
linphone_friend_list_set_rls_uri(lfl, rls_uri);
lf = linphone_core_create_friend_with_address(laure->lc, pauline_identity);
linphone_friend_list_add_friend(lfl, lf);
linphone_friend_unref(lf);
lf = linphone_core_create_friend_with_address(laure->lc, "sip:michelle@sip.inexistentdomain.com");
linphone_friend_list_add_friend(lfl, lf);
linphone_friend_unref(lf);
linphone_core_remove_friend_list(laure->lc, linphone_core_get_default_friend_list(laure->lc));
linphone_core_add_friend_list(laure->lc, lfl);
linphone_friend_list_unref(lfl);
@ -696,7 +701,6 @@ static void long_term_presence_list(void) {
linphone_friend_list_unref(friends);
BC_ASSERT_TRUE(wait_for(pauline->lc,NULL,&pauline->stat.number_of_NotifyPresenceReceived,1));
BC_ASSERT_EQUAL(linphone_core_get_default_friend_list(pauline->lc)->expected_notification_version, 2, int, "%d");
f1 = linphone_friend_list_find_friend_by_uri(linphone_core_get_default_friend_list(pauline->lc), "sip:liblinphone_tester@sip.example.org");
BC_ASSERT_EQUAL(linphone_presence_model_get_basic_status(linphone_friend_get_presence_model(f1)), LinphonePresenceBasicStatusOpen, int, "%d");
@ -712,14 +716,14 @@ static void long_term_presence_list(void) {
test_t presence_server_tests[] = {
TEST_NO_TAG("Simple", simple),
TEST_NO_TAG("Fast activity change", fast_activity_change),
TEST_ONE_TAG("Subscriber no longer reachable using server",subscriber_no_longer_reachable, "presence"),
TEST_ONE_TAG("Subscribe with late publish", subscribe_with_late_publish, "LeaksMemory"),
TEST_ONE_TAG("Forked subscribe with late publish", test_forked_subscribe_notify_publish, "LeaksMemory"),
TEST_ONE_TAG("Presence list", test_presence_list, "LeaksMemory"),
TEST_ONE_TAG("Presence list without compression", test_presence_list_without_compression, "LeaksMemory"),
TEST_ONE_TAG("Presence list, subscription expiration for unknown contact",test_presence_list_subscription_expire_for_unknown, "LeaksMemory"),
TEST_ONE_TAG("Presence list, silent subscription expiration", presence_list_subscribe_dialog_expire, "LeaksMemory"),
TEST_ONE_TAG("Presence list, io error",presence_list_subscribe_io_error, "LeaksMemory"),
TEST_NO_TAG("Subscriber no longer reachable using server",subscriber_no_longer_reachable),
TEST_NO_TAG("Subscribe with late publish", subscribe_with_late_publish),
TEST_NO_TAG("Forked subscribe with late publish", test_forked_subscribe_notify_publish),
TEST_NO_TAG("Presence list", test_presence_list),
TEST_NO_TAG("Presence list without compression", test_presence_list_without_compression),
TEST_NO_TAG("Presence list, subscription expiration for unknown contact",test_presence_list_subscription_expire_for_unknown),
TEST_NO_TAG("Presence list, silent subscription expiration", presence_list_subscribe_dialog_expire),
TEST_NO_TAG("Presence list, io error",presence_list_subscribe_io_error),
TEST_NO_TAG("Long term presence existing friend",long_term_presence_existing_friend),
TEST_NO_TAG("Long term presence inexistent friend",long_term_presence_inexistent_friend),
TEST_NO_TAG("Long term presence list",long_term_presence_list),

View file

@ -48,74 +48,83 @@ void new_subscription_requested(LinphoneCore *lc, LinphoneFriend *lf, const char
void notify_presence_received(LinphoneCore *lc, LinphoneFriend * lf) {
stats* counters;
LinphonePresenceActivity *activity = NULL;
int i;
char* from=linphone_address_as_string(linphone_friend_get_address(lf));
ms_message("New Notify request from [%s] ",from);
ms_free(from);
counters = get_stats(lc);
counters->number_of_NotifyPresenceReceived++;
counters->last_received_presence = linphone_friend_get_presence_model(lf);
activity = linphone_presence_model_get_activity(counters->last_received_presence);
switch (linphone_presence_activity_get_type(activity)) {
case LinphonePresenceActivityOffline:
counters->number_of_LinphonePresenceActivityOffline++; break;
case LinphonePresenceActivityOnline:
counters->number_of_LinphonePresenceActivityOnline++; break;
case LinphonePresenceActivityAppointment:
counters->number_of_LinphonePresenceActivityAppointment++; break;
case LinphonePresenceActivityAway:
counters->number_of_LinphonePresenceActivityAway++; break;
case LinphonePresenceActivityBreakfast:
counters->number_of_LinphonePresenceActivityBreakfast++; break;
case LinphonePresenceActivityBusy:
counters->number_of_LinphonePresenceActivityBusy++; break;
case LinphonePresenceActivityDinner:
counters->number_of_LinphonePresenceActivityDinner++; break;
case LinphonePresenceActivityHoliday:
counters->number_of_LinphonePresenceActivityHoliday++; break;
case LinphonePresenceActivityInTransit:
counters->number_of_LinphonePresenceActivityInTransit++; break;
case LinphonePresenceActivityLookingForWork:
counters->number_of_LinphonePresenceActivityLookingForWork++; break;
case LinphonePresenceActivityLunch:
counters->number_of_LinphonePresenceActivityLunch++; break;
case LinphonePresenceActivityMeal:
counters->number_of_LinphonePresenceActivityMeal++; break;
case LinphonePresenceActivityMeeting:
counters->number_of_LinphonePresenceActivityMeeting++; break;
case LinphonePresenceActivityOnThePhone:
counters->number_of_LinphonePresenceActivityOnThePhone++; break;
case LinphonePresenceActivityOther:
counters->number_of_LinphonePresenceActivityOther++; break;
case LinphonePresenceActivityPerformance:
counters->number_of_LinphonePresenceActivityPerformance++; break;
case LinphonePresenceActivityPermanentAbsence:
counters->number_of_LinphonePresenceActivityPermanentAbsence++; break;
case LinphonePresenceActivityPlaying:
counters->number_of_LinphonePresenceActivityPlaying++; break;
case LinphonePresenceActivityPresentation:
counters->number_of_LinphonePresenceActivityPresentation++; break;
case LinphonePresenceActivityShopping:
counters->number_of_LinphonePresenceActivityShopping++; break;
case LinphonePresenceActivitySleeping:
counters->number_of_LinphonePresenceActivitySleeping++; break;
case LinphonePresenceActivitySpectator:
counters->number_of_LinphonePresenceActivitySpectator++; break;
case LinphonePresenceActivitySteering:
counters->number_of_LinphonePresenceActivitySteering++; break;
case LinphonePresenceActivityTravel:
counters->number_of_LinphonePresenceActivityTravel++; break;
case LinphonePresenceActivityTV:
counters->number_of_LinphonePresenceActivityTV++; break;
case LinphonePresenceActivityUnknown:
counters->number_of_LinphonePresenceActivityUnknown++; break;
case LinphonePresenceActivityVacation:
counters->number_of_LinphonePresenceActivityVacation++; break;
case LinphonePresenceActivityWorking:
counters->number_of_LinphonePresenceActivityWorking++; break;
case LinphonePresenceActivityWorship:
counters->number_of_LinphonePresenceActivityWorship++; break;
if (linphone_presence_model_get_basic_status(counters->last_received_presence) == LinphonePresenceBasicStatusOpen) {
counters->number_of_LinphonePresenceBasicStatusOpen++;
} else if (linphone_presence_model_get_basic_status(counters->last_received_presence) == LinphonePresenceBasicStatusClosed) {
counters->number_of_LinphonePresenceBasicStatusClosed++;
} else {
ms_error("unexpeted basioc status [%i]",linphone_presence_model_get_basic_status(counters->last_received_presence));
}
for (i=0;i<linphone_presence_model_get_nb_activities(counters->last_received_presence); i++) {
LinphonePresenceActivity *activity = linphone_presence_model_get_nth_activity(counters->last_received_presence, i);
switch (linphone_presence_activity_get_type(activity)) {
case LinphonePresenceActivityOffline:
counters->number_of_LinphonePresenceActivityOffline++; break;
case LinphonePresenceActivityOnline:
counters->number_of_LinphonePresenceActivityOnline++; break;
case LinphonePresenceActivityAppointment:
counters->number_of_LinphonePresenceActivityAppointment++; break;
case LinphonePresenceActivityAway:
counters->number_of_LinphonePresenceActivityAway++; break;
case LinphonePresenceActivityBreakfast:
counters->number_of_LinphonePresenceActivityBreakfast++; break;
case LinphonePresenceActivityBusy:
counters->number_of_LinphonePresenceActivityBusy++; break;
case LinphonePresenceActivityDinner:
counters->number_of_LinphonePresenceActivityDinner++; break;
case LinphonePresenceActivityHoliday:
counters->number_of_LinphonePresenceActivityHoliday++; break;
case LinphonePresenceActivityInTransit:
counters->number_of_LinphonePresenceActivityInTransit++; break;
case LinphonePresenceActivityLookingForWork:
counters->number_of_LinphonePresenceActivityLookingForWork++; break;
case LinphonePresenceActivityLunch:
counters->number_of_LinphonePresenceActivityLunch++; break;
case LinphonePresenceActivityMeal:
counters->number_of_LinphonePresenceActivityMeal++; break;
case LinphonePresenceActivityMeeting:
counters->number_of_LinphonePresenceActivityMeeting++; break;
case LinphonePresenceActivityOnThePhone:
counters->number_of_LinphonePresenceActivityOnThePhone++; break;
case LinphonePresenceActivityOther:
counters->number_of_LinphonePresenceActivityOther++; break;
case LinphonePresenceActivityPerformance:
counters->number_of_LinphonePresenceActivityPerformance++; break;
case LinphonePresenceActivityPermanentAbsence:
counters->number_of_LinphonePresenceActivityPermanentAbsence++; break;
case LinphonePresenceActivityPlaying:
counters->number_of_LinphonePresenceActivityPlaying++; break;
case LinphonePresenceActivityPresentation:
counters->number_of_LinphonePresenceActivityPresentation++; break;
case LinphonePresenceActivityShopping:
counters->number_of_LinphonePresenceActivityShopping++; break;
case LinphonePresenceActivitySleeping:
counters->number_of_LinphonePresenceActivitySleeping++; break;
case LinphonePresenceActivitySpectator:
counters->number_of_LinphonePresenceActivitySpectator++; break;
case LinphonePresenceActivitySteering:
counters->number_of_LinphonePresenceActivitySteering++; break;
case LinphonePresenceActivityTravel:
counters->number_of_LinphonePresenceActivityTravel++; break;
case LinphonePresenceActivityTV:
counters->number_of_LinphonePresenceActivityTV++; break;
case LinphonePresenceActivityUnknown:
counters->number_of_LinphonePresenceActivityUnknown++; break;
case LinphonePresenceActivityVacation:
counters->number_of_LinphonePresenceActivityVacation++; break;
case LinphonePresenceActivityWorking:
counters->number_of_LinphonePresenceActivityWorking++; break;
case LinphonePresenceActivityWorship:
counters->number_of_LinphonePresenceActivityWorship++; break;
}
}
}

View file

@ -263,6 +263,10 @@ bool_t transport_supported(LinphoneTransportType transport) {
return supported;
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) {
char *rc_path = NULL;
char *hellopath = bc_tester_res("sounds/hello8000.wav");
@ -270,14 +274,7 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) {
mgr->v_table.registration_state_changed=registration_state_changed;
mgr->v_table.auth_info_requested=auth_info_requested;
mgr->v_table.call_state_changed=call_state_changed;
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic push
#endif
#pragma GCC diagnostic ignored "-Wdeprecated-declarations"
mgr->v_table.text_received=text_message_received;
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
mgr->v_table.message_received=message_received;
mgr->v_table.is_composing_received=is_composing_received;
mgr->v_table.new_subscription_requested=new_subscription_requested;
@ -341,6 +338,9 @@ void linphone_core_manager_init(LinphoneCoreManager *mgr, const char* rc_file) {
if (rc_path) ms_free(rc_path);
}
#if __clang__ || ((__GNUC__ == 4 && __GNUC_MINOR__ >= 6) || __GNUC__ > 4)
#pragma GCC diagnostic pop
#endif
void linphone_core_manager_start(LinphoneCoreManager *mgr, int check_for_proxies) {
LinphoneProxyConfig* proxy;

View file

@ -56,8 +56,8 @@ int main(int argc, char *argv[]) {
lpc = lp_config_new(argv[2]);
if(strcmp("convert", argv[1]) == 0 && argc == 4) {
ctx = lpc2xml_context_new(cb_function, NULL);
lpc2xml_convert_file(ctx, argv[3]);
lpc2xml_set_lpc(ctx, lpc);
lpc2xml_convert_file(ctx, argv[3]);
lpc2xml_context_destroy(ctx);
} else if (strcmp("dump", argv[1]) == 0 && argc == 3) {
char *dump = lp_config_dump_as_xml(lpc);