SMS Delivery Tracking
Delivery status polling tracks whether sent messages actually reached the recipient's handset.
How It Works
- The status renderers emit a Datastar polling span for every delivery that is not final (
SmsStatus::isFinal(), so 'sent' too), while its provider is the configured one and it is under 24h (STATUS_POLL_WINDOW_SECS) past its send time (scheduled_send_at, elsesms.created) - Each span GETs
?call=sms_info&id=Non a backoff interval (smsDeliveryPollIntervalSecs()), and once on render when past its send time - On Persons → Messages (
&batch=1) only the lowest-ID non-final delivery of each send asks the provider and morphs its siblings; a delivery already final in the DB renders its stored status
Call_SMS_Info
The server-side handler:
- Loads the
smsdeliveryrow by ID; a row already final in the DB renders its stored status without a provider call - Checks the current provider matches the delivery's provider (skips if providers differ)
- Asks the provider for its recent deliveries (
listRecentDeliveries()over the polling window, persisted byDbLoggingSmsProvider) and resolves the polled delivery and its siblings from that - Providers without
BATCH_DELIVERY_QUERYfall back toupdateDelivery()per delivery, throughDbLoggingSmsProvider(which skips the upstream call for a final DB status and writes the result back tosmsdelivery) - Returns HTML — ✓✓ (delivered), ✓ (sent, still polling), or a status label (with an optional cancel link for scheduled messages)
Provider Support
| Provider | Status Polling |
|---|---|
| FiveCentSms v5 | ✓ (GET /v5/sms/{id}) |
| MobileMessage | ✓ (GET /v1/messages?message_id={uuid}) |
| Cellcast | ✓ (GET /api/v2/report/message/{id}) |
| FiveCentSms v4 | ✗ |
| Template | ✗ |
Caching
DbLoggingSmsProvider caches the upstream response in smsdelivery.raw_response and smsdelivery.status. When a final status is found in the database, subsequent polls skip the API call entirely.
Final Statuses
Once a delivery reaches a final status (per SmsStatus::isFinal() —
jethro-sms/src/SmsStatus.php), polling stops and subsequent polls
skip the API call entirely:
DELIVERED— confirmed on handsetFAILED— permanent delivery failureCANCELLED— scheduled send was cancelledTEST_MESSAGE— test mode (terminal)
Non-final statuses (QUEUED, SENT, SCHEDULED, SENDING,
DELIVERY_IN_PROGRESS, UNKNOWN) continue to poll — the delivery may
still transition.
Cancel Link
For scheduled messages (SCHEDULED), the info response includes a Cancel link. This only appears when:
- The user has
PERM_SENDSMS - The delivery status is
SCHEDULED - The provider has
DEFERRED_SEND_CANCELcapability
Clicking Cancel fires POST ?call=sms_cancel&sms_id=<sms_id> — the cancel span carries data-sms-id and data-scheduled-count attributes. The JS handler shows a confirm dialog (count from data-scheduled-count) then posts to Call_SMS_Cancel.
Cancel Flow
Call_SMS_Cancel accepts only sms_id (POST). It calls loadSmsBatch($smsId) to hydrate the batch from DB (no inline SQL in the handler), checks ownership via $batch->senderPersonId, filters to SCHEDULED deliveries, and calls cancelSms(batch) which delegates to SmsProvider::cancel(SmsDeliveryBatch).
Providers loop over deliveries internally; per-delivery gateway failures leave that delivery unchanged. The response counts CANCELLED vs unchanged deliveries.
Page Limit
To prevent excessive API calls, only the first 20 non-final deliveries on a page are polled.