diff --git a/coreapi/address.c b/coreapi/address.c index 1d893aede..f8051318c 100644 --- a/coreapi/address.c +++ b/coreapi/address.c @@ -57,6 +57,14 @@ const char *linphone_address_get_display_name(const LinphoneAddress* u){ return sal_address_get_display_name(u); } +/** + * Returns the display name without quotes. + * @note WARNING: the returned string must be freed by user. +**/ +char *linphone_address_get_display_name_unquoted(const LinphoneAddress *addr){ + return sal_address_get_display_name_unquoted(addr); +} + /** * Returns the username. **/ diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c index 3d5cb9a4e..f62449e62 100644 --- a/coreapi/linphonecore.c +++ b/coreapi/linphonecore.c @@ -379,6 +379,23 @@ char * linphone_call_log_to_str(LinphoneCallLog *cl){ return tmp; } +/** + * Returns RTP statistics computed locally regarding the call. + * +**/ +const rtp_stats_t *linphone_call_log_get_local_stats(const LinphoneCallLog *cl){ + return &cl->local_stats; +} + +/** + * Returns RTP statistics computed by remote end and sent back via RTCP. + * + * @note Not implemented yet. +**/ +const rtp_stats_t *linphone_call_log_get_remote_stats(const LinphoneCallLog *cl){ + return &cl->remote_stats; +} + void linphone_call_log_set_user_pointer(LinphoneCallLog *cl, void *up){ cl->user_pointer=up; } @@ -2299,8 +2316,13 @@ void linphone_core_start_media_streams(LinphoneCore *lc, LinphoneCall *call){ lc->call->state=LCStateAVRunning; } +static void linphone_call_log_fill_stats(LinphoneCallLog *log, AudioStream *st){ + audio_stream_get_local_rtp_stats (st,&log->local_stats); +} + void linphone_core_stop_media_streams(LinphoneCore *lc, LinphoneCall *call){ if (lc->audiostream!=NULL) { + linphone_call_log_fill_stats (call->log,lc->audiostream); audio_stream_stop(lc->audiostream); lc->audiostream=NULL; } @@ -3354,6 +3376,28 @@ void linphone_core_set_audio_transports(LinphoneCore *lc, RtpTransport *rtp, Rtp lc->a_rtcp=rtcp; } +/** + * Retrieve RTP statistics regarding current call. + * @param local RTP statistics computed locally. + * @param remote RTP statistics computed by far end (obtained via RTCP feedback). + * + * @note Remote RTP statistics is not implemented yet. + * + * @returns 0 or -1 if no call is running. +**/ + +int linphone_core_get_current_call_stats(LinphoneCore *lc, rtp_stats_t *local, rtp_stats_t *remote){ + LinphoneCall *call=linphone_core_get_current_call (lc); + if (call!=NULL){ + if (lc->audiostream!=NULL){ + memset(remote,0,sizeof(*remote)); + audio_stream_get_local_rtp_stats (lc->audiostream,local); + return 0; + } + } + return -1; +} + void net_config_uninit(LinphoneCore *lc) { net_config_t *config=&lc->net_conf; diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h index e38f0373f..1c4b4d6cb 100644 --- a/coreapi/linphonecore.h +++ b/coreapi/linphonecore.h @@ -1,6 +1,6 @@ /* linphone -Copyright (C) 2000 Simon MORLAT (simon.morlat@linphone.org) +Copyright (C) 2000 - 2010 Simon MORLAT (simon.morlat@linphone.org) This program is free software; you can redistribute it and/or modify it under the terms of the GNU General Public License @@ -64,6 +64,7 @@ LinphoneAddress * linphone_address_new(const char *uri); LinphoneAddress * linphone_address_clone(const LinphoneAddress *uri); const char *linphone_address_get_scheme(const LinphoneAddress *u); const char *linphone_address_get_display_name(const LinphoneAddress* u); +char *linphone_address_get_display_name_unquoted(const LinphoneAddress *u); const char *linphone_address_get_username(const LinphoneAddress *u); const char *linphone_address_get_domain(const LinphoneAddress *u); void linphone_address_set_display_name(LinphoneAddress *u, const char *display_name); @@ -127,6 +128,8 @@ typedef struct _LinphoneCallLog{ int duration; /**displayname!=NULL && u->displayname[0]!='\0' + && u->displayname[0]!='"'){ + int len=strlen(u->displayname)+1+2; + char *quoted=osip_malloc(len); + snprintf(quoted,len,"\"%s\"",u->displayname); + osip_free(u->displayname); + u->displayname=quoted; + } +} SalAddress * sal_address_new(const char *uri){ osip_from_t *from; @@ -1598,6 +1608,7 @@ SalAddress * sal_address_new(const char *uri){ osip_from_free(from); return NULL; } + sal_address_quote_displayname ((SalAddress*)from); return (SalAddress*)from; } @@ -1619,6 +1630,18 @@ const char *sal_address_get_display_name(const SalAddress* addr){ return null_if_empty(u->displayname); } +char *sal_address_get_display_name_unquoted(const SalAddress *addr){ + const osip_from_t *u=(const osip_from_t*)addr; + const char *dn=null_if_empty(u->displayname); + char *ret=NULL; + if (dn!=NULL) { + char *tmp=osip_strdup_without_quote(dn); + ret=ms_strdup(tmp); + osip_free(tmp); + } + return ret; +} + const char *sal_address_get_username(const SalAddress *addr){ const osip_from_t *u=(const osip_from_t*)addr; return null_if_empty(u->url->username); @@ -1635,8 +1658,10 @@ void sal_address_set_display_name(SalAddress *addr, const char *display_name){ osip_free(u->displayname); u->displayname=NULL; } - if (display_name!=NULL) + if (display_name!=NULL && display_name[0]!='\0'){ u->displayname=osip_strdup(display_name); + sal_address_quote_displayname(addr); + } } void sal_address_set_username(SalAddress *addr, const char *username){ diff --git a/gtk-glade/friendlist.c b/gtk-glade/friendlist.c index d4fddf871..ecb3ee963 100644 --- a/gtk-glade/friendlist.c +++ b/gtk-glade/friendlist.c @@ -308,7 +308,7 @@ void linphone_gtk_show_friends(void){ LinphoneFriend *lf=(LinphoneFriend*)itf->data; const LinphoneAddress *f_uri=linphone_friend_get_address(lf); char *uri=linphone_address_as_string(f_uri); - const char *name=linphone_address_get_display_name(f_uri); + char *name=linphone_address_get_display_name_unquoted (f_uri); const char *display=name; char *escaped=NULL; if (lookup){ @@ -341,6 +341,7 @@ void linphone_gtk_show_friends(void){ } } ms_free(uri); + if (name!=NULL) ms_free(name); } } @@ -372,16 +373,17 @@ void linphone_gtk_remove_contact(GtkWidget *button){ void linphone_gtk_show_contact(LinphoneFriend *lf){ GtkWidget *w=linphone_gtk_create_window("contact"); char *uri; - const char *name; + char *name; const LinphoneAddress *f_uri=linphone_friend_get_address(lf); uri=linphone_address_as_string_uri_only(f_uri); - name=linphone_address_get_display_name(f_uri); + name=linphone_address_get_display_name_unquoted (f_uri); if (uri) { gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"sip_address")),uri); ms_free(uri); } if (name){ gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(w,"name")),name); + ms_free(name); } gtk_toggle_button_set_active(GTK_TOGGLE_BUTTON(linphone_gtk_get_widget(w,"show_presence")), linphone_friend_get_send_subscribe(lf)); diff --git a/gtk-glade/incall_view.c b/gtk-glade/incall_view.c index c3c95eabe..4e6baf6a3 100644 --- a/gtk-glade/incall_view.c +++ b/gtk-glade/incall_view.c @@ -72,7 +72,7 @@ void linphone_gtk_show_idle_view(void){ void display_peer_name_in_label(GtkWidget *label, const char *uri){ LinphoneAddress *from; - const char *displayname=NULL; + char *displayname=NULL; char *id=NULL; char *uri_label; @@ -83,18 +83,15 @@ void display_peer_name_in_label(GtkWidget *label, const char *uri){ from=linphone_address_new(uri); if (from!=NULL){ - - if (linphone_address_get_display_name(from)) - displayname=linphone_address_get_display_name(from); - + displayname=linphone_address_get_display_name_unquoted (from); id=linphone_address_as_string_uri_only(from); - }else id=ms_strdup(uri); - if (displayname!=NULL) + if (displayname!=NULL){ uri_label=g_markup_printf_escaped("%s\n%s", displayname,id); - else + ms_free(displayname); + }else uri_label=g_markup_printf_escaped("%s\n",id); gtk_label_set_markup(GTK_LABEL(label),uri_label); ms_free(id); diff --git a/gtk-glade/main.c b/gtk-glade/main.c index 3ce841ad0..e59aec0ca 100644 --- a/gtk-glade/main.c +++ b/gtk-glade/main.c @@ -395,7 +395,7 @@ static void set_video_window_decorations(GdkWindow *w){ linphone_address_clean(uri); if (linphone_address_get_display_name(uri)!=NULL){ - display_name=ms_strdup(linphone_address_get_display_name(uri)); + display_name=linphone_address_get_display_name_unquoted (uri); }else{ display_name=linphone_address_as_string(uri); } diff --git a/gtk-glade/propertybox.c b/gtk-glade/propertybox.c index 85ebdbb8d..3faf28dab 100644 --- a/gtk-glade/propertybox.c +++ b/gtk-glade/propertybox.c @@ -802,8 +802,11 @@ void linphone_gtk_show_parameters(void){ /* SIP CONFIG */ contact=linphone_core_get_primary_contact_parsed(lc); if (contact){ - if (linphone_address_get_display_name(contact)) - gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"displayname")),linphone_address_get_display_name(contact)); + if (linphone_address_get_display_name(contact)) { + char *dn=linphone_address_get_display_name_unquoted (contact); + gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"displayname")),dn); + ms_free(dn); + } if (linphone_address_get_username(contact)) gtk_entry_set_text(GTK_ENTRY(linphone_gtk_get_widget(pb,"username")),linphone_address_get_username(contact)); } diff --git a/mediastreamer2 b/mediastreamer2 index 049945684..57896d513 160000 --- a/mediastreamer2 +++ b/mediastreamer2 @@ -1 +1 @@ -Subproject commit 049945684790ca2651ed3cefa80abdf81ba5587e +Subproject commit 57896d513f6fbf41fde3c777931ebc744e53e366 diff --git a/oRTP b/oRTP index a80e7b594..4ad63e9a1 160000 --- a/oRTP +++ b/oRTP @@ -1 +1 @@ -Subproject commit a80e7b5949e64ec01d4149d5e0f56c9843df35b0 +Subproject commit 4ad63e9a106aee8d9dfb675aa0532962f322609c