Change in trunk sip settings

I made a change in the sip settings for my sipstation trunk. I am using this since years.

However, sipstation itself overwrites my changes every now and then.

Is there any way to make these changes permanent?

I change the handling of the incoming text from
(my own routine)



Try adding lines like this to sip_custom_post.conf

[provider_context](+)       ; match whatever name shows in sip_additional.conf

try with the (+) first, and if that doesn’t work remove it.

Thanks for your quick response Lorne!

I understood your answer, but I have never done something with custom changes and I could not find the answer.

How would I know that it worked? Is there a conf that would show the combined results?

This will append the setting to the peer config. So in the end you will end up with the following basically being part of the peer settings. Generally Asterisk takes the first one it reads into memory and ignores the latter.


So you will need to override the peer or the actual dialplan context. The latter is properly the easiest. You would edit extensions_freepbx_override.conf and put your sms-incoming-nm context there but with just [sms-incoming]

Doing that will make Asterisk load your version of [sms-incoming] first and use that instead of the FreePBX configured [sms-incoming].


So in extensions_freepbx_override.conf

I put


Is there any way to see what asterisk does with it? Is there a way to see the final config asterisk is using?

No you put your actual context there.

exten => _X.,1,NoOp(Handling incoming SMS)
same => n,Do something with SMS dialplan from here

That is what needs to happen there. The actual dialplan.

Haha, now I am lost.

in extensions_additional.conf I have

exten => _.,1,Noop(SMS came in with DID: ${EXTEN})
exten => _.,n,Goto(s,1)

exten => s,1,AGI(sipstation_sms.php, RECEIVE)
exten => s,n,Hangup

;–== end of [sms-incoming] ==–;

You take the context that you referred to originally, sms-incoming-nm and you paste that in extensions_freepbx_override.conf and then you change the name from sms-incoming-nm to sms-incoming and save.

extensions_freepbx_override.conf is loaded first allowing Asterisk to load what it finds there in memory first and thus ignores the [sms-incoming] context that is loaded in extensions_additional.conf.

@StephanK - you’ve just been visited by the “flexibility fairy”.

The suggestion Lorne made will do what you originally asked, in that it updates your system to add the option in a way that the regular FreePBX Updates will not destroy.

Tom’s suggestion allows you to “preload” the SMS Handling Context by preloading the [incoming-sms] context with your code in the extensions_freepbx_override.conf file.

The advantage of the first is that the rest of the system exists without modifying anything except the one like in the sip_custom_post.conf file and your custom context in extensions_custom.conf. The advantage of the second is that you are now calling “incoming-sms” like the regular system, but you’ve created a new context “payload” by adding it to extensions_freepbx_override.conf.

One last important note - you can’t edit the extensions_additional.conf file. Your changes will be overwritten by the system’s “Apply Config” operation.

Neither solution is wrong - it all depends on how your concept of the system works.

This is the burden of flexibility. Note that you need to pick one or the other. if you use the extensions_freepbx_custom.conf option to “overload” the [incoming-sms] context, all of your changes are in one place and in a file that you won’t have to mess with. The downside is that you need to remember (or document in the NoOp() line) that you’ve added your own code. The other method doesn’t overload anything, but you have two changes to track and make sure stay in play.

The issue here is the setting already exists on the trunk. So it’s adding the same setting a second time to the config. It may or may not use the first listed setting over the last setting. As most other things do in Asterisk as the first to load.

So this is more than just adding an additional setting, it’s overriding the current one that needs to happen. Also keep in mind, which SIPStation moves to PJSIP trunks something like this will break it and cause it not to load. PJSIP will not load an object (endpoint, aor, etc) with misconfigured settings and duplicate settings would do that.

1 Like

Thanks for your responses.

Is there a way to see what Asterisk loaded, so I can see that I am on the right way?

Interesting. I has not been overwritten in years despite constant changes.

You mean extensions_override_freepbx.conf?

1 Like

Then you aren’t using FreePBX. That’s one of the files that FreePBX over-writes EVERY time the Apply Config button is pressed. All of your system-specific changes should go in extensions_custom.conf.

Sorry, I guess there was a misunderstanding. Yes, the changes were in extensions_custom.conf.

OK, I’m not sure why we are still not getting this.

In order to override [incoming-sms] the updated context needs to be in extensions_override_freepbx.conf putting it in extensions_custom.conf will make it load after the extensions_additional.conf is loaded.

#include extensions_override_freepbx.conf
#include extensions_additional.conf
#include extensions_custom.conf

^^^ That is the order of the dialplan files. What is read into memory first WINS so if you put [incoming-sms] in extensions_custom.conf nothing will look at it because FreePBX’s [incoming-sms] is loaded first and wins. So this needs to be in the first conf that is loaded, extensions_override_freepbx.conf. This is the same file apps like FOP2 and others use to override the dialplan that is generated by FreePBX for their functions to work.

So changing the SIPStation trunks to point at a custom context gets overwritten when the SIPStation module applies it changes so adding it there isn’t going to work. Appending the setting with the [trunkname](+) is just going to add a second setting at the end so again, no guarantees it will be even used.


I totally got it. You had a typo by telling me about extensions_freepbx_override.conf.
Using extensions_override_freepbx.conf it works perfect!



1 Like

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