Creating custom extensions in mysql database

Hi friends. We have an interconnection agreement with an PSTN operator, supplying us with a range of telephone numbers like part of the deal. The configuration of FreePBX for the availability of the calls is as follows:

exten => 97000092,1,Dial(local/1262@from-internal,20)
exten => _0197XXXXXX/1262,1,Set(CALLERID(num)=97000092)

So the extension 1262, when calls a PSTN number, changes its ID to 97000092, which is recognized in the telephone network as a PSTN number and can be routed properly. When you call 97000092, it is redirected the call to our Asterisk and the 1262 starts ringing. Everything related to the interconnection had been written in the custom_extensions.conf.

Adding to that, we have configured a trunk properly and an outbound route like this:

_0197XXXXXX/97XXXXXX

If you notice, 97XXXXXX is the range that the PSTN provider had supplied us. Any unauthorized access is prohibit if you are not “registered” in the .conf file (the configuration was stated previous).

Now the issue or problem is the increasing number of extensions we have that need to be accountable in amounts of telephones given. I’ve been searched that FreePBX has an mysql server running and I’ve noticed that has a custom_extension table there. So: is it possible to write all the configurations in the extensions_custom.conf file in this table?

@Alkbert The first question that needs to be answered here, are you trying to use FreePBX in a multi-tenant setup? Followed by how many numbers are in this range? Finally, to answer your question, no that table is not where you would put that stuff. It’s not meant for that.

You are self proclaimed “Experienced in Matlab, Statistics and MariaDB”. The database is asterisk, there are several tables of interest to you, users,extensions,ampusers, devices,sip,iax and others,

They are inexorbaly linked together by joins, yes you could deconstruct it and successfully achieve your aims , but you really don’t want to :wink:

Newer versions of FreePBX have

https://wiki.freepbx.org/plugins/servlet/mobile?contentId=37912685#content/view/37912685

Use ’ fwconsole bulkimport’ to save your hair.

1 Like

Totally agree my friend, but it is my bad to not mention a small detail:

Our Asterisk has many trunks to other Asterisks and several Grandstream FXS Gateways,and the solution we found (many time ago), was to declare for external extensions (outside our PBX) the code previously explained, meaning extensions that does not exist in FreePBX could have a PSTN number and they can call or receive calls.

Yes, we could create severals extensions and use follow me to redirect the call properly if a PSTN number calls one of the extenal extensions, but what about calling PSTN numbers from those extensions? I couldn’t find how to do it but this:

exten => _0197XXXXXX/1262,1,Set(CALLERID(num)=97000092).

You have NOW the whole picture… And yes, I don’t want to dissassemble FreePBX but I don’t know what to do in that particular case.

Thanks!.In other topic I was explained about multitenancy:Related Security PBX Asterisk

If multi-tenant is what you are after, then you should know FreePBX/Asterisk might not be your best option.

Asterisk is a B2BUA , you ]really need a full blown SIP Proxy to even begin to attack this problem before it spins out of control.

Did you see his other posts about using VRRF and having like 14 routes with it on FreePBX?

No, l’ m not looking for multi-tenant installation.

I will try OpenSIPS combined with Asterisk. Thanks!

A huge project? No. Many tasks? Yes.Related? Maybe…or not. The same idiot doing all of that?Yep, it’s me. For all of my topics created here, they don’t necessarily converge but are not completely separated either. I asked about VRF cause thats for another PBX, not this one. The company has several PBXs ( FreePBX and Asterisk also) which was “given” to me (I inherit the configurations and problems related, as you see). I think I probably misunderstood the concept behind Asterisk, maybe for being really new in VoIP… And again, the idea is to store the extensions(external and internal) with their configurations in a database. Still wondering how to do it… Although to create an app for doing that, that could write in a database(external) and in the custom_extensions…It will take time but that is my final option.

Trunks to branch offices? Vendors? Customers?

For extensions at branch offices, presumably trusted, just route external numbers to your PTSN lines or trunking providers, using whatever caller ID they provide. On incoming, route DIDs in their range to their trunk and let the remote system figure out how to get it to the proper extension.

For a vendor or customer trunk, they should send the proper extension number; don’t allow any outside calls.

Please explain why you need a database to map the numbers.

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