Pointers for a larger setup from ground up

Hi,
Wondering if anyone can provide some pointers to automate as much as possible the setup of a new 15 Freepbx with 300+ extensions + phones. The phones can be configured to point to the new Freepbx server tftp to grab .cfg files but it still leaves the creation of all the .cfg files and all the extensions on the new Freepbx server.

There is bulk extensions but that still requires manual creation for each extension. Is there any way to automate the extension creation?

Thanks.

You can buy EPM and manage them in the GUI.

Or you can manually create the config files once and upload them to the server.

For me, I would do it manually because I use Yealink phones and the unique bits per extension are only a few fields. So I make a template file that has most settings. Then a model based template if needed and then a cfg per MAC address that basically only has the extension credentials. I also put the /tftpboot folder into a private git repository to handle changes from anywhere.

That is assuming that once created, these won’t change much. If you need more dynamic changes, EPM is the best solution as long as the phones are supported.

Using EPM still requires manual configuration for ext.# user/pass right? Plan on using Yealink phones also. There is a cfg configurator but this too requires configuration for each phone due to credentials even though all the phones will have the same configuration.

I don’t think the EPM will create all the extensions in Freepbx. It will still require the mac_addresses.cfg.
Normally (installation with 20 or so extensions) I would just create the extensions manually in Freepbx and configure the phones. But 300+ phones and extension creation in Freepbx is another issue which I would love to find a way to automate.

If in a new Freepbx 15 server having all the mac_address.cfg in /tftpboot would allow the ext/user/pass to be created 1st time from the phone booting up after loading its .cfg, would save a ton of time.

You’re going to waste as much time building automation as he will just building it. Unless you’re going to repeatedly install these things like this, there’s no point in “automating “.

Edit: if you are doing this multiple times, then I’m not gonna write you a script to make your money. Do it yourself.

1 Like

As sorvani said EPM is your best solution.

For the extensions I think Bulk Handler can help you. I’m guessing you’ve got a list of user names and e-mails. You can build one extension, export the list, then easily copy the desired settings and names and upload it. Might save you some time.

This is just a bad idea all around. It was clearly not thought through outside of the “This is what I want” logic. Putting a blank macaddress.cfg isn’t going to do jack for creating extensions/users on the system.

  1. How will FreePBX know what extensions to create? Is it going to start a 100? 1000? It’s just going to guess which extensions it should have?

  2. What is it going to name the extensions? The name that is also used for internal CallerID and ConnectedLine updates. Randomly going to make up a name?

  3. You’re using Yealinks so I’ll use that for this example. Say I have a few T30’s for break rooms or simple access phones but then I want everyone else on T-38G’s, the reception phones as T-46U’s with perhaps sidecars that the management being a T-5X phone. So now you have multiple models of a phone based on the users that will use them. How will a blank macaddress.cfg be able to determine which is which?

  4. FreePBX/Asterisk is a multi-tech based system. This all works under the assumption that everything is SIP based. That can’t be an absolute, at all.

  5. How will it know that X amount of extensions don’t need user accounts (UCP) because there’s no need for them. How will it know which extensions need user accounts and what those user accounts should have permission for?

  6. What about different configurations for the phones? I mean if there are T-46U’s with sidecars and then some with out, how will you handle that? How will you handle X phones needing 5 BLFs and certain softkeys while Y phones don’t need BLFs but different softkeys?

And this is just a quick 50K view I see based on this thread. I haven’t even gotten into the real grit of how this would run, validations schemes and other backend things that would need to happen for a very poor deployment methodology.

Do this properly and create a .csv file to bulk important the extensions. I do this with hotels when needed and to do a bulk import of 100’s of extensions takes less than an hour which includes formatting the .csv file with a lot of details. The basic import has like less than a dozen required fields.

3 Likes

Sure… here are 800 PJSIP extensions with the name set the same as the extension number.

<?php

include '/etc/freepbx.conf';
$FreePBX = FreePBX::Create();

for ($ext = 1000; $ext <=1799; $ext++) {
        $FreePBX->Core->processQuickCreate('pjsip', $ext, array(name=>$ext));
}

?>

then you can use the Bulk Handler to export your extensions and get the passwords.

Or do this and get an ext,pw CSV output:

<?php

include '/etc/freepbx.conf';
$FreePBX = FreePBX::Create();

for ($ext = 1000; $ext <=1799; $ext++) {
        $pw = $FreePBX->Core->generateSecret();
        $FreePBX->Core->processQuickCreate('pjsip', $ext, array(name=>$ext, secret=>$pw));
        echo "$ext,$pw\n";
}

