Linking incoming DLRs with batch send

246 views
Skip to first unread message

Zemen Admin

unread,
Feb 6, 2018, 1:37:30 AM2/6/18
to Jasmin SMS Gateway
I don't know if there an obvious answer to this but I am not seeing it.

How does one link returning DLRs with specific phone numbers in a batch send out?  For instance, if I send the following batch SMS

curl -X POST -H 'Authorization: Basic Z2Fkbeydh4Rlc3Q=' -d '{
"globals" : {
   "from": "Brand2",
   "dlr-level": 2,
   "dlr": "yes",
 },
 "messages": [
   {
     "to": [
       "33333331",
       "33333332",
       "33333333"
     ],
     "content": "Same content goes to 3 numbers"
   }
 ]

I get a HTTP Status 200 with the following immediately

{"data": {"batchId": "9b446aac-38b1-4e56-b69b-b816096b38f2", "messageCount": 3}}

And then, I will be receiving 3 DLRs with the following parameters ...

DLR#1
-----
Request parameter [id,7e7bbcd9-f886-4080-a06f-ac83184fef3a]
Request parameter [id_smsc,SMSC2018]
Request parameter [message_status,DELIVRD]
Request parameter [donedate,1802052034]
Request parameter [sub,ND]
Request parameter [err,ND]
Request parameter [level,2]
Request parameter [text,Same content goes to]
Request parameter [dlvrd,ND]
Request parameter [subdate,1802052034]

DLR#2
-----
Request parameter [id,718f93c4-2b8a-431b-83d1-fe16ea30c32f]
Request parameter [id_smsc,SMSC2019]
Request parameter [message_status,DELIVRD]
Request parameter [donedate,1802052034]
Request parameter [sub,ND]
Request parameter [err,ND]
Request parameter [level,2]
Request parameter [text,Same content goes to]
Request parameter [dlvrd,ND]
Request parameter [subdate,1802052034]

DLR#3
-----
Request parameter [id,380105f9-ea57-4720-8224-b0d126735fa5]
Request parameter [id_smsc,SMSC2020]
Request parameter [message_status,DELIVRD]
Request parameter [donedate,1802052034]
Request parameter [sub,ND]
Request parameter [err,ND]
Request parameter [level,2]
Request parameter [text,Same content goes to]
Request parameter [dlvrd,ND]
Request parameter [subdate,1802052034]

As you can see, the problem is that the id parameters are all different from each other and from the batchId returned with the HTTP Status 200.  Not only that, the main problem is that, even if the ids were identical to each other and the batchId, there is no way to link a DLR to a specific phone number. So, I can't tell if a message was actually delivered to a phone or not. Am I missing something?

This is different from the callback URLs.  For each callback, there has enough information to tie the callback to a specific batch and a specific phone number. How do we accomplish the same with DLRs?

Thank you for the help.





Bruno C

unread,
Feb 6, 2018, 5:14:38 PM2/6/18
to Jasmin SMS Gateway
Definitely missing a big thing :)

The "globals" is a shorthand to put common parameters in one place and avoid writing them for each message, this will let you use smaller json footprint, and in other terms, what you pass one-time in "globals" will be passed in each-iteration to Jasmin.

From the docs, you have a "batch_config" block where you put "callback_url" and "errback_url":

The callback_url will be called (GET) everytime a message is successfuly sent, otherwise the errback_url is called.

In both callbacks the following parameters are passed:


more here: http://docs.jasminsms.com/en/latest/apis/rest/index.html#id3

Amelye Chatila

unread,
Feb 7, 2018, 12:42:12 AM2/7/18
to Jasmin SMS Gateway
Before final DLR there are intermediate DLRs ( Submit_Sm_Resp ) that can help you to link the delivery report to the specific number.

Example here with same batch ID:

2018-01-23 18:06:13 - 51.254.39.241 GET  - Array
(
    [batchId] => 31697e79-d8ac-4e96-b525-9cfcde84edb9
    [to] => 55555552
    [status] => 1
    [statusText] => Success "64e49a0b-8aa7-40ef-a698-9aedb7150767"
)

2018-01-23 18:06:13 - 51.254.39.241 GET  - Array
(
    [batchId] => 31697e79-d8ac-4e96-b525-9cfcde84edb9
    [to] => 55555551
    [status] => 1
    [statusText] => Success "846da4e2-fdb4-46e9-8687-be070ae20bb5"
)

Later you will receive final DLRs with 'id' matching an id on 'statusText'

Zemen Admin

unread,
Feb 7, 2018, 1:45:03 AM2/7/18
to Jasmin SMS Gateway
Hi Bruno,

Thank you for your response and explanation. Thank you also for the great work and taking your time to help people with so many questions.

I am already successfully processing callbacks and matching them up with the batch ID. Just one more question on this - this is perhaps caused by a misunderstanding on my part. Here are my assumptions:
  1. Callbacks will only tell me that Jasmin has submitted the SMS to the SMSC successfully or not.
  2. DLRs will tell me if the SMS was actually delivered to the recipient (as reported by the SMSC).
  3. Therefore, I assume that I need to track both callbacks and DLRs.
Based on the above assumptions, and based on your answer, I solved my problem with something like as follows.

curl -X POST -H 'Authorization: Basic Z2FkbWluOnRlc3Q=' -d '{
"globals" : {
   "from": “Brand2”,
    "dlr-level": 2,
    "dlr": "yes"
 },
 "messages": [
   {
     "to": ["33333331"],
     "content": "Please join first party",
     "dlr-url": "http://192.168.2.49:8080/dlr/put/33333331"
   }, 
   {
     "to": ["44444442"],
     "content": "Please join second party",
     "dlr-url": "http://192.168.2.49:8080/dlr/put/44444442"
   }
 ]

Are my assumption correct? And is my solution the most efficient?

Thank you again Bruno.

Yonatan,

Zemen Admin

unread,
Feb 7, 2018, 2:13:05 AM2/7/18
to Jasmin SMS Gateway
HI Amelye,

Thank you for the help. Please see my response to Bruno. The solution I posted back to Bruno is something I figured out and I am not sure if that is the standard/recommended way of doing it.

But you are absolutely right, and I just verified your point that the ID field in the DLR matches the success field in the callbacks. So, I am inclined to go with your solution.

Thank you again, Amelye. 

Yonatan,
Reply all
Reply to author
Forward
0 new messages