RTPproxy: Handle preference range change.

This commit is contained in:
Anders Broman 2022-02-17 10:16:08 +01:00
parent 9ef6eaa539
commit 58adcf1e7d
1 changed files with 13 additions and 1 deletions

View File

@ -274,6 +274,9 @@ static gint ett_rtpproxy_ng_bencode = -1;
/* Default values */
#define RTPPROXY_PORT "22222" /* Not IANA registered */
static range_t* rtpproxy_tcp_range = NULL;
static range_t* rtpproxy_udp_range = NULL;
static gboolean rtpproxy_establish_conversation = TRUE;
/* See - https://www.opensips.org/html/docs/modules/1.10.x/rtpproxy.html#id293555 */
/* See - http://www.kamailio.org/docs/modules/4.3.x/modules/rtpproxy.html#idp15794952 */
@ -900,6 +903,14 @@ dissect_rtpproxy(tvbuff_t *tvb, packet_info *pinfo, proto_tree *tree, void *data
return tvb_captured_length(tvb);
}
/* Preference callbacks */
static void
rtpproxy_prefs_apply(void) {
rtpproxy_tcp_range = prefs_get_range_value("rtpproxy", "tcp.port");
rtpproxy_udp_range = prefs_get_range_value("rtpproxy", "udp.port");
}
void
proto_register_rtpproxy(void)
{
@ -1448,7 +1459,7 @@ proto_register_rtpproxy(void)
expert_rtpproxy_module = expert_register_protocol(proto_rtpproxy);
expert_register_field_array(expert_rtpproxy_module, ei, array_length(ei));
rtpproxy_module = prefs_register_protocol(proto_rtpproxy, proto_reg_handoff_rtpproxy);
rtpproxy_module = prefs_register_protocol(proto_rtpproxy, rtpproxy_prefs_apply);
prefs_register_bool_preference(rtpproxy_module, "establish_conversation",
"Establish Media Conversation",
@ -1477,6 +1488,7 @@ proto_reg_handoff_rtpproxy(void)
/* Register TCP port for dissection */
dissector_add_uint_range_with_preference("tcp.port", RTPPROXY_PORT, rtpproxy_tcp_handle);
dissector_add_uint_range_with_preference("udp.port", RTPPROXY_PORT, rtpproxy_udp_handle);
rtpproxy_prefs_apply();
rtpproxy_initialized = TRUE;
}