diff --git a/daemon/main.c b/daemon/main.c index 26fc9283a..76fcda607 100644 --- a/daemon/main.c +++ b/daemon/main.c @@ -476,6 +476,7 @@ static void options(int *argc, char ***argv) { { "https-cert", 0,0, G_OPTION_ARG_STRING, &rtpe_config.https_cert,"Certificate for HTTPS and WSS","FILE"}, { "https-key", 0,0, G_OPTION_ARG_STRING, &rtpe_config.https_key, "Private key for HTTPS and WSS","FILE"}, { "http-threads", 0,0, G_OPTION_ARG_INT, &rtpe_config.http_threads,"Number of worker threads for HTTP and WS","INT"}, + { "software-id", 0,0, G_OPTION_ARG_STRING, &rtpe_config.software_id,"Identification string of this software presented to external systems","STRING"}, #ifdef WITH_TRANSCODING { "dtx-delay", 0,0, G_OPTION_ARG_INT, &rtpe_config.dtx_delay, "Delay in milliseconds to trigger DTX handling","INT"}, { "max-dtx", 0,0, G_OPTION_ARG_INT, &rtpe_config.max_dtx, "Maximum duration of DTX handling", "INT"}, @@ -734,6 +735,10 @@ static void options(int *argc, char ***argv) { } rtpe_config.cn_payload.len = len; } + + if (!rtpe_config.software_id) + rtpe_config.software_id = g_strdup_printf("rtpengine-%s", RTPENGINE_VERSION); + g_strcanon(rtpe_config.software_id, "QWERTYUIOPASDFGHJKLZXCVBNMqwertyuiopasdfghjklzxcvbnm1234567890-", '-'); } void fill_initial_rtpe_cfg(struct rtpengine_config* ini_rtpe_cfg) { @@ -859,6 +864,7 @@ static void options_free(void) { g_strfreev(rtpe_config.https_ifs); g_free(rtpe_config.https_cert); g_free(rtpe_config.https_key); + g_free(rtpe_config.software_id); // free common config options config_load_free(&rtpe_config.common); diff --git a/daemon/rtpengine.pod b/daemon/rtpengine.pod index 4a4ec7800..fb4d951a0 100644 --- a/daemon/rtpengine.pod +++ b/daemon/rtpengine.pod @@ -764,6 +764,13 @@ Number of worker threads for HTTP/HTTPS/WS/WSS. If not specified, then the same number as given under B will be used. If no HTTP listeners are enabled, then no threads are created. +=item B<--software-id=>I + +Sets a free-form string that is used to identify this software towards external +systems with, for example in outgoing ICE/STUN requests. Defaults to +BI. The string is sanitised to replace all +non-alphanumeric characters with a dash to make it universally usable. + =item B<--dtx-delay=>I Processing delay in milliseconds to handle discontinuous transmission (DTX) or diff --git a/daemon/stun.c b/daemon/stun.c index 63852a10f..eef7bd8d8 100644 --- a/daemon/stun.c +++ b/daemon/stun.c @@ -307,7 +307,7 @@ static void output_finish_src(struct msghdr *mh) { static void software(struct msghdr *mh, struct software *sw) { int i; - i = snprintf(sw->str, sizeof(sw->str), "rtpengine-%s", RTPENGINE_VERSION); + i = snprintf(sw->str, sizeof(sw->str), "%s", rtpe_config.software_id); output_add_data_len_pad(mh, sw, STUN_SOFTWARE, sw->str, i); } diff --git a/include/main.h b/include/main.h index 1edb10697..c569f9d4f 100644 --- a/include/main.h +++ b/include/main.h @@ -114,6 +114,7 @@ struct rtpengine_config { uint32_t silence_detect_int; str cn_payload; int reorder_codecs; + char *software_id; };