changeset 57:d61d0136f6a5

sip-in INVITE processing: return "GSM service is offline" indication
author Mychaela Falconia <falcon@freecalypso.org>
date Thu, 08 Sep 2022 13:39:42 -0800
parents 7005d5c535e8
children 8d311fd1138b
files sip-in/invite.c sip-in/mncc_sock.c
diffstat 2 files changed, 7 insertions(+), 0 deletions(-) [+]
line wrap: on
line diff
--- a/sip-in/invite.c	Thu Sep 08 13:25:31 2022 -0800
+++ b/sip-in/invite.c	Thu Sep 08 13:39:42 2022 -0800
@@ -159,4 +159,10 @@
 			return;
 	}
 	/* SIP INVITE validation done - check if GSM service is up */
+	rc = connect_gsm_mtcall();
+	if (rc < 0) {
+		start_response_out_msg(&resp, "480 GSM service is offline");
+		goto error_resp;
+	}
+	/* stateful processing begins */
 }
--- a/sip-in/mncc_sock.c	Thu Sep 08 13:25:31 2022 -0800
+++ b/sip-in/mncc_sock.c	Thu Sep 08 13:39:42 2022 -0800
@@ -33,6 +33,7 @@
 	rc = connect(gsm_socket, (struct sockaddr *) &sa, sa_len);
 	if (rc < 0) {
 		syslog(LOG_ERR, "connect to %s: %m", mtcall_socket_pathname);
+		close(gsm_socket);
 		return(-1);
 	}
 	update_max_fd(gsm_socket);