changeset 86:f332ccc240f1

sip-in: preparations toward TMGW connect-through
author Mychaela Falconia <falcon@freecalypso.org>
date Tue, 20 Sep 2022 23:14:50 -0800
parents 70c3c8ebee33
children 9e9034ef476c
files sip-in/mgw_ops.c sip-in/mncc_handle.c
diffstat 2 files changed, 14 insertions(+), 2 deletions(-) [+]
line wrap: on
line diff
--- a/sip-in/mgw_ops.c	Tue Sep 20 22:47:53 2022 -0800
+++ b/sip-in/mgw_ops.c	Tue Sep 20 23:14:50 2022 -0800
@@ -63,7 +63,7 @@
 }
 
 void
-tmgw_send_mdcx_gsm_rtp(call)
+tmgw_send_mdcx_connect(call)
 	struct call *call;
 {
 	struct tmgw_ctrl_req req;
@@ -72,11 +72,12 @@
 	req.opcode = TMGW_CTRL_OP_MDCX;
 	req.transact_ref = get_new_tmgw_xact_id();
 	req.ep_id = call->mgw_ep_id;
-	req.setup_mask = TMGW_CTRL_MASK_GSM_CONN;
+	req.setup_mask = TMGW_CTRL_MASK_GSM_CONN | TMGW_CTRL_MASK_FWD_MODE;
 	bcopy(&call->gsm_rtp_osmo, &req.gsm_addr,
 		sizeof(struct sockaddr_storage));
 	req.gsm_payload_type = call->gsm_payload_type;
 	req.gsm_payload_msg_type = call->gsm_payload_msg_type;
+	req.fwd_mode = TMGW_FWD_MODE_SENDRECV;
 	send_req_to_tmgw(&req);
 	call->mgw_state = MGW_STATE_CONNECTING;
 	call->mgw_xact = TMGW_CTRL_OP_MDCX;
--- a/sip-in/mncc_handle.c	Tue Sep 20 22:47:53 2022 -0800
+++ b/sip-in/mncc_handle.c	Tue Sep 20 23:14:50 2022 -0800
@@ -52,6 +52,17 @@
 	}
 	call->mncc_state = MNCC_STATE_ANSWERED;
 	call->overall_state = OVERALL_STATE_ANSWERED;
+	/* right now we require MNCC_RTP_CREATE to have come first */
+	if (!call->gsm_payload_msg_type) {
+		call->overall_state = OVERALL_STATE_TEARDOWN;
+		disconnect_mncc(call, GSM48_CAUSE_LOC_PRN_S_LU,
+				GSM48_CC_CAUSE_PROTO_ERR);
+		disconnect_tmgw(call);
+		strcpy(call->invite_fail, "502 Internal protocol error");
+		signal_invite_error(call);
+		return;
+	}
+	/* TODO: send MDCX to themwi-mgw */
 	signal_invite_200(call);
 }