CrisisCleanup/crisiscleanup-4-web

Permit Apparent Phone Status Save on Error

Opened this issue · 0 comments

Occasionally the system will send an outbound call to someone, but it doesn't work. It looks like a possible race condition on our end. No phone call is delivered. We need to handle for these errors.
On load, check to make sure that a dnis_id exists. If none exists,

  1. Display a green toasted error "~~It looks like that phone call was probably sent to somewhere else. Go ahead and try again."
  2. Automatically try to save the status as described below.

If saving the status returns a "not found" error, (ie. no dnis_id), handle the error this way:

  1. Try to recover the dnis from the browser. The phone number it is definitely displayed.
  2. Look up the dnis_id.
  3. Save a status with that dnis_id, and choose the status, phoneStatus.no-answer_technical-difficulty, and substatus, phoneSubstatus.technical-difficulty. Add the note, "No outbound dnis_id." That way we can track how often this happens.
  4. If you can't retrieve the dnis_id, then just close the modal as though it was saved, even though nothing was saved. Currently it errors out and won't go away without a refresh.

See:

SELECT pi.id, pi.dnis_id, pd.dnis, pi.ani_id, pa.ani, pi.action, pi.session_id, pi.incident_id, pi.language_id, pi.call_at AT TIME ZONE 'America/Denver', pi.created_at AT TIME ZONE 'America/Denver'
FROM phone_inbound AS pi
LEFT JOIN phone_dnis AS pd
ON pi.dnis_id = pd.id
LEFT JOIN phone_anis AS pa
ON pi.ani_id = pa.ani
WHERE dnis_id = 428655
ORDER BY pi.created_at DESC;

SELECT *
FROM phone_outbound AS po
WHERE po.dnis1_id = 428655
OR po.dnis2_id = 428655;