libmsc: set registered_delivery field in SMPP 3.4 DELIVER_SM messages

Propagate the status report request field to the SMPP message through
the registered_delivery field, so the ESME knows that the mobile phone
is asking for explicit delivery acknowledgment is required. See SMPP 3.4
specs section 5.2.17.

Change-Id: I59af60fa89cd10ae973c5e122789e3e03e3728ee
diff --git a/src/libmsc/smpp_openbsc.c b/src/libmsc/smpp_openbsc.c
index bf63f6b..8a1a7da 100644
--- a/src/libmsc/smpp_openbsc.c
+++ b/src/libmsc/smpp_openbsc.c
@@ -606,6 +606,10 @@
 	return NULL;
 }
 
+/* See SMPP 3.4, Section 5.2.17. registered_delivery (1 byte field). */
+#define SMPP34_NO_DELIVERY_RECEIPT	0x0
+#define SMPP34_DELIVERY_RECEIPT_REQ	0x1
+
 static int deliver_to_esme(struct osmo_esme *esme, struct gsm_sms *sms,
 			   struct gsm_subscriber_connection *conn)
 {
@@ -646,7 +650,10 @@
 
 	deliver.protocol_id 	= sms->protocol_id;
 	deliver.priority_flag	= 0;
-	deliver.registered_delivery = 0;
+	if (sms->status_rep_req)
+		deliver.registered_delivery = SMPP34_DELIVERY_RECEIPT_REQ;
+	else
+		deliver.registered_delivery = SMPP34_NO_DELIVERY_RECEIPT;
 
 	/* Figure out SMPP DCS from TP-DCS */
 	dcs = sms->data_coding_scheme;