changeset 91:fd23e2747b45

sip-in: add sip-udp-retrans configuration setting
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 23 Sep 2022 19:05:08 -0800
parents 736c2d68595f
children a9137bdb6047
files sip-in/readconf.c
diffstat 1 files changed, 29 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sip-in/readconf.c	Fri Sep 23 18:53:35 2022 -0800
+++ b/sip-in/readconf.c	Fri Sep 23 19:05:08 2022 -0800
@@ -106,6 +106,31 @@
 }
 
 static void
+handle_retrans_conf(st, kw, arg)
+	struct parse_state *st;
+	char *kw, *arg;
+{
+	char *cp = arg;
+
+	if (!isdigit(*cp)) {
+inv:		fprintf(stderr,
+		"%s line %d: %s setting requires two numeric arguments\n",
+			config_file_pathname, st->lineno, kw);
+		exit(1);
+	}
+	cfg_retrans_timeout = strtoul(cp, &cp, 10);
+	while (isspace(*cp))
+		cp++;
+	if (!isdigit(*cp))
+		goto inv;
+	cfg_retrans_count = strtoul(cp, &cp, 10);
+	while (isspace(*cp))
+		cp++;
+	if (*cp != '\0' && *cp != '#')
+		goto inv;
+}
+
+static void
 process_line(st, line)
 	struct parse_state *st;
 	char *line;
@@ -139,6 +164,10 @@
 		handler = handle_bool;
 		var = &cfg_use_100rel;
 		set_id = 0;
+	} else if (!strcmp(kw, "sip-udp-retrans")) {
+		handler = handle_retrans_conf;
+		var = (void *) 0;
+		set_id = 0;
 	} else {
 		fprintf(stderr, "%s line %d: non-understood keyword \"%s\"\n",
 			config_file_pathname, st->lineno, kw);