Asterisk uses its built-in ODBC voicemail storage against
kamailio.voicemail_spool, which expects msgnum to be contiguous
0..N-1 within each (mailboxuser, dir) folder. Asterisk maintains
that invariant itself, but the panel rewrote dir (or deleted a
row) without ever touching msgnum, leaving gaps and duplicates
that make asterisk mis-play and mis-count the messages.
Add two helpers to Utils::Subscriber reproducing the asterisk
semantics:
* renumber_voicemail_folder() compacts a single folder to 0..N-1
ordered by (msgnum, id). It skips greetings, which live in the
same table with msgnum -1.
* move_voicemail_to_folder() appends the message at the end of
the target folder the way asterisk does (last_msg_index + 1),
then compacts both the source and the target folder.
Both run inside a transaction, so the web UI paths that have no
transaction guard of their own are covered as well.
Use them in all four affected paths:
* PATCH/PUT /api/voicemails/{id} (Role::API::Voicemails)
* DELETE /api/voicemails/{id} (Controller::API::VoicemailsItem)
* mark_voicemail_read() for the CSC/admin listen action
* delete_voicemail() in the subscriber web UI
The compaction is deliberately self-healing, so it also repairs
folders already corrupted by the previous behaviour.
Change-Id: I665de1966bc37c1069ff56fb30c99da85f224f71
master
parent
22623e7c2f
commit
d01cff87ba
Loading…
Reference in new issue