How can I programmatically create a UCP user?

Hi - two questions…

I currently use the old ARI, but am upgrading to UCP. What I was hoping to do was programatically create a user on the fly.

The way I do it today (without using the UCP), is that I programatically create a csv file for each new user and call the “Bulk Extensions” module to add the user’s extension. I pass the user name, VM password, etc. in the file.

I want to do a similar thing with FreePBX 12 and UCP, and wanted to create a virtual extension on the fly using PHP code. I guess I can use bulk extensions to create extensions, but users can no longer log into the Web GUI with just their extension number and numeric voicemail password, correct?

Please note: I am not asking about migrating all existing users to UCP (I understand I can follow the directions in this thread.

I looked at the User Manager hooks and functions but couldn’t see where I could create new users individually.

Thanks in advance.

OK, I’ve been experimnting and kind of answered my own questions… The FreePBX team made pretty easy! It looks like I can do this to create an extension on the fly without going through the UI…

  1. Write out a .csv file and load the extension using bulk extensions and initiate a reload.
  2. call “amportal a userman m”. It will ignore any existing UCP users, and just add what’s needed.
  3. Call amportal a ucp enableall

I have a final (I think) question… All my extensions have email addresses associated with them. Is there a way to have the UCP username be the email address instead of extension? Is there a way to set the password to something else?

A nice future feature would be “bulk UCP” similar to how there are bulk extensions and bulk DID’s. That would solve my issue above, and also allow me to delete UCP users on the fly.

I created this feature request:


1 Like

Thanks. Thats the proper way to do things. Just replying here to let you know I did look at it.