changeset 92:a9137bdb6047

sip-in: make BYE Max-Forwards configurable
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 23 Sep 2022 19:18:07 -0800
parents fd23e2747b45
children ff5e96162430
files sip-in/bye_out.c sip-in/readconf.c
diffstat 2 files changed, 8 insertions(+), 1 deletions(-) [+]
line wrap: on
line diff
--- a/sip-in/bye_out.c	Fri Sep 23 19:05:08 2022 -0800
+++ b/sip-in/bye_out.c	Fri Sep 23 19:18:07 2022 -0800
@@ -21,6 +21,7 @@
 
 extern struct in_addr sip_bind_ip;
 extern unsigned sip_bind_port;
+extern unsigned max_forwards;
 
 fill_bye_out_msg(msg, call)
 	struct sip_msg_out *msg;
@@ -50,7 +51,8 @@
 	rc = out_msg_add_header(msg, "CSeq", "1 BYE");
 	if (rc < 0)
 		return rc;
-	rc = out_msg_add_header(msg, "Max-Forwards", "70");
+	sprintf(strbuf, "%u", max_forwards);
+	rc = out_msg_add_header(msg, "Max-Forwards", strbuf);
 	if (rc < 0)
 		return rc;
 	out_msg_finish(msg);
--- a/sip-in/readconf.c	Fri Sep 23 19:05:08 2022 -0800
+++ b/sip-in/readconf.c	Fri Sep 23 19:18:07 2022 -0800
@@ -19,6 +19,7 @@
 int cfg_use_100rel;
 unsigned cfg_retrans_timeout = 500;
 unsigned cfg_retrans_count = 10;
+unsigned max_forwards = 70;
 
 static char config_file_pathname[] = "/var/gsm/themwi-sip-in.cfg";
 
@@ -168,6 +169,10 @@
 		handler = handle_retrans_conf;
 		var = (void *) 0;
 		set_id = 0;
+	} else if (!strcmp(kw, "max-forwards")) {
+		handler = &handle_num;
+		var = &max_forwards;
+		set_id = 0;
 	} else {
 		fprintf(stderr, "%s line %d: non-understood keyword \"%s\"\n",
 			config_file_pathname, st->lineno, kw);