[PATCH] BUG on DLR parsing
Alejandro Guerrieri <[email protected]>
| Newsgroups | gmane.comp.mobile.kannel.devel |
|---|---|
| Message-ID | <[email protected]> |
This patch fixes a bug when parsing DLR's: As the code is now, if a DLR having a receipted_message_id, the DLR text is not parsed, so the "err" and "stat" fields are empty. In particular, the "err" code is being passed on the "binfo" field, so this remained empty if a receipted_message_id is present (because the sscanf code was not executed). Attached patch fixes that part, so the "err" parameter is present on the binfo field on all cases. Regards, -- Alejandro Guerrieri [email protected]
kannel-smsc-dlr-err.patch
(application/octet-stream, 2 KB)
Index: gw/smsc/smsc_smpp.c
===================================================================
RCS file: /home/cvs/gateway/gw/smsc/smsc_smpp.c,v
retrieving revision 1.114
diff -u -r1.114 smsc_smpp.c
--- gw/smsc/smsc_smpp.c 2 Apr 2009 20:30:19 -0000 1.114
+++ gw/smsc/smsc_smpp.c 29 Apr 2009 16:00:42 -0000
@@ -1214,8 +1251,8 @@
else
respstr = short_message;
- /* still no msgid or dlrstat ? */
- if ((msgid == NULL || dlrstat == -1) && respstr) {
+ /* parse the respstr if it exists */
+ if (respstr) {
long curr = 0, vpos = 0;
Octstr *stat = NULL;
char id_cstr[65], stat_cstr[16], sub_d_cstr[13], done_d_cstr[13];
@@ -1279,17 +1316,18 @@
* Note: some buggy SMSC's send us immediately delivery notifications although
* we doesn't requested these.
*/
- if (stat != NULL && octstr_compare(stat, octstr_imm("DELIVRD")) == 0)
- dlrstat = DLR_SUCCESS;
- else if (stat != NULL && (octstr_compare(stat, octstr_imm("ACCEPTD")) == 0 ||
- octstr_compare(stat, octstr_imm("ACKED")) == 0 ||
- octstr_compare(stat, octstr_imm("BUFFRED")) == 0 ||
- octstr_compare(stat, octstr_imm("BUFFERD")) == 0 ||
- octstr_compare(stat, octstr_imm("ENROUTE")) == 0))
- dlrstat = DLR_BUFFERED;
- else
- dlrstat = DLR_FAIL;
-
+ if (dlrstat == -1) {
+ if (stat != NULL && octstr_compare(stat, octstr_imm("DELIVRD")) == 0)
+ dlrstat = DLR_SUCCESS;
+ else if (stat != NULL && (octstr_compare(stat, octstr_imm("ACCEPTD")) == 0 ||
+ octstr_compare(stat, octstr_imm("ACKED")) == 0 ||
+ octstr_compare(stat, octstr_imm("BUFFRED")) == 0 ||
+ octstr_compare(stat, octstr_imm("BUFFERD")) == 0 ||
+ octstr_compare(stat, octstr_imm("ENROUTE")) == 0))
+ dlrstat = DLR_BUFFERED;
+ else
+ dlrstat = DLR_FAIL;
+ }
octstr_destroy(stat);
}