Source:
<code>private void analyzeStatus(Status status, String configName, Map<String, String> params) { String statusString = params.get(status.getStatusKey()); String providerMessageId = params.get(status.getMessageIdKey()); SmsRecord smsRecord = findOrCreateSmsRecord(configName, providerMessageId, statusString); List<String> recipients = Collections.singletonList(smsRecord.getPhoneNumber()); if (statusString != null) { String eventSubject; if (statusString.matches(status.getStatusSuccess())) { smsRecord.setDeliveryStatus(statusString); eventSubject = SmsEventSubjects.DELIVERY_CONFIRMED; } else if (status.hasStatusFailure() && statusString.matches(status.getStatusFailure())) { smsRecord.setDeliveryStatus(statusString); eventSubject = SmsEventSubjects.FAILURE_CONFIRMED; } else { <START> smsRecord.setDeliveryStatus(DeliveryStatuses.DISPATCHED); <END> eventSubject = SmsEventSubjects.DISPATCHED; } eventRelay.sendEventMessage(outboundEvent(eventSubject, configName, recipients, smsRecord.getMessageContent(), smsRecord.getMotechId(), providerMessageId, null, statusString, now(), null)); } else { String msg = String.format("Likely template error, unable to extract status string. Config: %s, Parameters: %s", configName, params); LOGGER.error(msg); statusMessageService.warn(msg, SMS_MODULE); smsRecord.setDeliveryStatus(DeliveryStatuses.FAILURE_CONFIRMED); eventRelay.sendEventMessage(outboundEvent(SmsEventSubjects.FAILURE_CONFIRMED, configName, recipients, smsRecord.getMessageContent(), smsRecord.getMotechId(), providerMessageId, null, null, now(), null)); } smsRecordsDataService.create(smsRecord); }</code><technical_language>real status</technical_language>

Target:
private void analyzeStatus(Status status, String configName, Map<String, String> params) { String statusString = params.get(status.getStatusKey()); String providerMessageId = params.get(status.getMessageIdKey()); SmsRecord smsRecord = findOrCreateSmsRecord(configName, providerMessageId, statusString); List<String> recipients = Collections.singletonList(smsRecord.getPhoneNumber()); if (statusString != null) { String eventSubject; if (statusString.matches(status.getStatusSuccess())) { smsRecord.setDeliveryStatus(statusString); eventSubject = SmsEventSubjects.DELIVERY_CONFIRMED; } else if (status.hasStatusFailure() && statusString.matches(status.getStatusFailure())) { smsRecord.setDeliveryStatus(statusString); eventSubject = SmsEventSubjects.FAILURE_CONFIRMED; } else { smsRecord.setDeliveryStatus(statusString); eventSubject = SmsEventSubjects.DISPATCHED; } eventRelay.sendEventMessage(outboundEvent(eventSubject, configName, recipients, smsRecord.getMessageContent(), smsRecord.getMotechId(), providerMessageId, null, statusString, now(), null)); } else { String msg = String.format("Likely template error, unable to extract status string. Config: %s, Parameters: %s", configName, params); LOGGER.error(msg); statusMessageService.warn(msg, SMS_MODULE); smsRecord.setDeliveryStatus(DeliveryStatuses.FAILURE_CONFIRMED); eventRelay.sendEventMessage(outboundEvent(SmsEventSubjects.FAILURE_CONFIRMED, configName, recipients, smsRecord.getMessageContent(), smsRecord.getMotechId(), providerMessageId, null, null, now(), null)); } smsRecordsDataService.create(smsRecord); }