Corrupted sip_additional.conf

My GUI access to sip_additional.conf seems to be corrupted. I got a trunk that I can’t delete in sip_additional.conf

I can change and delete it in the GUI but when I look at the file (after a reload) the trunk is still listed in sip_additional.conf unchanged.

So I start looking at the various SQL files since the information gotta be stored somewhere and in dbase:Asterisk table:sip I find most of the trunk info as trunkID #9 and I delete it but now every time I recreate the trunk it comes out weird in sip_additional.conf with “context=from-trunk-sip-TEST” and it’s missing callcounter=yes and faxdetect=no.

For test purposes I created a simple trunk called test for trunkID 9 and I still get the weird context

[TEST]
context=from-trunk-sip-TEST

and THIS
[from-trunk]
type=user
callcounter=yes
faxdetect=no

and THIS
[999]
type=user
context=from-trunk

MYSQL - SIP shows
tr-peer-9
tr-user-9

In the MYSQL dbase I also found this trunk I deleted months ago
999914 account FAX 2
999914 allow alaw 7
999914 disallow all 6
999914 host 21.54.11.11 5
999914 insecure very 4

Can anyone help to clear this up?

Naming a trunk a context “IE: user context: from trunk” is never a good idea.

Are you asking us if this is a valid peer configuration? I am not sure I understand the question.

  1. The trunk name is SAMPLE.
    The User Context name is supposed to be the account name/number my provider expects but they expect nothing and I can’t leave it blank either. SAMPLE is already used as trunk name and it does not allow duplicates. What do you suggest? Anything except the word trunk? I changed it and used “from_SAMPLE”. Is that acceptable?

  2. Yes (and no). I am not asking you to correct my trunk. I simply want to know if my SIP_additional.conf file is corrupted if it contains the line “context=from-trunk-sip-SAMPLE”. Is that ok or is it definitely wrong?

  3. Now that I changed the Context name to from_SAMPLE my sip_additional.conf looks like this. Is that correct or is my file still corrupted?

[from_SAMPLE]
type=user
context=from-trunk

[SAMPLE]
disallow=all
type=peer
insecure=port,invite
host=64.34.111.223
allow=g729
context=from-trunk-sip-SAMPLE

I was speaking of the contexts FreePBX generates and concerned about the chaos that would occur if a peer and context had the same name.

Asterisk has a sip variable, ‘regcontext’ that controls registration behavior, it’s use is outside the scope of FreePBX.

Are you still trying to clear stuff out of the database or are you having peer/trunk configuration issues.

No. My peer/trunk config is ok.

I also cleared out the database but since I have never seen a “good” sip_additional.conf file with FreePBX 2.8 (mine was always corrupted by the trixbox immport) I am just asking if my SAMPLE trunk looks ok. I.E. does it look similar to your trunks in sip_additional.conf with this type of syntax “context=from-trunk-sip-SAMPLE”

BTW. Everything is working ok.

My trunks in sip_additional.conf have the context I defined. The only time you will see the context you mention is if leave the context directive out and allow FreePBX to generate the trunk.

This is a new feature you are not used to seeing on the trixbox.

From Asterisk’d perspective the variables in sip.conf (sip_additional is simply an include) have not changed. Of course 1.6 and 1.8 add additional variables.

Got it. Thank you.

We actually imported the trunks from trixbox not knowing the numbering had changed. Can you explain the new format please? If I were to delete all trunks and recreate them would all 999914 (and similar) numbers disappear and be replaced by tr-peer-14 or something like that? If yes can you explain a bit the new numbering scheme? Maybe I can find the error without having to delete everything. Aside from the Asterisk:sip table is there any other SQL table that contains trunk info and would create a weird context like that?

For those lurking in this thread, the proper way to convert a trixbox system is to install the FreePBX backup utility version 2.6 on the trixbox and create the backup file.

On your new system install FreePBX version 2.6 and restore the backup. Now use the upgrade utility to bring the system current.

This results in an error free transition.

Importing the database between versions is a recipe for disaster.

OK but what’s done is done. I can’t go back and the system is quite stable so unless all hell breaks loose we’ll work with what we got. If I get an explanation of how the trunks are stored in the MySQL SIP table I can probably fix this.

So I cleaned out the SQL table by deleting everything starting with ID 999. Can you tell me if this trunk is correct? In particular the last line worries me as I have never seen it before “context=from-trunk-sip-SAMPLE”

[SAMPLE]
disallow=all
type=peer
insecure=port,invite
host=64.34.111.223
allow=g729
context=from-trunk-sip-SAMPLE

if you don’t include a ‘context=something’ in your trunk configuration, FreePBX automatically includes it for you.

this was a source of many many users pulling their hear out before this was added several releases ago.

have a look at the tool tip for the max channels and/or the extensions_additional.conf file (where that context is defined) to learn more about form-trunk-sip-SAMPLE.

Thanks but I still don’t know if my trunk is correct or not. If understand you correctly the line “context=from-trunk-sip-SAMPLE” should only be there if nothing is defined as context and maybe if max channels is used but I am not using the “Max Channels” option. My trunk details are:

PEER DETAILS

Name: SAMPLE
Details:
type=peer
insecure=very
host=64.34.111.223
disallow=all
allow=g729

User Context: from-trunk
Details:
type=user
context=from-trunk

and the sip_additional.conf file returns the trunks as listed below. Is this correct or do I need to delete more stuff?

[SAMPLE]
disallow=all
type=peer
insecure=port,invite
host=64.34.111.223
allow=g729
context=from-trunk-sip-SAMPLE

Any new trunk I create now also has the same weird context. Something is corrupting every trunk I create in my system. E.g.

[Vp_go]
disallow=all
type=peer
insecure=port,invite
host=75.846.13.134
allow=g729
context=from-trunk-sip-Vp_go

not knowing the whole history or what you have gone in and deleted it’s going to be hard to say quite what happened.

It sounds like somewhere along the way one of your trunks didn’t get migrated properly.

The numbering system of 999914 (and similar numberings) comes from earlier versions prior to cleaning up the trunk naming conventions (that was 2.6 or maybe 2.7???) and eventually the route information (2.8).

If you don’t have a trunk id of 14 then you are probably safe to delete those entries. Otherwise you are going to have to dig through and determine what is there that shouldn’t be to clean it up, and unfortunately, it’s not an easy thing to ‘describe’ how to do, it’s going to take any eye of someone who is fairly familiar with the internal schemas and what use to be there, or a bit of ‘studying’ to understand what needs to be there and figure out what should be yanked.