Hope this helps in resolving your problem

= 1 =
Check where kannel saves log file under the SMSBOX group
---
<conf file>
group = smsbox
log-level = 0
...
log-file = "/var/log/kannel/smsbox.log"
...
---

See if the dlr is set, in this example it is sent via XML
---
...
2008-08-07 14:38:53 [12689] [3] DEBUG: XMLParsing: tag <statusrequest> value <<dlr-mask>31</dlr-mask><dlr-url>http://domain.tld/dlr/status/id/26/status/%d/response/%A/smsc/%i/from/%Q/to/%q/</dlr-url>>
...
---

You can also see in the log file if the SMSC did return a value back, this snipped of the log file the SMSC returned a failed reponse
---
...
2008-08-07 14:38:53 [12689] [4] INFO: Starting delivery report <smscname> from <0000000000> 2008-08-07 14:38:53 [12689] [9] DEBUG: Parsing URL `http://domain.tld/dlr/status/id/26/status/16/response/NACK%2F72%2FInvalid+Source+address+TON/smsc/MTN_SMPP_3.conf/from/0000000000/to/%2B0000000000/':
...
---
Should you get these values you are one step closer, you are sending and receiving the DLR's


= 2 =
Now, you know your DLR are working, next step where it terminates:
- Webserver -
Make sure the webserver understands your request, this example here the web server uses 'rewrite rules', so this server does not understand the ?key=value& schema
Rewite Example:
http://domain.tld/dlr/status/id/26/status/%d/response/%A/smsc/%i/from/%Q/to/%q/
'Basic' Example of rewrite rule equivalent:
http://domain.tld/dlr/status.php?id=26&status=%d&response=%A&smsc=%i&from=%Q&to=%q

The chance that a webserver has a rewrite rule is very slim but still a possibility

- Syntax -
Make sure the forming of the URL is correct or you will get errors
http//domain.tld/dlr/status.php?id=123

The above url will NEVER work... there is no ':', something small like that can be the cause of huge headaches

= 3 =
examples used:
dlr url: http://domain.tld/dlr/status.php?id=123&mask=16
php file: status.php
log file: log.txt

- PHP -
simple php file that should help
<?php
// status.php - to receive and log - php5
// sets php to display errors
ini_set('display_errors', 'On');
ini_set('error_reporting ', E_ALL);

// set webserver to return plain text
header('Content-Type: text/plain');

// variables from the $_GET
// just a variable
$id = $_GET['id'];
// the dlr mask status
$status = $_GET['mask'];

// the log file
$logfile = '/path/to/log.txt';

// see if you can write to the log file
if (!is_writable($logfile)){
echo 'The log file permissions are not correct, cannot write to it, with root access you can try: chown www:www ' . $logfile . ' or chmod a+w ' . $logfile;
 exit();
}

// see if values are not empty
if (!empty($id) && !empty($status)){
   echo "either id or status does not have a value";
   exit();
}

// creates log line with date, values and adds line break at end
$logfileLine = '[' . date('Y-m-d H:i:s') . '] ID = ' . $id . ' Status = ' . $status . "\n";
// writes log line to log file and appends to log file every time
if (!file_put_conents($logfile, $logfileLine, FILE_APPEND)){
   echo 'if you get this error message something very wierd is going on';
   exit();
}

echo 'all done :)';
?>

ps: I have not tested the php script show it might be buggy

- Basic Test -
now, open your web browser and enter the url as you would like to receive the dlr

http://domain.tld/dlr/status.php?id=123&mask=16

The return values you get from the browser will give you a good indication of the possible error (if any) on the php side



Wynand



Reply via email to