libmsc: Use actual delivery time in delivery reports.

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.

Change-Id: I9056429d40bf02731f004b7833f1de45a0d1add8
This commit is contained in:
Keith Whyte 2017-08-16 22:45:07 +02:00 committed by Neels Hofmeyr
parent 4e4ddff4c2
commit c601adcb89
3 changed files with 4 additions and 2 deletions

View File

@ -511,6 +511,7 @@ struct gsm_sms {
} smpp;
unsigned long validity_minutes;
time_t created;
bool is_report;
uint8_t reply_path_req;
uint8_t status_rep_req;

View File

@ -742,6 +742,7 @@ static struct gsm_sms *sms_from_result(struct gsm_network *net, dbi_result resul
/* 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");

View File

@ -312,11 +312,11 @@ static int gsm340_gen_sms_status_report_tpdu(struct msgb *msg,
/* 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);