Premier IT Outsourcing and Support Services within the UK

User Tools

Site Tools


FreePBX Queue Membership

Queue members are stored within AstDB, which is a Sqlite3 database so these aren't found in config files. You can influence these using the queue memmber add/remove commands via AMI or if so inclined by accessing the AstDB directly (not recommended). You can get a list of members using show queue within Asterisk (or asterisk -rx "queue show nnnnn") but we can also leverage FreePBX to get a list using the framework.

// pbxqueues.php Version 1.001a
// Richard Taylor 2021
// Chunks taken from FreePBX source
if (!isset($argv[1])){
	echo "usage pbxqueues <queue number>"; exit;
include '/etc/freepbx.conf';
$FreePBX = FreePBX::Create();
if ($astman) {
	$account = $argv[1];
        //get dynamic members priority from astDB
        $get = $astman->database_show('QPENALTY/'.$account.'/agents');
		foreach($get as $key => $value){
		foreach($mem as $mem => $pnlty){
	} else {
	$results['dynmemberonly'] = $astman->database_get('QPENALTY/'.$account,'dynmemberonly');
} else {
	fatal("Cannot connect to Asterisk Manager with ".$amp_conf["AMPMGRUSER"]."/".$amp_conf["AMPMGRPASS"]);

You can of course modify this code to change Queue Membership if needed. The recommended route is of course to use Asterisk's built in commands though. The format of AstDB *may* change in the future and this may break things for you.

A scenario where this could be useful is when we're synchronising a list of queue members with a third party system. We use the code above to get a list of current members, then open a session with Asterisk via AMI and remove those who we don't want and add those we do.

Remember queue membership changes occur right away and there's no need to do a dialplan reload etc.

/data/webs/external/dokuwiki/data/pages/source/programatically_list_dynamic_queue_members_from_freepbx.txt · Last modified: 2021/11/01 10:32 by genadmin

Donate Powered by PHP Valid HTML5 Valid CSS Driven by DokuWiki