Edit queue or ring group members with a script

I would like to be able to add or remove extensions to a ring group or queue via a script. I know I am not supposed to go editing the text files manually, so I assume I shouldn’t have a script do that either. Is there a way this can be accomplished cleanly within the freepbx system?

Be aware that asterisk has absolutely no knowledge of FreePBX, it acts solely on the content of the sqlite3 asteriskdb database for it’s “state” which is largely seeded by the /etc/asterisk/*.conf files, you can manipulate that in real time to your hearts content and so will asterisk follow your direction. FreePBX might override your dynamic choices on a “reload”

Following up on @dicko … If a reload overwrites your changes, you should make your updates in the “*_custom*” files. These are not overwritten by FreePBX, so they are update safe.

This second level of indirection requires some attention to detail, but should be reasonably doable.