?>

I don’t recommend it, but you can do it. There are hacky ways to do a lot of not-recommended things.

3 Likes

When I posed the question, it was a general question without a lot of detail obviously. There won’t be unique ‘human names’ just basic ext. # => name with name = extension #. In other words ext. 100 will display as 100 and Freepbx username will be 100. The issue there of course is the password. Unless one uses the same password for all phones.

All the phones will be the same, Yealink T31P.
The phones go to different locations. but all locations will have l2tp/ipsec tunnel to the data center router. Inside each location they will have the same vlanID so that if they move some phones to other location(s) where they might be short, the phone will work. Of course if the moved phones were part of ring group, that will require manual change in Freepbx but that’s no big deal. And not to mention any extension change in an IVR. Again that’s not a big deal.

I don’t quite get why you are saying something about blank mac.address.cfg. Every phone has to have (at least as far as I know) a unique mac.address.cfg file in /tftpboot.

The distributor has told me they will setup the redirector at Yealink to point to the IP address of the Freepbx server. But that just brings back the same problem, that is creating all the extensions in Freepbx with passwords. Somehow I see sorvani’s point. Trying to automate will probably take twice as much time as to just create the 300+ extensions 1 by 1 in Freepbx.

As for extension numbering I would just start at 100 and move on. Since they are planning to move phones around, it doesn’t make much sense to make naming convention based on a building number.

Thanks.

So use the Bulk Handler to import the extensions. Then use the EPM’s Bulk Import function to import the MACs of the phones, who they are assigned to and the profiles they should use.

All Yealink’s service provides is having those phones reach out to their provisioning server which will push a config that has your provisioning server details. You’re still going to need to create the profiles on the system for the phones to grab. If you don’t you’ll just have a bunch of “file not found” errors in the logs while the phones request the configs that don’t exist.

This is a couple hours of work (tops) that includes the time spent creating .csv files. The actual imports take minutes to process. You’re making this a bigger task than it needs to be.

1 Like

But where do the passwords for the extensions get made? If you create a .csv or after building the new Freepbx server, create one extension and then export it to .csv it will have a password for the one single extension. What about the other 300?
Thanks.

Bulk Handler User Guide - PBX GUI - Documentation (freepbx.org)

Plus the tooltips and the very clear template examples in the Bulk Handler interface. Read the documentation.

3 Likes

This is the magic that creates the password for each new extension?
Secret [Enter “REGEN” to regenerate]

Do you have a directory full of Yealink config files that already have extension numbers and passwords within?

I know others are talking you out of it but if that’s what you have then you can use the script I gave you earlier in the thread; just replace the simple for-loop with data that you get by scanning the cfg files in tftpboot… you can see how the password is set and everything.

That is a workable solution, but if the poster wants to set some different defaults for an extension, may not be settable via the API. For example, I don’t think the API lets one set the accountcode on the extension?

That is why I would manually create 1 extension setup the way you want, then do a bulk export of the extension, incoming routes and user manager. Of course you have to decide if you are using the user manager, what defaults you want to use (using VM? What VM settings to set, inbound fax support? etc)

Then write a shell script that will write out the appropriate info for each additional extension into CSV files, then bulk import the files.

I agree with you. Using the Quick Create in a command line script is no different from using Quick Create in the GUI. It’s good for generating a nearly featureless extension config. Except with a script you can do a bunch of them. If OP just wants to blast out several hundred extensions all set with defaults, it’s easy. For a bit more precision configuration, you and BlazeStudios have provided the better way.

EPM with Zero Touch Provisioning might be an option, check the video for an example.

I do not see T31G compatibility, I do see T32G
https://wiki.freepbx.org/display/fpg/epm-supported+devices

This all requires the configurations to exist on the final destination server, in this case the FreePBX server. That means that 1) The extensions need to already exist. 2) The EPM has been used to create these configs. Zero touch provisioning solves none of the pre-existing steps needed. It only solves the not logging in to each phone to get the profile problem.

1 Like

I wasn’t talking him out of it, I was telling him I wasn’t going to write a script for him for free.

2 Likes

Yes, since others seemed to have the prerequisite steps in discussion, I thought I could add the ZTP as a method to be aware of to help expedite the login and eventual config update process. Still seems relevant to the topic at hand, but only a suggestion, not the only way.

the graphql API supports a bulk-add extensions in range feature.

the endpoint manager module is awesome.
edit extension - tell it. the template to use, and what MAC address the phone has.
apply
done.