Where Is FreePBX User Info Stored?

I am currently developing a web application that modifies the username that gets assigned to an extension. I have used the “database put AMPUSER/*EXTENSION# cidname *NEWUSERNAME” command in the asterisk CLI and this changes the caller id on internal calls like expected, however it does not change the username in the “extensions” section of FreePBX. Preferably, I want to change this information from the Linux shell or asterisk CLI.
Thank you!

What is your end goal?

I think you misunderstand the internal plumbing.

My end goal is to change the name associated with an extension inside freepbx from the commandline, cli, or file.

Try Googling: i have a dream command line utilities freepbx

You should find enough to get you started at the top of the list.

1 Like

This is all database driven using MySQL. Log into MySQL via the shell, select your Asterisk database (EX: USE asterisk), and take a look at the users table:

An example update query would be:

I’m not responsible if you blow up or otherwise break your server :wink:


This is exactly what i needed, thank you!

Thats the problem. It is not as simple as manipulating the mysql table. If you search bootstrap in the wiki you will see how to tie in to freepbx. I am still unclear what he I’d trying to accomplish but I don’t think he is going to end up where he wants to be.

A lot of stuff can be handled with BMO which you can search on wiki.freepbx.org. with bootstrapping you can call the official methods to acomplish a task which updates everthing that needs to be updated rather than trying to be clever and hope a table write gets you where you need to be

This is well beyond my current understanding, but hopefully for the OP who is developing a web application it makes sense. I had no clue that it worked like that, going to avoid touching these sorts of things for a bit until I get the time to read the documentation and learn what it means >_> Thanks for the info, James!

I did take a quick peek at the wiki and suggest people also do a cursory read on Adventure Time and My Little Pony so they can facepalm appropriately :smile: My best friend is a 1337 PHP dev and brony, maybe he’ll contribute to the project after I tell him about this :stuck_out_tongue:

Well, the MYSQL database modification combined with changing the CIDNAME in the asterisk CLI gives me what i wanted, changing the name in both the FreePBX GUI and the caller ID. Nothing else seams to be broken and it works. Im sure there is a more proper way to do things however this is quick and dirty.

Yeah, I think that covers most of it, BUT I think that implementing the related BMO code should be relatively easy. Their example shows a few lines of code that looks like it would handle things pretty well but it was a first glance AND I’m not a programmer by nature, just an eager junior sysadmin.

I think the basics of it were setting the query in one var, preparing to run the query, running the query, and then calling a function that states the query to discern what is related to it (and I think BMO does the rest and returns results in an array?)…but again…not an area I’m experienced in. These guys do the fun stuff I’m just trying to help out (the best way to learn something is to teach it to somebody else! :smiley:)

This looks interesting information. I need to do something similar on our system,
We have a central database that our admin staff keep up to date with new staff names and extensions. I would like to use this information to update the users name stored in FreePBX against an extension. The more automated I can make this the better, then the updates will be control by our admin people and not have to involve the IT staff with day to day changes. We do have quite a large number of staff coming and going all the time and about 600 extensions to maintain.

I’ll set about trying to implement this early in the new year. If anyone has any examples/snippets of code that might be useful I’d appreciate seeing them. Equally if I get it working for us anyone else is welcome to see what I have written.

Why not go the other direction and have them edit the FreePBX users (and replicate the data out if necessary)?

You should be able to create an admin who can add/remove extensions/users only, IIRC.

We already have a master source of user information ie AD, which contains much more information about the user, and we already use this as a source to feed into other systems such as HR, Finance etc, so using this to feed Freepbx would make sense. At least any typos in peoples names are consistent :smile:

1 Like

I’d also really like some sort of hook into the COS module, It would be really useful to be able to set this from an external source. Or at the very least some way of setting a default COS for all new extensions. A brief look at the database suggests this could be a complicated to set, maybe its something we could use paid for support for if its something they could do and give a quote for in advance.