Programmable API? Directly modify database?

I’ve been looking for some sort of API - perhaps a web service - that would allow me to programmatically do things like create/edit/remove devices/extensions, modify IVRs, etc. but have come up empty.

It appears to me that I could directly modify the data in the FreePBX database to accomplish my goals, but experience has taught me that going behind an application’s back like this should be a last resort.

So, I’m just looking for some input on what others are doing. Are there any APIs I can code against to accomplish these tasks? Has anyone else had any luck/issues with directly modifying the database to accomplish similar tasks?

Thanks :slight_smile:

Look at the bulkextensions module, that module let you import settings from a text file into extensions.

nothing has been done here - it needs to be some day though I suspect we probably have enough going on in 2.9 that this won’t happen this time around.

There’s a lot to be cleaned up inside of FreePBX and each release tries to take a stab at something, this is unfortunately one of many though there are other efforts going on to help make external apps at least get access to the APIs (whether the clean ones or ugly ones like these).

so, any success with making some usable api (php/ruby/whatever?) for creating ext’s ?

please, share to [email protected] if you have made any :slight_smile:

thanks in advance.

the painful part is all the REQUEST array variables that it is expecting to be setup, and the fact that you will need to create the user, device and voicemail setup. If there are other settings from other modules that hook into extensions that you need setup, you will have to call their APIs also.

Just an update to say I think I’ve got it all figured out. My big problem when trying to locate how devices were added, etc., was that I checked out the 2.6 source from SVN, but no module source…

Anyway, looks like it won’t be overly complicated to create my own module with most of the functionality I need.

Cheers,
[email protected]

Thanks Philippe,

Could you point me in the right direction for the best place to start looking for these “APIs”? Also, would you know off the top of your head where in the code I might find the section responsible for adding a new extension. I’d like to see what all is happening behind the scenes during that process to help me get a better handle on this.

Thanks :slight_smile:

[email protected]

There are “APIs” that each module provides and other modules or programs could take advantage of if setup properly. However, for adding/removing extensions it is really extremely ugly and non-trivial.

However, you can’t simply update the SQL database for things like adding extensions as there is other data that gets updated such as AstDB objects and voicemal.conf, and sometimes other modules’ tables depending on what you configure.