changeset 139:c731ec342ba0

mtctest: rework MNCC_RTP_CONNECT sending for hold/retrieve and CW
author Mychaela Falconia <falcon@freecalypso.org>
date Fri, 07 Oct 2022 23:25:38 -0800
parents 0967f67c6ac3
children 01fe81914bd6
files mtctest/sig_handler.c
diffstat 1 files changed, 32 insertions(+), 9 deletions(-) [+]
line wrap: on
line diff
--- a/mtctest/sig_handler.c	Fri Oct 07 16:00:26 2022 -0800
+++ b/mtctest/sig_handler.c	Fri Oct 07 23:25:38 2022 -0800
@@ -167,6 +167,19 @@
 }
 
 static void
+send_rtp_connect()
+{
+	struct gsm_mncc_rtp rtp;
+
+	printf("Sending MNCC_RTP_CONNECT\n");
+	bzero(&rtp, sizeof(struct gsm_mncc_rtp));
+	rtp.msg_type = MNCC_RTP_CONNECT;
+	rtp.callref = 1;
+	bcopy(&dummy_rtp_endp, &rtp.addr, sizeof(struct sockaddr_storage));
+	send_mncc_to_gsm(&rtp, sizeof(struct gsm_mncc_rtp));
+}
+
+static void
 handle_signaling_msg(msg, msglen)
 	struct gsm_mncc *msg;
 	unsigned msglen;
@@ -187,6 +200,7 @@
 	case MNCC_SETUP_CNF:
 		printf("MNCC_SETUP_CNF: call is answered\n");
 		print_fields(msg);
+		send_rtp_connect();
 		send_connect_ack();
 		return;
 	case MNCC_CALL_CONF_IND:
@@ -248,6 +262,7 @@
 		return;
 	case MNCC_RETRIEVE_IND:
 		printf("MNCC_RETRIEVE_IND: MS requests call retrieve\n");
+		send_rtp_connect();
 		msg->msg_type = MNCC_RETRIEVE_CNF;
 		send_mncc_to_gsm(msg, sizeof(struct gsm_mncc));
 		return;
@@ -271,7 +286,7 @@
 }
 
 static void
-handle_rtp_create(msg, msglen)
+handle_rtp_msg(msg, msglen)
 	struct gsm_mncc_rtp *msg;
 	unsigned msglen;
 {
@@ -287,13 +302,19 @@
 			msg->msg_type, msg->callref);
 		exit(1);
 	}
-	printf("MNCC_RTP_CREATE: RTP info from MSC\n");
-	printf("payload_type=0x%x payload_msg_type=0x%x\n", msg->payload_type,
-		msg->payload_msg_type);
-	printf("Responding with MNCC_RTP_CONNECT (dummy RTP endpoint)\n");
-	msg->msg_type = MNCC_RTP_CONNECT;
-	bcopy(&dummy_rtp_endp, &msg->addr, sizeof(struct sockaddr_storage));
-	send_mncc_to_gsm(msg, sizeof(struct gsm_mncc_rtp));
+	switch (msg->msg_type) {
+	case MNCC_RTP_CREATE:
+		printf("MNCC_RTP_CREATE: RTP info from MSC\n");
+		printf("payload_type=0x%x payload_msg_type=0x%x\n",
+			msg->payload_type, msg->payload_msg_type);
+		return;
+	case MNCC_RTP_CONNECT:
+		printf("MNCC_RTP_CONNECT: error response\n");
+		return;
+	case MNCC_RTP_FREE:
+		printf("MNCC_RTP_FREE: bogon\n");
+		return;
+	}
 }
 
 void
@@ -320,7 +341,9 @@
 		handle_signaling_msg(msg, msglen);
 		return;
 	case MNCC_RTP_CREATE:
-		handle_rtp_create(msg, msglen);
+	case MNCC_RTP_CONNECT:
+	case MNCC_RTP_FREE:
+		handle_rtp_msg(msg, msglen);
 		return;
 	default:
 		fprintf(stderr,