RE: RE: DLR parsing issue with SMPP

Michael Zervakis <[email protected]>
Newsgroups gmane.comp.mobile.kannel.devel
Message-ID <[email protected]>

You are right that the values are appended without labels and spaces, 
however I'm aware of two cases of carriers that use this format instead 
of the standard one. I think the only solution to my issue is to use 
sscanf with two format cases :

The standard one with labels and single spaces: "id:%64[^s] sub:%d 
dlvrd:%d submit date:%14[0-9] done date:%14[0-9] stat:%15[^t^e] 
err:%3[^t]" if payload starts with chars "id:"
And one without labels and spaces: 
"%64[^s]%d%d%14[0-9]%14[0-9]%15[^t^e]%3[^t]"


From: Andreas Fink [mailto:[email protected]]
Sent: Monday, September 28, 2009 9:15 PM
To: Michael Zervakis
Cc: [email protected]
Subject: Re: DLR parsing issue with SMPP



the delivery report is ill formatted:



2009-09-28 17:45:23 [9399] [14] DEBUG: data: 31 30 37 39 38 34 39 33 35 
36 30 30 31 30 30 31 1079849356001001
2009-09-28 17:45:23 [9399] [14] DEBUG: data: 30 39 30 39 32 38 31 37 34 
35 30 39 30 39 32 38 0909281745090928
2009-09-28 17:45:23 [9399] [14] DEBUG: data: 31 37 34 35 44 45 4c 49 56 
52 44 30 30 30 54 45 1745DELIVRD000TE



See Appendix B of SMPP_v3_4_Issue_1_2.pdf



SMPP provides for return of an SMSC delivery receipt via the deliver_sm 
or data_sm PDU, which indicates the delivery status of the message.

The informational content of an SMSC Delivery Receipt may be inserted 
into the short_message parameter of the deliver_sm operation. The format 
for this Delivery Receipt message is SMSC vendor specific but following 
is a typical example of Delivery Receipt report.

"id:IIIIIIIIII sub:SSS dlvrd:DDD submit date:YYMMDDhhmm done 
date:YYMMDDhhmm stat:DDDDDDD err:E Text: . . . . . . . . ."



in above text there are no "id:" , no "sub:" no "dlvrd:" no "submit 
date:" no "done date:" so kannel can not parse it.

It looks more like the parameters are just appended after each other 
without the labels.





On 28.09.2009, at 17:36, Michael Zervakis wrote:



Dear all,

We have an issue with a SMSC using SMPP and bearerbox cvs-20090921, 
where bearerbox can't decode correctly DLR message and therefore can't 
find the dlr report.

