mirror of
				https://github.com/asterisk/asterisk.git
				synced 2025-10-31 02:37:10 +00:00 
			
		
		
		
	This patch gives the optional ability to keep queue rules in RealTime. It is
important to note that with this patch:
 (a) Queue rules in RealTime are only examined on module load/reload
 (b) Queue rules are loaded both from the queuerules.conf file as well as the
     RealTime backend
To inform app_queue to examine RealTime for queue rules, a new setting has been
added to queuerules.conf's general section "realtime_rules". RealTime queue
rules will only be used when this setting is set to "yes".
The schema for the database table supports a rule_name, time, min_penalty, and
max_penalty columns. min_penalty and max_penalty can be relative, if a '-' or
'+' literal is provided. Otherwise, the penalties are treated as constants.
For example:
rule_name, time, min_penalty, max_penalty
'default', '10', '20', '30'
'test2', '20', '30', '55'
'test2', '25', '-11', '+1111'
'test2', '400', '112', '333'
'test3', '0', '4564', '46546'
'test_rule', '40', '15', '50'
which would result in :
Rule: default
 - After 10 seconds, adjust QUEUE_MAX_PENALTY to 30 and adjust
   QUEUE_MIN_PENALTY to 20
Rule: test2
 - After 20 seconds, adjust QUEUE_MAX_PENALTY to 55 and adjust
   QUEUE_MIN_PENALTY to 30
 - After 25 seconds, adjust QUEUE_MAX_PENALTY by 1111 and adjust
   QUEUE_MIN_PENALTY by -11
 - After 400 seconds, adjust QUEUE_MAX_PENALTY to 333 and adjust
   QUEUE_MIN_PENALTY to 112
Rule: test3
 - After 0 seconds, adjust QUEUE_MAX_PENALTY to 46546 and adjust
   QUEUE_MIN_PENALTY to 4564
Rule: test_rule
 - After 40 seconds, adjust QUEUE_MAX_PENALTY to 50 and adjust
   QUEUE_MIN_PENALTY to 15
If you use RealTime, the queue rules will be always reloaded on a module
reload, even if the underlying file did not change. With the option disabled,
the rules will only be reloaded if the file was modified.
Review: https://reviewboard.asterisk.org/r/3607/
ASTERISK-23823 #close
Reported by: Michael K
patches:
  app_queue.c_realtime_trunk.patch uploaded by Michael K (License 6621)
git-svn-id: https://origsvn.digium.com/svn/asterisk/branches/13@420624 65c4cc65-6c06-0410-ace0-fbb531ad65f3
		
	
		
			
				
	
	
		
			110 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
			
		
		
	
	
			110 lines
		
	
	
		
			3.9 KiB
		
	
	
	
		
			Plaintext
		
	
	
	
	
	
| ;
 | |
| ; Static and realtime external configuration
 | |
| ; engine configuration
 | |
| ;
 | |
| ; See https://wiki.asterisk.org/wiki/display/AST/Realtime+Database+Configuration
 | |
| ; for basic table formatting information.
 | |
| ;
 | |
| [settings]
 | |
| ;
 | |
| ; Static configuration files:
 | |
| ;
 | |
| ; file.conf => driver,database[,table[,priority]]
 | |
| ;
 | |
| ; maps a particular configuration file to the given
 | |
| ; database driver, database and table (or uses the
 | |
| ; name of the file as the table if not specified)
 | |
| ;
 | |
| ; Uncomment to load queues.conf via the odbc engine.
 | |
| ;
 | |
| ;queues.conf => odbc,asterisk,ast_config
 | |
| ;extensions.conf => sqlite,asterisk,ast_config
 | |
| ;
 | |
| ; The following files CANNOT be loaded from Realtime storage:
 | |
| ;	asterisk.conf
 | |
| ;	extconfig.conf (this file)
 | |
| ;	logger.conf
 | |
| ;
 | |
| ; Additionally, the following files cannot be loaded from
 | |
| ; Realtime storage unless the storage driver is loaded
 | |
| ; early using 'preload' statements in modules.conf:
 | |
| ;	manager.conf
 | |
| ;	cdr.conf
 | |
| ;	rtp.conf
 | |
