03.40 9.2.3.6TP-Message-Reference (TP-MR) The SMS-STATUS-REPORT also contains a TP-Message-Reference field. The value sent to the MS will be the sameas the TP-Message-Reference value generated by the MS in the earlier SMS-SUBMIT or SMS-COMMAND to whichthe status report relates.
-- Regards, Alexander Chemeris. CEO, Fairwaves, Inc. / ООО УмРадио https://fairwaves.co
From 9ba364ad474a12b8015cb4a7b7f6f43ff440ab0b Mon Sep 17 00:00:00 2001 From: Alexander Chemeris <[email protected]> Date: Sun, 9 Mar 2014 01:04:06 +0100 Subject: [PATCH 5/6] sms,db: Store SMS Message Reference in the DB, since we need it to generate SMS-STATUS-REPORT. 03.40 9.2.3.6TP-Message-Reference (TP-MR) The SMS-STATUS-REPORT also contains a TP-Message-Reference field. The value sent to the MS will be the sameas the TP-Message-Reference value generated by the MS in the earlier SMS-SUBMIT or SMS-COMMAND to whichthe status report relates. --- openbsc/src/libmsc/db.c | 9 +++++---- openbsc/tests/db/db_test.c | 2 ++ 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/openbsc/src/libmsc/db.c b/openbsc/src/libmsc/db.c index 4e879a0..c579cdf 100644 --- a/openbsc/src/libmsc/db.c +++ b/openbsc/src/libmsc/db.c @@ -117,6 +117,7 @@ static const char *create_stmts[] = { "received TIMESTAMP, " "deliver_attempts INTEGER NOT NULL DEFAULT 0, " /* data directly copied/derived from SMS */ + "msg_ref INTEGER NOT NULL, " "valid_until TIMESTAMP, " "reply_path_req INTEGER NOT NULL, " "status_rep_req INTEGER NOT NULL, " @@ -1293,19 +1294,19 @@ int db_sms_store(struct gsm_sms *sms) "'%F %T'", gmtime(&sms->valid_until)); result = dbi_conn_queryf(conn, "INSERT INTO SMS " - "(created, received, valid_until, " + "(created, received, msg_ref, valid_until, " "reply_path_req, status_rep_req, protocol_id, " "data_coding_scheme, ud_hdr_ind, " "user_data, text, " "dest_addr, dest_ton, dest_npi, " "src_addr, src_ton, src_npi) VALUES " - "(datetime('now'), %s, %s, " + "(datetime('now'), %s, %u, %s, " "%u, %u, %u, " "%u, %u, " "%s, %s, " "%s, %u, %u, " "%s, %u, %u)", - received_timestamp, validity_timestamp, + received_timestamp, sms->msg_ref, validity_timestamp, sms->reply_path_req, sms->status_rep_req, sms->protocol_id, sms->data_coding_scheme, sms->ud_hdr_ind, q_udata, q_text, @@ -1343,7 +1344,7 @@ static struct gsm_sms *sms_from_result(struct gsm_network *net, dbi_result resul "data_coding_scheme"); sms->received_time = dbi_result_get_datetime(result, "received"); sms->valid_until = dbi_result_get_datetime(result, "valid_until"); - /* sms->msg_ref is temporary and not stored in DB */ + sms->msg_ref = dbi_result_get_uint(result, "msg_ref"); sms->dst.npi = dbi_result_get_uint(result, "dest_npi"); sms->dst.ton = dbi_result_get_uint(result, "dest_ton"); diff --git a/openbsc/tests/db/db_test.c b/openbsc/tests/db/db_test.c index 3693cda..bf9f767 100644 --- a/openbsc/tests/db/db_test.c +++ b/openbsc/tests/db/db_test.c @@ -77,6 +77,7 @@ static void test_sms(void) sms->received_time = 12345; sms->valid_until = 67890; + sms->msg_ref = 123; sms->src.ton = 0x23; sms->src.npi = 0x24; @@ -107,6 +108,7 @@ static void test_sms(void) OSMO_ASSERT(sms->receiver == subscr); OSMO_ASSERT(sms->received_time == 12345); OSMO_ASSERT(sms->valid_until == 67890); + OSMO_ASSERT(sms->msg_ref == 123); OSMO_ASSERT(sms->reply_path_req == 1); OSMO_ASSERT(sms->status_rep_req == 2); OSMO_ASSERT(sms->ud_hdr_ind == 3); -- 1.7.9.5
