Error when entering new Sip Trunk :(

I’m trying to enter a SIP trunk but every time i add i get this following error shown below.
I think i need to delete a line in the database or something via the cli but I’m don’t know what the steps would be.

SQLSTATE[23000]: Integrity constraint violation: 1062 Duplicate entry ‘tr-peer-1-account’ for key 'PRIMARY’

INSERT INTO sip (id, keyword, data, flags) values (‘tr-peer-1’,?,?,‘0’)::


This is an old bug, is your system fully up to date?

yep…latest download

Did anyone ever resolve this. Just upgraded to FreePBX and getting this error every time I try to add a trunk. I’m new to Freepbx, so any help with SSH script step by step would be much appreciated.

Can you please post screenshots of your trunk config?

(of course, censor the user/pass/address)

I deleted all my trunks thinking it would resolve the issue. Unfortunately, I tried to add a temp trunk and this is what I get.

Sounds like it’s time to get medieval with the database.

You can connect to the database directly and delete that tuple. That should clear this error. Something has caused a problem in the database, though, and finding that would be a good exercise.

You lost me at medieval database. I tried to find a step by step on how to access the sql database to clear the exising trunks, but I’m a complete amature. I’m completely lost. I know it’s a stretch to ask the community for help, but any would be appreciated.

From bash

mysql asterisk -e ‘select * from trunks’

after entering mysql, it brings me to.

MariaDB [asterisk]> I typed your command “mysql asterisk -e ‘select * from trunks’”, but brings me to a

Sorry, I have no sql scripting knowledge.
I’m also assuming I will need to use the command " select * from sip where id like ‘temp trunk to delete’; "

Thanks dicko for your help. I’ve been reading all your comments on other issues, very helpful. Is there a place where I can get a step by step command script I can input. Everywhere I look is bits of pieces from the community. No direct answer, unless your a pro at this.

from bash do what I said , from mysql

use asterisk;
select * from trunks;

It’s not a complete script, more a diagnostic.

So I’m getting:

MariaDB [asterisk]> select * from trunks;
Empty set (0.00 sec)


use asterisk;
describe trunks;

All I can suggest is

use asterisk

otherwise it is above my paygrade

Thanks dicko, looks like we had a serious database issue. I had to pay the big guns to fix the issue. Thank you so much for your help. I truly appreciate it.