Updating unavailable message in DB fails

I’m trying to use the database backend for the voicemail system in Asterisk 16.28.
The DB is MariaDB.

The problem I’m having is when I try to update the unavailable message. The voice menu says that it has been successfully updated but when I call in I find that there is no recorded greeting at all and it uses the default one which reads out the extension number.

When I look at a packet capture I can see that the insert of the new message fails due to ‘Duplicate Key’.
I’ve looked at the possible key values and can’t see any likely candidates for the dupe. I can’t see what value it’s trying to use as that part of the query is unintelligible in the capture.

Is there a way of seeing the values it’s trying to use?

Normal voicemails record and play back correctly.

The MariaDB is running as a Galera cluster but I don’t think that has any affect.

Any help would be much appreciated.

what is the the mailbox contex ?
you can run it with debug on. it might give you more insight !

Thanks benphone.

I turned on debug on the messages line in logger.conf and it has shown the query in the messages file.

Sadly it’s only showing the same info as the packet capture. I can see the insert but the values are logged as below:
…mailboxcontext,flag,msg_id) VALUES (?,?,?,?,?,?,?,?,?,?,?,?)]

In the capture I can see a couple of the values eg. the msg_id is -1

According to voicemail.conf the userscontext is just ‘Voicemail’

Thanks for this

Found and fixed the problem.
It was being caused by the msg_id field in the DB incorrectly being a primary key.

Ran these queries:
ALTER TABLE voicemail_messages DROP PRIMARY KEY;
ALTER TABLE voicemail_messages ADD CONSTRAINT voicemail_messages_dir_msgnum PRIMARY KEY (dir, msgnum);
and it all started working.
Thanks for your help.

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.