| ;
 | |
| ; Named ACLs specified in realtime also can not be used
 | |
| ; from manager.conf unless the storage driver is preloaded.
 | |
| ; Attempting to use a realtime stored named ACL before the
 | |
| ; driver is loaded will result in an invalid ACL which
 | |
| ; rejects all addresses.
 | |
| ;
 | |
| ; Realtime configuration engine
 | |
| ;
 | |
| ; maps a particular family of realtime
 | |
| ; configuration to a given database driver,
 | |
| ; database and table (or uses the name of
 | |
| ; the family if the table is not specified
 | |
| ;
 | |
| ;example => odbc,asterisk,alttable,1
 | |
| ;example => mysql,asterisk,alttable,2
 | |
| ;example2 => ldap,"dc=oxymium,dc=net",example2
 | |
| ;
 | |
| ; Additionally, priorities are now supported for use as failover methods
 | |
| ; for retrieving realtime data.  If one connection fails to retrieve any
 | |
| ; information, the next sequential priority will be tried next.  This
 | |
| ; especially works well with ODBC connections, since res_odbc now caches
 | |
| ; when connection failures occur and prevents immediately retrying those
 | |
| ; connections until after a specified timeout.  Note:  priorities must
 | |
| ; start at 1 and be sequential (i.e. if you have only priorities 1, 2,
 | |
| ; and 4, then 4 will be ignored, because there is no 3).
 | |
| ;
 | |
| ;
 | |
| ; Possible driver backends:
 | |
| ;
 | |
| ; "odbc" is shown in the examples below, but is not the only valid realtime
 | |
| ; engine.  Here are several of the possible options:
 | |
| ;    odbc ... res_config_odbc
 | |
| ;    sqlite ... res_config_sqlite
 | |
| ;    sqlite3 ... res_config_sqlite3
 | |
| ;    pgsql ... res_config_pgsql
 | |
| ;    curl ... res_config_curl
 | |
| ;    ldap ... res_config_ldap
 | |
| ;    mysql ... res_config_mysql (available via add-ons in menuselect)
 | |
| ;
 | |
| ; Note: The res_config_pgsql and res_config_sqlite backends configure the
 | |
| ; database used in their respective configuration files and ignore the
 | |
| ; database name configured in this file.
 | |
| ;
 | |
| ;iaxusers => odbc,asterisk
 | |
| ;iaxpeers => odbc,asterisk
 | |
| ;sippeers => odbc,asterisk
 | |
| ;sipregs => odbc,asterisk ; (avoid sipregs if possible, e.g. by using a view)
 | |
| ;ps_endpoints => odbc,asterisk
 | |
| ;ps_auths => odbc,asterisk
 | |
| ;ps_aors => odbc,asterisk
 | |
| ;ps_domain_aliases => odbc,asterisk
 | |
| ;ps_endpoint_id_ips => odbc,asterisk
 | |
| ;voicemail => odbc,asterisk
 | |
| ;extensions => odbc,asterisk
 | |
| ;meetme => mysql,general
 | |
| ;queues => odbc,asterisk
 | |
| ;queue_members => odbc,asterisk
 | |
| ;queue_rules => odbc,asterisk
 | |
| ;acls => odbc,asterisk
 | |
| ;musiconhold => mysql,general
 | |
| ;queue_log => mysql,general
 | |
| ;
 | |
| ;
 | |
| ; While most dynamic realtime engines are automatically used when defined in
 | |
| ; this file, 'extensions', distinctively, is not.  To activate dynamic realtime
 | |
| ; extensions, you must turn them on in each respective context within
 | |
| ; extensions.conf with a switch statement.  The syntax is:
 | |
| ;      switch => Realtime/[[db_context@]tablename]/<opts>
 | |
| ; The only option available currently is the 'p' option, which disallows
 | |
| ; extension pattern queries to the database.  If you have no patterns defined
 | |
| ; in a particular context, this will save quite a bit of CPU time.  However,
 | |
| ; note that using dynamic realtime extensions is not recommended anymore as a
 | |
| ; best practice; instead, you should consider writing a static dialplan with
 | |
| ; proper data abstraction via a tool like func_odbc.
 | |
| 
 |