Cancel_sm with Ozeki NG SMS Gateway
This guide provides you detailed information on how to cancel an SMS text message after it has been sent to the SMS centre (SMSC) but it has not been received by the recipient. This functionality can be achieved by cancel_sm service that is first available in 3.15.8 version of Ozeki NG SMS Gateway. Follow the guide below to adopt this service successfully.
If you send out an SMS message from your database with the help of Database user of Ozeki NG SMS Gateway, you need to insert a record into the database. The database user checks the database, and it sends out the SMS text message to the SMS centre (SMSC). From the SMSC you will receive a report about the fact that the message arrives at the SMSC. This report contains the callback ID of the message. When the report is received the Database user updates the message status to Sent and insert the callback ID into Reference column of the database. This is the usual process of sending SMS from a database (Figure 1).
But if the user did not receive the message after some time for any reason (for example the handset is off), then it is possible to cancel the message from the SMSC with the help of cancel_sm service. It can be the proper solution if the message has been expired after a definite time.
To cancel the message from the SMSC, insert a record into the database:
- Message type: SMS:CANCEL
- Recipient: the original recipient of the message
- Message: the received callback ID
So, if you insert the record above into the database, the Database user will pull out it and send a cancel indication to the SMSC and the SMSC will return a confirmation if the message has been cancelled (Figure 2).
Configuration guide
First start Ozeki NG SMS Gateway and go to Database user configuration pane. In SQL Settings menu select SQL for sending tab. Click on Sent tab and type reference='$callbackid' after "status='sent'," (Figure 3).
In our example I send out a test message to demonstrate the solution (Figure 4).
- Recipient: +06205460691
- Message: Hello World!
- Status: send
On Figure 5 you can see that the message is accepted for delivery and the callback ID is also defined in this report.
With SELECT * FROM ozekimessageout; statement you can query the messages from ozekimessageout table. After clicking on Execute you can see the message data that contain the callback ID among others (Figure 6).
Now I insert a record to be sent out into the database where;
- Recipient: is the same as in the original message (+06205460691)
- Message type: SMS:CANCEL
- status: send (Figure 7).
In SMPP service provider the following PDUs will be seen: the first row is the cancel indication for cancelling the message. The second row is the confirmation about the fact that the message has been cancelled (Figure 8).
More information