changeset 73:d7b6b8973a83

sip-manual-out: handle To tag
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 20 Sep 2022 10:58:32 -0800
parents 9ca6f0708237
children 51e2f72dc5ab
files sip-manual-out/uac.c
diffstat 1 files changed, 11 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sip-manual-out/uac.c	Tue Sep 20 10:54:10 2022 -0800
+++ b/sip-manual-out/uac.c	Tue Sep 20 10:58:32 2022 -0800
@@ -16,6 +16,7 @@
 #define	MAX_TO_TAG	63
 
 extern char *get_single_header();
+extern char *extract_to_tag();
 
 extern struct in_addr sip_bind_ip;
 extern unsigned sip_bind_port;
@@ -88,7 +89,17 @@
 	struct sip_pkt_rx *msg;
 	struct sockaddr_in *sin;
 {
+	char *tag;
+
 	printf("Response to INVITE: %s\n", msg->status_str);
+	tag = extract_to_tag(msg, to_uri);
+	if (tag) {
+		printf("To tag: %s\n", tag);
+		if (strlen(tag) <= MAX_TO_TAG)
+			strcpy(to_tag, tag);
+		else
+			printf("To tag exceeds length limit!\n");
+	}
 	if (msg->status_code >= 200) {
 		printf("Sending ACK\n");
 		send_ack(sin);