Hello there.
I was wroten another small patch to opensmppbox. When i got from smpp
smsc an fail status due sms was expired, at stat field of message was
EXPIRED, but when DLR passes trought opensmppbox, target client got
fixed UNDELIV text. Original code doesnot reflect original reason why
sms delivery failed.
Please review that code, if there are no memory leaks, or if that code
should be applicated to all message statuses, not only DLR_FAIL and
DLR_SMSC_FAIL.
Slavoj.
--- opensmppbox.c.old 2010-10-06 19:05:13.000000000 +0200
+++ opensmppbox.c 2010-10-28 13:57:20.000000000 +0200
@@ -603,6 +692,7 @@
Msg *dlr;
char *text, *tmps, err[4] = { '0', '0', '0', '\0' };
char submit_date_c_str[11] = { '\0' }, done_date_c_str[11] = { '\0' };
+ char original_stat[11] = { '\0' };
struct tm tm_tmp;
Octstr *msgid, *msgid2, *dlr_status, *dlvrd;
/* split variables */
@@ -723,6 +813,17 @@
parts = octstr_split(msg->sms.dlr_url, octstr_imm(";"));
msgid = gwlist_extract_first(parts);
dlr = dlr_find(box->boxc_id, msgid, msg->sms.receiver, dlrtype, 0);
+
+ text = octstr_get_cstr(msg->sms.msgdata);
+ debug("opensmppbox", 0, "Original DLR sms.msgdata: %s.", text);
+
+ tmps = strstr(text, " stat:");
+ if (tmps != NULL) {
+ text = tmps + (6 * sizeof(char));
+ sscanf(text,"%s",&original_stat);
+ debug("opensmppbox", 0, "Original DLR stat: %s.",
original_stat);
+ }
+
if (dlr == NULL) {
/* we could not find a corresponding dlr; nothing to send */
smpp_pdu_destroy(pdu);
@@ -755,10 +856,12 @@
case DLR_FAIL:
case DLR_SMSC_FAIL:
dlr_state = 5;
- dlr_status = octstr_imm("UNDELIV");
+ // dlr_status = octstr_imm("UNDELIV");
+ dlr_status = octstr_create(original_stat);
break;
}