Hello,
you should put dlr-mask=31 then you will be able to get all the DLR.
Dlr-url should be accessible, usually on the same machine, and then a script
(php or other) is the solution to make the dlr process.
an example extract from my php script (not perfect but could be a good start) :
$username = $_GET['username'];
$password = $_GET['password'];
$dlrmask = $_GET['dlr-mask'];
$from = $_GET['from'];
$to = $_GET['to'];
$text = $_GET['text'];
$udh = $_GET['udh'];
$dlrurl = $_GET['dlr-url'];
$dlrtype = $_GET['dlr-type'];
$myid = $_GET['myid'];
$finalcallback = $_GET['finalcallback'];
$retry = $_GET['retry'];
$smscorig = $_GET['smscorig'];
$priority = $_GET['priority'];
if ($dlrtype && $myid )
{
$stat = 0;
switch ($dlrtype)
{
case 1: $stat = 6; break; // delivered to phone
case 2: $stat = 6; break; // non delivered to phone
case 4: $stat = 3; break; // queued on SMSC
case 8: $stat = 4; break; // delivered to SMSC
case 16: $stat = 5; break; // non delivered to SMSC
case 9: $stat = 4; break;
case 12: $stat = 4; break;
//case 18: $stat = 5; break; // not sure to have the case
}
if (($stat==5)||($retry>=$MAXRETRY)) // If SMS Failed and we retry MAXRETRY
times
{
if (!$retry)
{
$retry=0;
}
if ($retry<$MAXRETRY)
{ $retry=$retry+1 ;
}
else
{
// in other case, we sent the DLR status to the final server
//echo "SMS OK";
header("Location: " . $finalcallback . "?dlr-type=" . $dlrtype ."&myid="
. $myid . "&retry=" . $retry . "&smscorig=" . $smscorig);
die();
}
// Case of SMS FAILED, we retry
//echo "SMS Failed";
header("Location: ". $mysendsms . "?username=" . $username .
"&password=" . $password .
"&retry=" . $retry .
"&dlr-mask=31" .
"&from=" . $from .
"&to=" . $to .
"&text=" . urlencode($text) .
"&udh=" . $udh .
"&priority=" . $priority .
"&dlr-url=" . urlencode($myproxy . $allvar .
"&dlr-type=%d&smscorig=%i&myid=" . $myid . "&retry=" . $retry) );
}
else
{
// in other case, the SMS state is sent to the main server
//echo "SMS OK";
if ($stat==4)
{
// include "credit_eat.php"; // script to add billing feature
}
header("Location: " . $finalcallback . "?dlr-type=" . $dlrtype ."&myid="
. $myid . "&retry=" . $retry);
}
}
De : users [mailto:[email protected]] De la part de pape fall
Envoyé : mercredi 24 juillet 2019 12:42
À : [email protected]
Objet : Kannel DLR with MySQL
Hello,
I use kannel for sending sms. Now I want to get the dlr. After configuration,
sent sms are inserted into mysql dlr table. The status of the sms are still 0.
I add dlr-mask=7 to the request parameters for sending sms. After
investigation, I understood that I have to put the dlr-url for updating the
status of the sms.
Could someone help me to define the dlr-url and make the php file?
Could I retrieve the sent sms status thanks to an ID for updating another
database?(the ID must be known when the sms are sent)
In attached my kannel.conf
Regards,
Fall,