I guess I can say that I have worked with kannel enough to know my way around it (I’m no expert mind you :] ). And after a lot of googling & experimenting I finally found out how to get delivery reports for all the SMSs you send via kannel. All you have to pass the dlr-mask and dlr-url as parameters in the send-sms link. Below is a code snippet that shows the final send_sms URL which I wrote in JS.
// This is an imaginary phone number
var number = "+222222222222222222"
// This is the SMS content
var text = encodeURIComponent("Hello World!")
// This is the URL that is called when the deliver report is received
var dlr_url = encodeURIComponent("http://localhost/my_app/recieve_delivery_report?status=%d")
// This is the default send_sms url defined by kannel
var send_url = "http://localhost:13001/cgi-bin/sendsms?username=tester&password=foobar"
// This is the final send_sms link
var link = send_url + "&to=" + number + "&text=" + text + "&dlr-mask=31&dlr-url=" +dlr_url
window.location = link
Why do we use encodeURIComponent() ??
We use the encodeURIComponent() method to be able to pass the msg text and url as GET parameters.
What is the dlr-mask??
The dlr-mask specifies which type of reports kannel should keep track of. Here are all the available delivery report types:
1 : delivery success 2 : delivery failure 4 : message buffered 8 : smsc submit 16 : smsc reject
The value of the dlr-mask is the addition of the delivery report numbers that you want to keep track of.
Example: 31 = 1+2+4+8+16
Note:
In Egypt (where I have been testing kannel) I have noticed that the mobile providers only return delivery reports with number 8 and 16. Which in our (el masreeyen’s) case is equivalent to 1 and 2.