diff --git a/coreapi/linphonecall.c b/coreapi/linphonecall.c
index 41b39cb8b..5962badd3 100644
--- a/coreapi/linphonecall.c
+++ b/coreapi/linphonecall.c
@@ -974,7 +974,7 @@ void linphone_call_set_next_video_frame_decoded_callback(LinphoneCall *call, Lin
void linphone_call_init_audio_stream(LinphoneCall *call){
LinphoneCore *lc=call->core;
AudioStream *audiostream;
- int dscp=lp_config_get_int(lc->config,"rtp","audio_dscp",-1);
+ int dscp=linphone_core_get_audio_dscp(lc);
call->audiostream=audiostream=audio_stream_new(call->audio_port,call->audio_port+1,linphone_core_ipv6_enabled(lc));
if (dscp!=-1)
@@ -1028,7 +1028,7 @@ void linphone_call_init_video_stream(LinphoneCall *call){
if ((lc->video_conf.display || lc->video_conf.capture) && call->params.has_video){
int video_recv_buf_size=lp_config_get_int(lc->config,"video","recv_buf_size",0);
- int dscp=lp_config_get_int(lc->config,"rtp","video_dscp",-1);
+ int dscp=linphone_core_get_video_dscp(lc);
call->videostream=video_stream_new(call->video_port,call->video_port+1,linphone_core_ipv6_enabled(lc));
if (dscp!=-1)
diff --git a/coreapi/linphonecore.c b/coreapi/linphonecore.c
index f8a33de57..6d81d8b71 100644
--- a/coreapi/linphonecore.c
+++ b/coreapi/linphonecore.c
@@ -615,6 +615,7 @@ static void sip_config_read(LinphoneCore *lc)
sal_set_keepalive_period(lc->sal,lc->sip_conf.keepalive_period);
sal_use_one_matching_codec_policy(lc->sal,lp_config_get_int(lc->config,"sip","only_one_codec",0));
sal_use_double_registrations(lc->sal,lp_config_get_int(lc->config,"sip","use_double_registrations",1));
+ sal_set_dscp(lc->sal,linphone_core_get_sip_dscp(lc));
}
static void rtp_config_read(LinphoneCore *lc)
@@ -5112,3 +5113,74 @@ void linphone_core_set_device_identifier(LinphoneCore *lc,const char* device_id)
const char* linphone_core_get_device_identifier(const LinphoneCore *lc) {
return lc->device_id;
}
+
+/**
+ * Set the DSCP field for SIP signaling channel.
+ *
+ * @ingroup network_parameters
+ * * The DSCP defines the quality of service in IP packets.
+ *
+**/
+void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp){
+ sal_set_dscp(lc->sal,dscp);
+ if (linphone_core_ready(lc))
+ lp_config_set_int_hex(lc->config,"sip","dscp",dscp);
+}
+
+/**
+ * Get the DSCP field for SIP signaling channel.
+ *
+ * @ingroup network_parameters
+ * * The DSCP defines the quality of service in IP packets.
+ *
+**/
+int linphone_core_get_sip_dscp(const LinphoneCore *lc){
+ return lp_config_get_int(lc->config,"sip","dscp",0x1a);
+}
+
+/**
+ * Set the DSCP field for outgoing audio streams.
+ *
+ * @ingroup network_parameters
+ * The DSCP defines the quality of service in IP packets.
+ *
+**/
+void linphone_core_set_audio_dscp(LinphoneCore *lc, int dscp){
+ if (linphone_core_ready(lc))
+ lp_config_set_int_hex(lc->config,"rtp","audio_dscp",dscp);
+}
+
+/**
+ * Get the DSCP field for outgoing audio streams.
+ *
+ * @ingroup network_parameters
+ * The DSCP defines the quality of service in IP packets.
+ *
+**/
+int linphone_core_get_audio_dscp(const LinphoneCore *lc){
+ return lp_config_get_int(lc->config,"rtp","audio_dscp",0x2e);
+}
+
+/**
+ * Set the DSCP field for outgoing video streams.
+ *
+ * @ingroup network_parameters
+ * The DSCP defines the quality of service in IP packets.
+ *
+**/
+void linphone_core_set_video_dscp(LinphoneCore *lc, int dscp){
+ if (linphone_core_ready(lc))
+ lp_config_set_int_hex(lc->config,"rtp","video_dscp",dscp);
+
+}
+
+/**
+ * Get the DSCP field for outgoing video streams.
+ *
+ * @ingroup network_parameters
+ * The DSCP defines the quality of service in IP packets.
+ *
+**/
+int linphone_core_get_video_dscp(const LinphoneCore *lc){
+ return lp_config_get_int(lc->config,"rtp","video_dscp",0x2e);
+}
diff --git a/coreapi/linphonecore.h b/coreapi/linphonecore.h
index 009648be3..ef24f2c78 100644
--- a/coreapi/linphonecore.h
+++ b/coreapi/linphonecore.h
@@ -1389,6 +1389,15 @@ LinphoneTunnel *linphone_core_get_tunnel(LinphoneCore *lc);
void linphone_call_zoom_video(LinphoneCall* call, float zoom_factor, float* cx, float* cy);
+void linphone_core_set_sip_dscp(LinphoneCore *lc, int dscp);
+int linphone_core_get_sip_dscp(const LinphoneCore *lc);
+
+void linphone_core_set_audio_dscp(LinphoneCore *lc, int dscp);
+int linphone_core_get_audio_dscp(const LinphoneCore *lc);
+
+void linphone_core_set_video_dscp(LinphoneCore *lc, int dscp);
+int linphone_core_get_video_dscp(const LinphoneCore *lc);
+
#ifdef __cplusplus
}
#endif
diff --git a/coreapi/lpconfig.c b/coreapi/lpconfig.c
index 4cd7202cc..0efdc335e 100644
--- a/coreapi/lpconfig.c
+++ b/coreapi/lpconfig.c
@@ -273,7 +273,13 @@ const char *lp_config_get_string(LpConfig *lpconfig, const char *section, const
int lp_config_get_int(LpConfig *lpconfig,const char *section, const char *key, int default_value){
const char *str=lp_config_get_string(lpconfig,section,key,NULL);
- if (str!=NULL) return atoi(str);
+ if (str!=NULL) {
+ int ret=0;
+ if (strstr(str,"0x")==str){
+ sscanf(str,"%x",&ret);
+ }else ret=atoi(str);
+ return ret;
+ }
else return default_value;
}
@@ -324,6 +330,12 @@ void lp_config_set_int(LpConfig *lpconfig,const char *section, const char *key,
lp_config_set_string(lpconfig,section,key,tmp);
}
+void lp_config_set_int_hex(LpConfig *lpconfig,const char *section, const char *key, int value){
+ char tmp[30];
+ snprintf(tmp,sizeof(tmp),"0x%x",value);
+ lp_config_set_string(lpconfig,section,key,tmp);
+}
+
void lp_config_set_int64(LpConfig *lpconfig,const char *section, const char *key, int64_t value){
char tmp[30];
snprintf(tmp,sizeof(tmp),"%lli",(long long)value);
diff --git a/coreapi/lpconfig.h b/coreapi/lpconfig.h
index c1821d2aa..a27f7e39a 100644
--- a/coreapi/lpconfig.h
+++ b/coreapi/lpconfig.h
@@ -96,6 +96,14 @@ void lp_config_set_string(LpConfig *lpconfig,const char *section, const char *ke
* @ingroup misc
**/
void lp_config_set_int(LpConfig *lpconfig,const char *section, const char *key, int value);
+
+/**
+ * Sets an integer config item, but store it as hexadecimal
+ *
+ * @ingroup misc
+**/
+void lp_config_set_int_hex(LpConfig *lpconfig,const char *section, const char *key, int value);
+
/**
* Sets a 64 bits integer config item
*
diff --git a/coreapi/sal.h b/coreapi/sal.h
index 9c3f6d61f..751cc6533 100644
--- a/coreapi/sal.h
+++ b/coreapi/sal.h
@@ -325,6 +325,7 @@ void sal_auth_info_delete(const SalAuthInfo* auth_info);
void sal_set_callbacks(Sal *ctx, const SalCallbacks *cbs);
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure);
int sal_unlisten_ports(Sal *ctx);
+void sal_set_dscp(Sal *ctx, int dscp);
int sal_reset_transports(Sal *ctx);
ortp_socket_t sal_get_socket(Sal *ctx);
void sal_set_user_agent(Sal *ctx, const char *user_agent);
diff --git a/coreapi/sal_eXosip2.c b/coreapi/sal_eXosip2.c
index 30b0f286d..821e4ab39 100644
--- a/coreapi/sal_eXosip2.c
+++ b/coreapi/sal_eXosip2.c
@@ -283,6 +283,7 @@ Sal * sal_init(){
sal->rootCa = 0;
sal->verify_server_certs=TRUE;
sal->expire_old_contact=FALSE;
+ sal->dscp=-1;
return sal;
}
@@ -380,6 +381,12 @@ static void set_tls_options(Sal *ctx){
#endif
}
+void sal_set_dscp(Sal *ctx, int dscp){
+ ctx->dscp=dscp;
+ if (dscp!=-1)
+ eXosip_set_option(EXOSIP_OPT_SET_DSCP,&ctx->dscp);
+}
+
int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int is_secure){
int err;
bool_t ipv6;
@@ -406,6 +413,7 @@ int sal_listen_port(Sal *ctx, const char *addr, int port, SalTransport tr, int i
eXosip_set_option(EXOSIP_OPT_USE_RPORT,&use_rports);
int dont_use_101 = !ctx->use_101; // Copy char to int to avoid bad alignment
eXosip_set_option(EXOSIP_OPT_DONT_SEND_101,&dont_use_101);
+ sal_set_dscp(ctx,ctx->dscp);
ipv6=strchr(addr,':')!=NULL;
eXosip_enable_ipv6(ipv6);
diff --git a/coreapi/sal_eXosip2.h b/coreapi/sal_eXosip2.h
index ccc95d56a..71463854c 100644
--- a/coreapi/sal_eXosip2.h
+++ b/coreapi/sal_eXosip2.h
@@ -41,6 +41,7 @@ struct Sal{
int keepalive_period;
void *up; /*user pointer*/
char* rootCa; /* File _or_ folder containing root CA */
+ int dscp;
bool_t one_matching_codec;
bool_t double_reg;
bool_t use_rports;
diff --git a/gtk/Makefile.am b/gtk/Makefile.am
index a4dceba61..ede08b900 100644
--- a/gtk/Makefile.am
+++ b/gtk/Makefile.am
@@ -9,7 +9,8 @@ UI_FILES= about.ui \
log.ui \
buddylookup.ui \
tunnel_config.ui \
- waiting.ui
+ waiting.ui \
+ dscp_settings.ui
PIXMAPS= \
stock_people.png
diff --git a/gtk/dscp_settings.ui b/gtk/dscp_settings.ui
new file mode 100644
index 000000000..4664768c6
--- /dev/null
+++ b/gtk/dscp_settings.ui
@@ -0,0 +1,178 @@
+
+
+
+
+
+
diff --git a/gtk/parameters.ui b/gtk/parameters.ui
index 9fc8538c0..7e76c385f 100644
--- a/gtk/parameters.ui
+++ b/gtk/parameters.ui
@@ -207,10 +207,10 @@
Set Maximum Transmission Unit:
- False
True
True
False
+ False
True
@@ -247,10 +247,10 @@
Send DTMFs as SIP info
- False
True
True
False
+ False
True
@@ -263,11 +263,11 @@
Use IPv6 instead of IPv4
- False
True
True
False
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
True
@@ -315,7 +315,7 @@
True
False
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- 5
+ 6
2
@@ -377,23 +377,24 @@
Tunnel
- 4
- 5
+ 5
+ 6
- edit
- False
+ gtk-edit
True
True
+ False
+ True
1
2
- 4
- 5
+ 5
+ 6
@@ -462,6 +463,34 @@
3
+
+
+ True
+ False
+ DSCP fields
+
+
+ 4
+ 5
+
+
+
+
+ gtk-edit
+ True
+ True
+ True
+ False
+ True
+
+
+
+ 1
+ 2
+ 4
+ 5
+
+
@@ -496,10 +525,10 @@
Direct connection to the Internet
- False
True
True
False
+ False
True
True
@@ -517,10 +546,10 @@
Behind NAT / Firewall (specify gateway IP below)
- False
True
True
False
+ False
True
True
no_nat
@@ -585,10 +614,10 @@
Behind NAT / Firewall (use STUN to resolve)
- False
True
True
False
+ False
True
no_nat
@@ -602,10 +631,10 @@
Behind NAT / Firewall (use ICE)
- False
True
True
False
+ False
True
no_nat
@@ -743,9 +772,6 @@
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
6
2
-
-
-
True
@@ -767,11 +793,11 @@
gtk-media-play
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
True
@@ -944,10 +970,10 @@
Enable echo cancellation
- False
True
True
False
+ False
True
@@ -958,6 +984,9 @@
6
+
+
+
@@ -1293,10 +1322,10 @@
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- False
True
True
True
+ False
@@ -1340,11 +1369,11 @@
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
@@ -1388,11 +1417,11 @@
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
@@ -1436,11 +1465,11 @@
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
@@ -1484,9 +1513,9 @@
- False
True
True
+ False
@@ -1573,11 +1602,11 @@ virtual network !
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
@@ -1759,11 +1788,11 @@ virtual network !
gtk-go-up
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
True
@@ -1776,11 +1805,11 @@ virtual network !
gtk-go-down
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
True
@@ -1792,11 +1821,11 @@ virtual network !
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
@@ -1840,11 +1869,11 @@ virtual network !
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
@@ -2007,10 +2036,10 @@ virtual network !
Enable adaptive rate control
- False
True
True
False
+ False
0
True
@@ -2162,10 +2191,10 @@ virtual network !
Show advanced settings
- False
True
True
False
+ False
True
@@ -2242,11 +2271,11 @@ virtual network !
end
- False
True
True
True
GDK_POINTER_MOTION_MASK | GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK | GDK_BUTTON_RELEASE_MASK
+ False
diff --git a/gtk/propertybox.c b/gtk/propertybox.c
index 6870e2786..31c76f93b 100644
--- a/gtk/propertybox.c
+++ b/gtk/propertybox.c
@@ -1131,3 +1131,55 @@ void linphone_gtk_tunnel_ok(GtkButton *button){
void linphone_gtk_tunnel_cancel(GtkButton *button){
}
+
+static void show_dscp(GtkWidget *entry, int val){
+ char tmp[20];
+ snprintf(tmp,sizeof(tmp),"0x%x",val);
+ gtk_entry_set_text(GTK_ENTRY(entry),tmp);
+
+}
+
+static int read_dscp(GtkWidget *entry){
+ const char *val=gtk_entry_get_text(GTK_ENTRY(entry));
+ const char *begin;
+ int ret=0;
+ if (val==NULL || val[0]=='\0') return 0;
+ /*skip potential 0x*/
+ begin=strstr(val,"0x");
+ if (begin) begin+=2;
+ else begin=val;
+ if (sscanf(begin,"%x",&ret)==1)
+ return ret;
+ return -1;
+}
+
+void linphone_gtk_dscp_edit(){
+ LinphoneCore *lc=linphone_gtk_get_core();
+ GtkWidget *widget=linphone_gtk_create_window("dscp_settings");
+ show_dscp(linphone_gtk_get_widget(widget,"sip_dscp"),
+ linphone_core_get_sip_dscp(lc));
+ show_dscp(linphone_gtk_get_widget(widget,"audio_dscp"),
+ linphone_core_get_audio_dscp(lc));
+ show_dscp(linphone_gtk_get_widget(widget,"video_dscp"),
+ linphone_core_get_video_dscp(lc));
+ gtk_widget_show(widget);
+}
+
+void linphone_gtk_dscp_edit_response(GtkWidget *dialog, guint response_id){
+ LinphoneCore *lc=linphone_gtk_get_core();
+ switch(response_id){
+ case GTK_RESPONSE_OK:
+ linphone_core_set_sip_dscp(lc,
+ read_dscp(linphone_gtk_get_widget(dialog,"sip_dscp")));
+ linphone_core_set_audio_dscp(lc,
+ read_dscp(linphone_gtk_get_widget(dialog,"audio_dscp")));
+ linphone_core_set_video_dscp(lc,
+ read_dscp(linphone_gtk_get_widget(dialog,"video_dscp")));
+
+ break;
+ default:
+ break;
+ }
+ gtk_widget_destroy(dialog);
+}
+