libmsc/gsm_04_11.c: properly handle MMTS indication

According to 3GPP TS 29.002, section 7.6.8.7, MMS (More Messages to Send)
is an optional IE of MT-ForwardSM-Req message which is used by SMSC to
indicate that there are more (multi-part) MT SMS messages to be sent.

The MSC needs to use this indication in order to decide whether to
keep the RAN connection with a given subscriber open.

Related Change-Id: (TTCN) I6308586a70c4fb3254c519330a61a9667372149f
Change-Id: Ic46b04913b2e8cc5d11a39426dcc1bfe11f1d31e
Related: OS#3587
diff --git a/src/libmsc/gsm_04_11_gsup.c b/src/libmsc/gsm_04_11_gsup.c
index 9f5175b..a1ec634 100644
--- a/src/libmsc/gsm_04_11_gsup.c
+++ b/src/libmsc/gsm_04_11_gsup.c
@@ -234,6 +234,7 @@
 	const struct osmo_gsup_message *gsup_msg)
 {
 	struct gsm_network *net;
+	bool sm_rp_mmts_ind;
 	int rc;
 
 	/* Obtain required pointers */
@@ -267,10 +268,17 @@
 	if (gsup_msg->sm_rp_oa_type != OSMO_GSUP_SMS_SM_RP_ODA_SMSC_ADDR)
 		goto msg_error;
 
+	/* MMS (More Messages to Send) IE is optional */
+	if (gsup_msg->sm_rp_mms)
+		sm_rp_mmts_ind = *gsup_msg->sm_rp_mms > 0;
+	else
+		sm_rp_mmts_ind = false;
+
 	/* Send RP-DATA */
 	rc = gsm411_send_rp_data(net, vsub,
 		gsup_msg->sm_rp_oa_len, gsup_msg->sm_rp_oa,
-		gsup_msg->sm_rp_ui_len, gsup_msg->sm_rp_ui);
+		gsup_msg->sm_rp_ui_len, gsup_msg->sm_rp_ui,
+		sm_rp_mmts_ind);
 	if (rc) {
 		LOGP(DLSMS, LOGL_NOTICE, "Failed to send MT SMS, "
 			"ignoring MT-forwardSM-Req message...\n");