Skip to content

Instantly share code, notes, and snippets.

@atkawa7
Forked from grantpullen/KannelDLR.md
Created April 17, 2021 11:27
Show Gist options
  • Save atkawa7/125c02113df26337de092ab9f47f4542 to your computer and use it in GitHub Desktop.
Save atkawa7/125c02113df26337de092ab9f47f4542 to your computer and use it in GitHub Desktop.
Kannel DLR information and how it maps to SMPP return values.

SMSPP Delviery Reports and Kannel

This info page relates to the DLR values which are returned by kannel when requesting DLR. Some SMPP related information is also listed for reference.

dlr-mask

This send-sms parameter is used to request for delivery reports with the state of the sent message. This requires the dlr-url on sendsms-user group or use the dlr-url CGI variable to be set. The value is a bit mask composed of:

Value Description
1 Delivered to phone
2 Non-Delivered to Phone
4 Queued on SMSC
8 Delivered to SMSC
16 Non-Delivered to SMSC.

The values within the mask are added together to get the desired DLR result, e.g. To only receive final values register to (1+2+16) = 19

SMPP message_state mapping to Kannel

Message State Value Type Kannel Value
SCHEDULED 0 Intermediate 4
ENROUTE 1 Intermediate 4
DELIVERED 2 Final 1
EXPIRED 3 Final 2
DELETED 4 Final 2
UNDELIVERABLE 5 Final 2
ACCEPTED 6 Final 4
UNKNOWN 7 N/A 2
REJECTED 8 Final 2
SKIPPED 9 Final 2

Kannel DLR Return Values

Status Value
DLR_NOTHING 0x00
DLR_SUCCESS 0x01
DLR_FAIL 0x02
DLR_BUFFERED 0x04
DLR_SMSC_SUCCESS 0x08
DLR_SMSC_FAIL 0x10
DLR_EXPIRED 0x22
DLR_UNKNOWN 0x42
DLR_UNDEFINED -1

network_error_code

The network_error_code parameter is used to indicate the actual network error code for a delivery failure. The network error code is technology specific. Refer to SMPP V5.0 section 4.8.4.42 for detailed encoding.

Field Size Type Description
Param Tag 2 Integer 0x0423
Length 2 Integer Length of value part in octets
Value 3 Octet Str Octet 1 = Network Type
Octet 2,3 = Error Code
Network Types:
1 = ANSI 136 Access Denied Reason
2 = IS 95 Access Denied Reason
3 = GSM
4 = ANSI 136 Cause Code
5 = IS 95 Cause Code
6 = ANSI-41 Error
7 = SMPP Error
8 = Message Center Specific
All other values reserved.
Error Code:
The remaining 2 octets specify the network
error code appropriate to the network type.

delivery_failure_reason

Value Reason
0 Destination unavailable
1 Destination Address Invalid (e.g. suspended, no SMS capability, etc.)
2 Permanent network error
3 Temporary network error
4-255 Reserved

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment