title: Implementing delivery report in Kannel
body: <p>I've configured Kannel in Ubuntu Server 14.04.3 LTS. I am able to push the messages for now but I am yet to figure out how to implement the delivery report. For this I've the following kannel configuration where I've defined storage type and mysql-connection group and connection properties to mysql.</p>
  
  <pre><code>include = "/etc/kannel/modems.conf"
  
  group = core
  admin-port = 13000
  smsbox-port = 13001
  admin-password = 12345
  admin-deny-ip = “*.*.*.*”
  admin-allow-ip = “127.0.0.1″
  box-deny-ip = “*.*.*.*”
  box-allow-ip = “127.0.0.1″
  log-file = /var/log/kannel/bearerbox.log
  log-level = 0
  dlr-storage = mysql
  
  group = smsc
  smsc = at
  smsc-id = GSM
  my-number = xxxxxxxxxxxx
  modemtype = auto
  device = /dev/ttyUSB0
  
  group = smsbox
  bearerbox-host = 127.0.0.1
  sendsms-port = 13013
  global-sender =13013
  log-file = /var/log/kannel/smsbox.log
  log-level = 0
  
  group = smsbox-route
  smsbox-id = smsbox
  smsc-id = GSM
  
  group = sendsms-user
  username = user
  password = user
  concatenation= true
  max-messages = 10
  user-deny-ip = “*.*.*.*”
  user-allow-ip = “127.0.0.1;”
  dlr-url = "http://127.0.0.1/dlr.php"
  
  group = sms-service
  keyword = default
  catch-all = yes
  accepted-smsc = usb1-modem
  max-messages = 0
  get-url = http://localhost/sms?phone=%p&amp;text=%a
  
  group = mysql-connection
  id = mydlr
  host = localhost
  port = 3306
  username = root
  password = 00000
  database = dlr
  max-connections = 1
  
  group = dlr-db
  id = mydlr
  table = dlr
  field-smsc = smsc
  field-timestamp = ts
  field-destination = destination
  field-source = source
  field-service = service
  field-url = url
  field-mask = mask
  field-status = status
  field-boxc-id = boxc
  </code></pre>
  
  <p>Now my question is:</p>
  
  <ol>
  <li>How to write to the database table dlr? Is it done by kannel or we've to do it through a script?</li>
  </ol>
  
  <p>I tried passing the dlr-mask and dlr-url in the sendsms url but nothing happens.</p>
  
  <pre><code>http://127.0.0.1:13013/cgi-bin/sendsms?username=user&amp;password=user&amp;to=xxxxxxxx&amp;text=hello&amp;dlr-mask=31&amp;dlr-url=http%3A%2F%2F127.0.0.1%2Fdlr.php%3FmyId%3D123456%26type%3D%25d
  </code></pre>
  
  <p>Above all, I don't understand how the "<strong>id</strong>" of the message is handled. As per my understanding I feel that kannel should insert every send information to the database and then the status of the message should be returned according to the id in the database. But in the table there is no such field as <em>id</em>.</p>
  
  <p>I am stuck for couple of days with this issue as the Userguide do not have exhaustive directions nor the kannel forums have any good threads on this. Kindly, enlighten me with detailed procedure to implement the delivery report.</p>