Source:
<code>public void handle(OutgoingSms sms, String response, Header[] headers) { if (!getTemplateOutgoingResponse().hasSuccessResponse() || getTemplateOutgoingResponse().checkSuccessResponse(response)) { String providerMessageId = extractProviderMessageId(headers, response); getLogger().info(String.format("Sent messageId %s '%s' to %s", providerMessageId, messageForLog(sms), sms.getRecipients().toString())); for (String recipient : sms.getRecipients()) { getAuditRecords().add(new SmsRecord(getConfig().getName(), OUTBOUND, recipient, sms.getMessage(), now(), <START> DISPATCHED, null, sms.getMotechId(), providerMessageId, null)); <END> } getEvents().add(outboundEvent(DISPATCHED, getConfig().getName(), sms.getRecipients(), sms.getMessage(), sms.getMotechId(), providerMessageId, null, null, null, sms.getCustomParams())); } else { Integer failureCount = sms.getFailureCount() + 1; String failureMessage = getTemplateOutgoingResponse().extractSingleFailureMessage(response); if (failureMessage == null) { failureMessage = response; } getEvents().add(outboundEvent(getConfig().retryOrAbortSubject(failureCount), getConfig().getName(), sms.getRecipients(), sms.getMessage(), sms.getMotechId(), null, failureCount, null, null, sms.getCustomParams())); getLogger().debug("Failed to send SMS: {}", failureMessage); for (String recipient : sms.getRecipients()) { getAuditRecords().add(new SmsRecord(getConfig().getName(), OUTBOUND, recipient, sms.getMessage(), now(), getConfig().retryOrAbortStatus(failureCount), null, sms.getMotechId(), null, failureMessage)); } } }</code><technical_language>placing status provider here</technical_language>

Target:
public void handle(OutgoingSms sms, String response, Header[] headers) { if (!getTemplateOutgoingResponse().hasSuccessResponse() || getTemplateOutgoingResponse().checkSuccessResponse(response)) { String providerMessageId = extractProviderMessageId(headers, response); getLogger().info(String.format("Sent messageId %s '%s' to %s", providerMessageId, messageForLog(sms), sms.getRecipients().toString())); for (String recipient : sms.getRecipients()) { getAuditRecords().add(new SmsRecord(getConfig().getName(), OUTBOUND, recipient, sms.getMessage(), now(), DeliveryStatuses.DISPATCHED, null, sms.getMotechId(), providerMessageId, null)); } getEvents().add(outboundEvent(SmsEventSubjects.DISPATCHED, getConfig().getName(), sms.getRecipients(), sms.getMessage(), sms.getMotechId(), providerMessageId, null, null, null, sms.getCustomParams())); } else { Integer failureCount = sms.getFailureCount() + 1; String failureMessage = getTemplateOutgoingResponse().extractSingleFailureMessage(response); if (failureMessage == null) { failureMessage = response; } getEvents().add(outboundEvent(getConfig().retryOrAbortSubject(failureCount), getConfig().getName(), sms.getRecipients(), sms.getMessage(), sms.getMotechId(), null, failureCount, null, null, sms.getCustomParams())); getLogger().debug("Failed to send SMS: {}", failureMessage); for (String recipient : sms.getRecipients()) { getAuditRecords().add(new SmsRecord(getConfig().getName(), OUTBOUND, recipient, sms.getMessage(), now(), getConfig().retryOrAbortStatus(failureCount), null, sms.getMotechId(), null, failureMessage)); } } }