Realtime Queue and Agent Management

From Etel

Jump to: navigation, search

Realtime Queue and Agent Management



You wish to manage your Asterisk queues and agents, but want to stay away from deprecated commands, as well as possibly be able to manipulate them through a web interface.


One way to stay away from those nasty deprecated commands (such as AgentLogin and AgentCallbackLogin) and add the possibility of easier management via a web interface or other external program is to use the realtime Queues system.



You'll need to install the MySQL server, client, and client libraries

The common package names for these apps are:


You'll need to use your package manager (or download and compile/install from source) to get these apps installed onto your system.

Asterisk Addons

Due to licensing restrictions, the MySQL addons for Asterisk are in a separate package called Asterisk-Addons. Retrieve the source code from the Asterisk download server and compile the package with MySQL support (use make menuconfig and make sure the mysql components are selected). Once the addons package is installed, we can begin configuring the database and Asterisk's connection to it.


Database Tables

Asterisk's realtime engine needs certain tables to be created to store queue names, queue members, etc. The first table to create would be the queue table:

CREATE TABLE queue_table (
 musiconhold VARCHAR(128),
 announce VARCHAR(128),
 context VARCHAR(128),
 timeout INT(11),
 monitor_join BOOL,
 monitor_format VARCHAR(128),
 queue_youarenext VARCHAR(128),
 queue_thereare VARCHAR(128),
 queue_callswaiting VARCHAR(128),
 queue_holdtime VARCHAR(128),
 queue_minutes VARCHAR(128),
 queue_seconds VARCHAR(128),
 queue_lessthan VARCHAR(128),
 queue_thankyou VARCHAR(128),
 queue_reporthold VARCHAR(128),
 announce_frequency INT(11),
 announce_round_seconds INT(11),
 announce_holdtime VARCHAR(128),
 retry INT(11),
 wrapuptime INT(11),
 maxlen INT(11),
 servicelevel INT(11),
 strategy VARCHAR(128),
 joinempty VARCHAR(128),
 leavewhenempty VARCHAR(128),
 eventmemberstatus BOOL,
 eventwhencalled BOOL,
 reportholdtime BOOL,
 memberdelay INT(11),
 weight INT(11),
 timeoutrestart BOOL,
 periodic_announce VARCHAR(50),
 periodic_announce_frequency INT(11),
 ringinuse BOOL,
 setinterfacevar BOOL

In the above example, we stuck with a simple table name of queue_table. Other than the name column, all other columns are optional. Refer to the Asterisk documentation (queues.conf)for more in-depth information about the configuration items.

The next table will be the queue member table, which will contain the current members for answering calls.

CREATE TABLE queue_member_table (
 membername varchar(40),
 queue_name varchar(128),
 interface varchar(128),
 penalty INT(11),
 paused INT(11),
 UNIQUE KEY queue_interface (queue_name, interface)

For this table, the membername column will be what you wish each member to be named, and queue_name is the queue that the record makes membername a member of. interface is the channel name, i.e. how to reach the member (example: SIP/301)

Asterisk Configuration

The first step for configuring Asterisk is to edit the extconfig.conf file, which controls the Realtime architecture, directing Asterisk where to find realtime data for certain items such as the system's queues. You'll need to change extconfig.conf to contain the following information:

queues => mysql,asterisk,queue_table
queue_members => mysql,asterisk,queue_member_table

You'll also need to edit res_mysql.conf to reflect the user asterisk as well as the rest of your database connection information.

Once you've edited those files, you can restart Asterisk so the changes will take effect.

You'll need to insert a new queue in queue_table and insert new records in queue_member_table to create and use qeues. You will not need to perform a reload of Asterisk for the data to be put in use, since Asterisk will use the Realtime architecture to check the database for configuration information configurations each time it's needed.

For the final step, we'll need to create the dialplan code to send callers to the queue(s) you configured, and a login and logout method.


Author: Sherwood McGowan

Personal tools