[PATCH] openbsc[master]: SMS Delivery reports: Use actual delivery time, not time of ...

This is merely a historical archive of years 2008-2021, before the migration to mailman3.

A maintained and still updated list archive can be found at https://lists.osmocom.org/hyperkitty/list/gerrit-log@lists.osmocom.org/.

Keith Whyte gerrit-no-reply at lists.osmocom.org
Wed Aug 16 20:48:31 UTC 2017


Review at  https://gerrit.osmocom.org/3540

SMS Delivery reports: Use actual delivery time, not time of report creation.

Set the time on the status report to the time the message was delivered, as
this may not be the same as the time when we are delivering the report to the
originating MS.

Also, ask sqlite to give us the localtime rather than GMT, as the MS
expects localtime

Change-Id: I9056429d40bf02731f004b7833f1de45a0d1add8
---
M openbsc/include/openbsc/gsm_data.h
M openbsc/src/libmsc/db.c
M openbsc/src/libmsc/gsm_04_11.c
3 files changed, 7 insertions(+), 5 deletions(-)


  git pull ssh://gerrit.osmocom.org:29418/openbsc refs/changes/40/3540/1

diff --git a/openbsc/include/openbsc/gsm_data.h b/openbsc/include/openbsc/gsm_data.h
index 6829d22..593adb3 100644
--- a/openbsc/include/openbsc/gsm_data.h
+++ b/openbsc/include/openbsc/gsm_data.h
@@ -457,6 +457,7 @@
 
 	unsigned long validity_minutes;
 	bool is_report;
+	time_t created;
 	uint8_t reply_path_req;
 	uint8_t status_rep_req;
 	uint8_t ud_hdr_ind;
diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c
index 631e05f..56b1441 100644
--- a/openbsc/src/libmsc/db.c
+++ b/openbsc/src/libmsc/db.c
@@ -1641,6 +1641,7 @@
 
 	/* FIXME: validity */
 	/* FIXME: those should all be get_uchar, but sqlite3 is braindead */
+	sms->created = dbi_result_get_datetime(result, "created");
 	sms->reply_path_req = dbi_result_get_ulonglong(result, "reply_path_req");
 	sms->status_rep_req = dbi_result_get_ulonglong(result, "status_rep_req");
 	sms->is_report = dbi_result_get_ulonglong(result, "is_report");
@@ -1704,7 +1705,7 @@
 	struct gsm_sms *sms;
 
 	result = dbi_conn_queryf(conn,
-		"SELECT SMS.* "
+		"SELECT datetime(SMS.created,'localtime') as created, SMS.* "
 			"FROM SMS JOIN Subscriber ON "
 				"SMS.dest_addr = Subscriber.extension "
 			"WHERE SMS.id >= %llu AND SMS.sent IS NULL "
@@ -1734,7 +1735,7 @@
 	struct gsm_sms *sms;
 
 	result = dbi_conn_queryf(conn,
-		"SELECT SMS.* "
+		"SELECT datetime(SMS.created,'localtime') as created, SMS.* "
 			"FROM SMS JOIN Subscriber ON "
 				"SMS.dest_addr = Subscriber.extension "
 			"WHERE Subscriber.id >= %llu AND SMS.sent IS NULL "
@@ -1763,7 +1764,7 @@
 	struct gsm_sms *sms;
 
 	result = dbi_conn_queryf(conn,
-		"SELECT SMS.* "
+		"SELECT datetime(SMS.created,'localtime') as created, SMS.* "
 			"FROM SMS JOIN Subscriber ON "
 				"SMS.dest_addr = Subscriber.extension "
 			"WHERE Subscriber.id = %llu AND SMS.sent IS NULL "
diff --git a/openbsc/src/libmsc/gsm_04_11.c b/openbsc/src/libmsc/gsm_04_11.c
index 5e736b3..ddef444 100644
--- a/openbsc/src/libmsc/gsm_04_11.c
+++ b/openbsc/src/libmsc/gsm_04_11.c
@@ -310,11 +310,11 @@
 
 	/* generate TP-SCTS (Service centre timestamp) */
 	smsp = msgb_put(msg, 7);
-	gsm340_gen_scts(smsp, time(NULL));
+	gsm340_gen_scts(smsp, sms->created);
 
 	/* generate TP-DT (Discharge time, in TP-SCTS format). */
 	smsp = msgb_put(msg, 7);
-	gsm340_gen_scts(smsp, time(NULL));
+	gsm340_gen_scts(smsp, sms->created);
 
 	/* TP-ST (status) */
 	smsp = msgb_put(msg, 1);

-- 
To view, visit https://gerrit.osmocom.org/3540
To unsubscribe, visit https://gerrit.osmocom.org/settings

Gerrit-MessageType: newchange
Gerrit-Change-Id: I9056429d40bf02731f004b7833f1de45a0d1add8
Gerrit-PatchSet: 1
Gerrit-Project: openbsc
Gerrit-Branch: master
Gerrit-Owner: Keith Whyte <keith at rhizomatica.org>



More information about the gerrit-log mailing list