fix: ensure destination DID is in phone table before text_log insert #107
Loading…
Add table
Add a link
Reference in a new issue
No description provided.
Delete branch "fix/incoming-text-missing-destination-phone"
Deleting a branch is permanent. Although the deleted branch may continue to exist for a short time before it actually gets removed, it CANNOT be undone in most cases. Continue?
Root cause: When an incoming SMS/MMS arrives via the VoIP.ms webhook,
HandleTextMessagecallsensurePhoneInDBfor the source (customer's number from VoIP.msfromfield) but not for the destination (our DID from VoIP.mstofield). Thetext_log.destinationcolumn has a FK constrainttext_log_destination_fkey → phone(e164), so the insert fails with SQLSTATE 23503 when the DID hasn't been pre-registered.Fix: Add
ensurePhoneInDBfor the destination number before thetext_loginsert, matching the pattern already used for the source.Closes #106
Merged in a different way.
Pull request closed