diff sip-in/invite.c @ 51:36a30349b490

sip-in: parse INVITE From header
author Mychaela Falconia <falcon@freecalypso.org>
date Wed, 07 Sep 2022 17:53:10 -0800
parents daf1c26d7ae2
children f1d59210f7b2
line wrap: on
line diff
--- a/sip-in/invite.c	Tue Sep 06 23:50:16 2022 -0800
+++ b/sip-in/invite.c	Wed Sep 07 17:53:10 2022 -0800
@@ -13,6 +13,7 @@
 #include <unistd.h>
 #include "../libsip/parse.h"
 #include "../libsip/uas_basic.h"
+#include "../libsip/grok_from.h"
 #include "../libsip/req_supp.h"
 #include "../libsip/out_msg.h"
 
@@ -28,6 +29,7 @@
 {
 	char uri_user[13], *called_nanp;
 	struct sip_msg_out resp;
+	struct grok_from gfrom;
 	struct supported_ext supp_ext;
 	char *hval, *unsup_ext;
 	int ext_100rel_req, ext_100rel_sup, use_100rel;
@@ -75,6 +77,12 @@
 			"404 Called number does not belong here");
 		goto error_resp;
 	}
+	/* parse and validate From header */
+	rc = grok_from_header(ess->from, &gfrom);
+	if (rc < 0) {
+		start_response_out_msg(&resp, "400 Malformed From header");
+		goto error_resp;
+	}
 	/* check 100rel and catch any unsupported requirements */
 	supp_ext.name = "100rel";
 	supp_ext.req_flag = &ext_100rel_req;