1 From: Erin Yueh <erin_yueh@openmoko.com>
2 Subject: [PATCH] SMS status report
4 I made a patch for SMS status report. It can change SMS-Submit messages
5 and ask for a status report. When the destination address receives our
6 message, the service center will send a SMS-STATUS-REPORT to us. We can
7 tell what messages we sent by TP-MR (message reference number) value and
8 can know the sending result by TP-ST (Status) value from status report
11 PS. if you don't want to ask a status report, you can change this value
12 back. Replace "GSMD_SMS_TP_SRR_STATUS_REQUEST" with
13 "GSMD_SMS_TP_SRR_NOT_REQUEST".
15 GSMD_SMS_TP_MTI_SUBMIT |
16 (0 << 2) | /* Reject Duplicates: 0 */
17 GSMD_SMS_TP_VPF_NOT_PRESENT |
18 - GSMD_SMS_TP_SRR_NOT_REQUEST |
19 + GSMD_SMS_TP_SRR_STATUS_REQUEST |
20 (src->payload.has_header ? GSMD_SMS_TP_UDHI_WITH_HEADER :
21 GSMD_SMS_TP_UDHI_NO_HEADER) |
22 GSMD_SMS_TP_RP_NOT_SET;
24 Signed-off-by: Jim Huang <jserv@openmoko.org>
26 src/gsmd/sms_pdu.c | 54 +++++++++++++++++++++++++++++++++++++++++++-----------
27 src/util/event.c | 6 +++++-
28 2 files changed, 48 insertions(+), 12 deletions(-)
30 Index: gsm/src/gsmd/sms_pdu.c
31 ===================================================================
32 --- gsm.orig/src/gsmd/sms_pdu.c 2007-09-06 11:14:34.000000000 +0800
33 +++ gsm/src/gsmd/sms_pdu.c 2007-09-17 23:39:20.000000000 +0800
40 + dst->payload.length = src[0];
41 + i = sms_data_bytelen(dst->payload.coding_scheme, src[0]);
44 + if (len < 1 + i || i > GSMD_SMS_DATA_MAXLEN)
46 + memcpy(dst->payload.data, src + 1, i);
47 + dst->payload.data[i] = 0;
50 case GSMD_SMS_TP_MTI_SUBMIT:
55 memset(dst->time_stamp, 0, 7);
58 + dst->payload.length = src[0];
59 + i = sms_data_bytelen(dst->payload.coding_scheme, src[0]);
62 + if (len < 1 + i || i > GSMD_SMS_DATA_MAXLEN)
64 + memcpy(dst->payload.data, src + 1, i);
65 + dst->payload.data[i] = 0;
67 case GSMD_SMS_TP_MTI_STATUS_REPORT:
72 + /* TP-MR set it gsmd_sms_list.index*/
73 + dst->index = (int) src[1];
74 + /* TP-STATUS set it to coding_scheme */
75 + dst->payload.coding_scheme = (int) src[len-1];
77 + i = sms_number_bytelen(src[3], src[2]);
80 + if (sms_address2ascii(&dst->addr, src + 2))
85 + memcpy(dst->time_stamp, src, 7);
87 + dst->payload.length = 0;
88 + dst->payload.data[0] = 0;
91 /* Unknown PDU type */
96 - dst->payload.length = src[0];
97 - i = sms_data_bytelen(dst->payload.coding_scheme, src[0]);
100 - if (len < 1 + i || i > GSMD_SMS_DATA_MAXLEN)
102 - memcpy(dst->payload.data, src + 1, i);
103 - dst->payload.data[i] = 0;
108 GSMD_SMS_TP_MTI_SUBMIT |
109 (0 << 2) | /* Reject Duplicates: 0 */
110 GSMD_SMS_TP_VPF_NOT_PRESENT |
111 - GSMD_SMS_TP_SRR_NOT_REQUEST |
112 + GSMD_SMS_TP_SRR_STATUS_REQUEST |
113 (src->payload.has_header ? GSMD_SMS_TP_UDHI_WITH_HEADER :
114 GSMD_SMS_TP_UDHI_NO_HEADER) |
115 GSMD_SMS_TP_RP_NOT_SET;
116 Index: gsm/src/util/event.c
117 ===================================================================
118 --- gsm.orig/src/util/event.c 2007-09-06 11:14:34.000000000 +0800
119 +++ gsm/src/util/event.c 2007-09-17 23:39:47.000000000 +0800
121 static int inds_handler(struct lgsm_handle *lh, int evt,
122 struct gsmd_evt_auxdata *aux)
124 - if (aux->u.ds.inlined)
125 + if (aux->u.ds.inlined) {
126 + struct gsmd_sms_list *sms;
127 + sms = (struct gsmd_sms_list *) aux->data;
128 printf("EVENT: Incoming Status Report\n");
129 + printf("message ref = %d, status = %d\n", sms->index,sms->payload.coding_scheme);
132 printf("EVENT: Incoming Status Report stored at location %i\n",