[solved] Smpp status table

Hello,

What is the table name that Playsms using?? My SMPP providing the status as text DRLVRD ATS EXPIRD etc… but I didn’t found in the 2 tables tblDLR and tblSMSOutgoing the status field as text, both are integer, so where the SMPP Status was saved?

Regards

Those data are not recorded, playSMS convert them to 4 kind of statuses: pending (0), sent (1), failed (2), delivered (3)

anton

1 Like

playSMS is converting them fine, but which table are stored?

Also I noticed that the Message ID from the SMPP is not there, so there is no reference ID between our records and the SMPP Gateway Portal

Correct me if I’m wrong.

Regards

In tblDlr. Yes, playSMS does not save remote message ID.

anton

do you have any idea about the remote ID? How do I save it or at least will do it as external PHP file, but how do I get it in order to explode it into our DB

if you use Kannel, I don’t see how playSMS can get message ID info, looks like Kannel don’t have parameter/variable to reflect message ID value of a message or DLR

http://kannel.org/download/1.4.1/userguide-1.4.1/userguide.html look for escape code.

anton

In the userquide there is nothing to and it’s not clear, note that I extracted the message id from below

$response = “id:347346968 sub:001 dlvrd:001 submit date:1512132038 done date:1512132038 stat:DELIVRD err:000 text:1874771661”;

but I’m receiving it via DLR but how to save the remove ID and store it in order to locate it and update the record when he DLR procesed

Regards

how do you get it ? technically

anton

The kannel is requesting to add dlr-url and dlr-mask as you know, added the following url with params to my code

dlr.php?id=%F&to=%p&q=%Q&status=%d&tt=%T&smsc=%i&response=%a

and in the dlr php file as I didn the following

$response = trim(urldecode($_GET[“response”]));

$parts_array = @explode(" ", $response);

for ($i=0;$i<count($parts_array);$i++) {
// echo $parts_array[$i]."
";

$response_slice = $parts_array[$i];

if (substr($response_slice, 0, 3) == "id:") {
    $response_part = explode(":", $response_slice);

    $rspns_id = $response_part[1];
}

if (substr($response_slice, 0, 5) == "stat:") {
    $response_part = explode(":", $response_slice);

    $rspns_status = $response_part[1];
}

}

now when I echo the id and status you will prove that they extracted successfully.

Regards

hmm so thats %a, I thought it contains only the message

ok then, if you get the message id from %a then you can save it in your own db table along with smslog_id

anton

1 Like

Anton, the DLR replication can be done with 2 stages.

  1. when we sent the SMS to the SMPP WE should save the remote ID into our DB to locate is fast.

  2. when we receive the DLR from the SMPP we should extract the ID as mentioned before in order to update the table and set the status where id = xxxx which is extracted from the DLR request.

so that is why we should save first the ID.

how do you get “remote ID” when you send the message ?

anton

1 Like

This is The question now, how to get it , I still didn’t get it yet, I solved the 2 stage but still the first one looking for it.

Any idea?

ok.

A: now playSMS save the smslog_id locally and also save it on dlr-url, meaning that Kannel will map smslog_id with its own ID (the remote ID we’re taking about)

B: and then when Kannel send the DLR to us, you can get the smslog_id and also the remote ID (from extracted %a)

so, you can do this:

  1. During A, save just smslog_id on a table (for example on: playsms_gatewayKannel_logs)
  2. During B, look for smslog_id on the table and save the remote ID to the same row

in the end you get remote message ID and local smslog_id mapped on playSMS

anton

Anton, the smslog_id means internal ID or the remote?

The problem is I’m checking the table, it’s always giving field url is empty, in other word there is no relation between the smslog_id and the remote ID.

We need to catch the ID on submission in order to be easy for us to replicate the status base on the ID

Regards

Hi,

The term smslog_id is internal playSMS message id
And the term remote ID is Kannel’s message ID

  1. When sending SMS playSMS cannot get remote ID because Kannel does not have facility to pass that ID to playSMS

  2. So, playSMS need to be creative, it will include smslog_id and response=%a on its dlr-url when sending SMS, just like you did

  3. playSMS also save the value of smslog_id when sending SMS on a DB table, for example in playsms_gatewayKannel_log (this table does not exists, so you must create it)

  4. Once SMS submitted to Kannel, Kannel will push a DLR to playSMS

  5. On dlr.php, you do extraction of remote ID from $response (which is on dlr-url), just like you did. remember that on this stage there will be 2 ID’s, smslog_id and remote ID (both will be pushed by Kannel)

  6. Also on dlr.php, once you get both ID’s from Kannel, you update the row on DB table that was saved on point 3 above

I hope this explains how playSMS can map smslog_id and remote ID.

anton

Perfect…

Is there any changes I must apply in order to take effect to the playsms_gatewayKannel_log??

What is the structure of playsms_gatewayKannel_log in order to create it?

In Which table your are saving the smslog_id , response=%a

Regards

hi,

I was explaining how you can map id’s, its up to you how you code it.

anton

Oh Okay, I thought you did an update and there is new table structure lablablablablabalabla

Anyway, I will check from my side, and if you have good news plz share it with me

Regards

Hello,

The external DLR file is work now perfectly, but I noticed that the table playsms_tblDLR does not include the timestamp when insert into.

Check below:

https://github.com/antonraharja/playSMS/blob/master/web/lib/fn_dlr.php#L25

we should add the timestamp as below:

from

$ret = dba_add(DB_PREF . ‘_tblDLR’, array(
‘flag_processed’ => 2,
‘smslog_id’ => $smslog_id,
‘p_status’ => $p_status,
‘uid’ => $uid
));

to

$ret = dba_add(DB_PREF . ‘_tblDLR’, array(
‘c_timestamp’ => time(),
‘flag_processed’ => 2,
‘smslog_id’ => $smslog_id,
‘p_status’ => $p_status,
‘uid’ => $uid
));