Shortcode: A short (usually 4 digits) number that is used in premium SMS
services to send messages to. Generally, the same shortcode is available
across multiple mobile operators.
Finding Message Delivery Status
We are sending out messages, but don't have a way to find out if they get delivered.
Unless we find that out, we are not really sure what happens to them. We won't even
know how much time it takes to deliver messages! Luigi can't live in a limbo like
this, so let us build a mechanism to track messages.
Time for Action: Tracking Queued Messages
1. Create a table called "messages". The fields will be id (primary key),
gwId (gateway message ID), requestDate, to (phone number), message
(the actual message), and status (enum: Q for queued, G for delivered to
upstream gateway, R for received, and F for failed).
2. Create a class "Message" extending the BaseModel. Add variables to map
to the table fields. This is simply a data holder class and will look like the
following code.
class Message extends BaseModel
{
public $_to;
public $_message;
public $_requestDate;
Chapter 6
[ 111 ]
public $_status;
public $_gwId;
public function __construct($tableName = "messages",
$data = null)
{
parent::__construct($tableName, $data);
}
}
3.
Pages:
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155