MT TCPDUMP
-----------------
17:45:19.128701 IP 172.20.20.20.59241 > 172.30.30.30.3700: P 
3350057118:3350057172(54) ack 2867587379 win 142 <nop,nop,timestamp 
153235712 108093610>
0x0000: 4500 006a 9d82 4000 4006 058c c129 e508 E..j..@.@....)..
0x0010: 50f5 a058 e769 0e74 c7ad d09e aaeb e933 P..X.i.t.......3
0x0020: 8018 008e 97dc 0000 0101 080a 0922 3100 ............."1.
0x0030: 0671 60aa 0000 0036 0000 0004 0000 0000 .q`....6........
0x0040: 0000 87b3 0002 0139 3939 3939 0001 0139 .......99999...9
0x0050: 3939 3939 3939 3939 3939 3900 0300 0000 99999999999.....
0x0060: 0001 0000 0004 5445 5354 ......TEST

MT SMS BEARERBOX DEBUG
-----------------------------------
2009-09-28 17:45:19 [9399] [13] DEBUG: SMPP[SMSC]: Sending PDU:
2009-09-28 17:45:19 [9399] [13] DEBUG: SMPP PDU 0x821df38 dump:
2009-09-28 17:45:19 [9399] [13] DEBUG: type_name: submit_sm
2009-09-28 17:45:19 [9399] [13] DEBUG: command_id: 4 = 0x00000004
2009-09-28 17:45:19 [9399] [13] DEBUG: command_status: 0 = 0x00000000
2009-09-28 17:45:19 [9399] [13] DEBUG: sequence_number: 34739 = 0x000087b3
2009-09-28 17:45:19 [9399] [13] DEBUG: service_type: NULL
2009-09-28 17:45:19 [9399] [13] DEBUG: source_addr_ton: 2 = 0x00000002
2009-09-28 17:45:19 [9399] [13] DEBUG: source_addr_npi: 1 = 0x00000001
2009-09-28 17:45:19 [9399] [13] DEBUG: source_addr: "99999"
2009-09-28 17:45:19 [9399] [13] DEBUG: dest_addr_ton: 1 = 0x00000001
2009-09-28 17:45:19 [9399] [13] DEBUG: dest_addr_npi: 1 = 0x00000001
2009-09-28 17:45:19 [9399] [13] DEBUG: destination_addr: "999999999999"
2009-09-28 17:45:19 [9399] [13] DEBUG: esm_class: 3 = 0x00000003
2009-09-28 17:45:19 [9399] [13] DEBUG: protocol_id: 0 = 0x00000000
2009-09-28 17:45:19 [9399] [13] DEBUG: priority_flag: 0 = 0x00000000
2009-09-28 17:45:19 [9399] [13] DEBUG: schedule_delivery_time: NULL
2009-09-28 17:45:19 [9399] [13] DEBUG: validity_period: NULL
2009-09-28 17:45:19 [9399] [13] DEBUG: registered_delivery: 1 = 0x00000001
2009-09-28 17:45:19 [9399] [13] DEBUG: replace_if_present_flag: 0 = 
0x00000000
2009-09-28 17:45:19 [9399] [13] DEBUG: data_coding: 0 = 0x00000000
2009-09-28 17:45:19 [9399] [13] DEBUG: sm_default_msg_id: 0 = 0x00000000
2009-09-28 17:45:19 [9399] [13] DEBUG: sm_length: 4 = 0x00000004
2009-09-28 17:45:19 [9399] [13] DEBUG: short_message: "TEST"
2009-09-28 17:45:19 [9399] [13] DEBUG: SMPP PDU dump ends.
2009-09-28 17:45:19 [9399] [13] DEBUG: SMPP[SMSC]: Got PDU:
2009-09-28 17:45:19 [9399] [13] DEBUG: SMPP PDU 0x821df38 dump:
2009-09-28 17:45:19 [9399] [13] DEBUG: type_name: submit_sm_resp
2009-09-28 17:45:19 [9399] [13] DEBUG: command_id: 2147483652 = 0x80000004
2009-09-28 17:45:19 [9399] [13] DEBUG: command_status: 0 = 0x00000000
2009-09-28 17:45:19 [9399] [13] DEBUG: sequence_number: 34739 = 0x000087b3
2009-09-28 17:45:19 [9399] [13] DEBUG: message_id: "405d318c"
2009-09-28 17:45:19 [9399] [13] DEBUG: SMPP PDU dump ends.
2009-09-28 17:45:19 [9399] [13] DEBUG: DLR[mysql]: Adding DLR smsc=SMSC, 
ts=405d318c, src=99999, dst=+999999999999, mask=1, boxc=GR
2009-09-28 17:45:19 [9399] [13] DEBUG: adding DLR entry into database
2009-09-28 17:45:19 [9399] [13] DEBUG: sql: INSERT INTO dlr (smsc, ts, 
source, destination, service, url, mask, boxcid, status) VALUES (?, ?, 
?, ?, ?, ?, ?, ?, 0)


DLR TCPDUMP
------------------
17:45:23.627672 IP 172.30.30.30.3700 > 172.20.20.20.59242: P 
38944887:38944987(100) ack 3343504612 win 5792 <nop,nop,timestamp 
108094881 153233119>
0x0000: 4500 0098 3a24 0000 3c06 acbc 50f5 a058 E...:$..<...P..X
0x0010: c129 e508 0e74 e76a 0252 4077 c749 d4e4 .)[email protected]..
0x0020: 8018 16a0 26cd 0000 0101 080a 0671 65a1 ....&........qe.
0x0030: 0922 26df 0000 0064 0000 0005 0000 0000 ."&....d........
0x0040: 0042 c248 0001 0139 3939 3939 3939 3939 .B.H...999999999
0x0050: 3939 3900 0201 3939 3939 3900 0400 0000 999...99999.....
0x0060: 0000 0000 0032 3130 3739 3834 3933 3536 .....21079849356
0x0070: 3030 3130 3031 3039 3039 3238 3137 3435 0010010909281745
0x0080: 3039 3039 3238 3137 3435 4445 4c49 5652 0909281745DELIVR
0x0090: 4430 3030 5445 5354 D000TEST

DLR BEARERBOX DEBUG
-------------------------------
2009-09-28 17:45:23 [9399] [14] DEBUG: SMPP[SMSC]: Got PDU:
2009-09-28 17:45:23 [9399] [14] DEBUG: SMPP PDU 0x821df38 dump:
2009-09-28 17:45:23 [9399] [14] DEBUG: type_name: deliver_sm
2009-09-28 17:45:23 [9399] [14] DEBUG: command_id: 5 = 0x00000005
2009-09-28 17:45:23 [9399] [14] DEBUG: command_status: 0 = 0x00000000
2009-09-28 17:45:23 [9399] [14] DEBUG: sequence_number: 4375112 = 0x0042c248
2009-09-28 17:45:23 [9399] [14] DEBUG: service_type: NULL
2009-09-28 17:45:23 [9399] [14] DEBUG: source_addr_ton: 1 = 0x00000001
2009-09-28 17:45:23 [9399] [14] DEBUG: source_addr_npi: 1 = 0x00000001
2009-09-28 17:45:23 [9399] [14] DEBUG: source_addr: "999999999999"
2009-09-28 17:45:23 [9399] [14] DEBUG: dest_addr_ton: 2 = 0x00000002
2009-09-28 17:45:23 [9399] [14] DEBUG: dest_addr_npi: 1 = 0x00000001
2009-09-28 17:45:23 [9399] [14] DEBUG: destination_addr: "99999"
2009-09-28 17:45:23 [9399] [14] DEBUG: esm_class: 4 = 0x00000004
2009-09-28 17:45:23 [9399] [14] DEBUG: protocol_id: 0 = 0x00000000
2009-09-28 17:45:23 [9399] [14] DEBUG: priority_flag: 0 = 0x00000000
2009-09-28 17:45:23 [9399] [14] DEBUG: schedule_delivery_time: NULL
2009-09-28 17:45:23 [9399] [14] DEBUG: validity_period: NULL
2009-09-28 17:45:23 [9399] [14] DEBUG: registered_delivery: 0 = 0x00000000
2009-09-28 17:45:23 [9399] [14] DEBUG: replace_if_present_flag: 0 = 
0x00000000
2009-09-28 17:45:23 [9399] [14] DEBUG: data_coding: 0 = 0x00000000
2009-09-28 17:45:23 [9399] [14] DEBUG: sm_default_msg_id: 0 = 0x00000000
2009-09-28 17:45:23 [9399] [14] DEBUG: sm_length: 50 = 0x00000032
2009-09-28 17:45:23 [9399] [14] DEBUG: short_message:
2009-09-28 17:45:23 [9399] [14] DEBUG: Octet string at 0x821df08:
2009-09-28 17:45:23 [9399] [14] DEBUG: len: 50
2009-09-28 17:45:23 [9399] [14] DEBUG: size: 51
2009-09-28 17:45:23 [9399] [14] DEBUG: immutable: 0
2009-09-28 17:45:23 [9399] [14] DEBUG: data: 31 30 37 39 38 34 39 33 35 
36 30 30 31 30 30 31 1079849356001001
2009-09-28 17:45:23 [9399] [14] DEBUG: data: 30 39 30 39 32 38 31 37 34 
35 30 39 30 39 32 38 0909281745090928
2009-09-28 17:45:23 [9399] [14] DEBUG: data: 31 37 34 35 44 45 4c 49 56 
52 44 30 30 30 54 45 1745DELIVRD000TE
2009-09-28 17:45:23 [9399] [14] DEBUG: data: 53 54 ST
2009-09-28 17:45:23 [9399] [14] DEBUG: Octet string dump ends.
2009-09-28 17:45:23 [9399] [14] DEBUG: SMPP PDU dump ends.
2009-09-28 17:45:23 [9399] [14] DEBUG: SMPP[SMSC] handle_pdu, got DLR
2009-09-28 17:45:23 [9399] [14] DEBUG: SMPP[SMSC]: Couldnot parse DLR 
string sscanf way,fallback to old way. Please report!
2009-09-28 17:45:23 [9399] [14] ERROR: SMPP[SMSC]: got DLR but could not 
find message or was not interested in it id<> dst<999999999999>, type<2>
2009-09-28 17:45:23 [9399] [14] DEBUG: SMPP[SMSC]: Sending PDU:
2009-09-28 17:45:23 [9399] [14] DEBUG: SMPP PDU 0x821de00 dump:
2009-09-28 17:45:23 [9399] [14] DEBUG: type_name: deliver_sm_resp
2009-09-28 17:45:23 [9399] [14] DEBUG: command_id: 2147483653 = 0x80000005
2009-09-28 17:45:23 [9399] [14] DEBUG: command_status: 0 = 0x00000000
2009-09-28 17:45:23 [9399] [14] DEBUG: sequence_number: 4375112 = 0x0042c248
2009-09-28 17:45:23 [9399] [14] DEBUG: message_id: NULL
2009-09-28 17:45:23 [9399] [14] DEBUG: SMPP PDU dump ends.



Sincerely,

Michael Zervakis
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.