Skip to content

Instantly share code, notes, and snippets.

@libryder
Created October 6, 2011 17:30
Show Gist options
  • Save libryder/1268035 to your computer and use it in GitHub Desktop.
Save libryder/1268035 to your computer and use it in GitHub Desktop.
Basic setup requirements for enabling dynamic queues in adhearsion
# Example dialplan to handle asterisk queues
# outbound context for a local channel
outbound {
gconfig = GlobalConfiguration.first
trunk = gconfig.main_trunk
number = extension.to_s.scan(/\d/).join[-10,10]
dialstring = "SIP/#{trunk}/+1#{number}"
dial(dialstring)
}
#inbound context
adhearsion {
execute('Queue', @dnis)
}
;define what database to use for dynamic queues
queues => mysql,callengine,queues
queue_members => mysql,callengine,queues_members
;this allows us to specify a local channel when defining queue members
[outbound]
exten => _.,1,NoOp()
same => n,Set(ADHEARSION_URL=agi://localhost:4573)
same => n,AGI(${ADHEARSION_URL})
exten => i,1,Congestion()
;this is the default adhearsion context for incoming calls
[adhearsion]
exten => _.,1,NoOp()
same => n,Set(ADHEARSION_URL=agi://localhost:4573)
same => n,AGI(${ADHEARSION_URL})
exten => i,1,Congestion()
;define database context for queues
[adhearsion]
dbhost = 127.0.0.1
dbname = adhearsion
dbuser = username
dbpass = userpass
dpbort = 3306
-- Create table queues and insert sample queue
CREATE TABLE `queues` (
`name` varchar(128) NOT NULL,
`musiconhold` varchar(128) DEFAULT NULL,
`announce` varchar(128) DEFAULT NULL,
`context` varchar(128) DEFAULT NULL,
`timeout` int(11) DEFAULT NULL,
`monitor_join` tinyint(1) DEFAULT NULL,
`monitor_format` varchar(128) DEFAULT NULL,
`queue_youarenext` varchar(128) DEFAULT NULL,
`queue_thereare` varchar(128) DEFAULT NULL,
`queue_callswaiting` varchar(128) DEFAULT NULL,
`queue_holdtime` varchar(128) DEFAULT NULL,
`queue_minutes` varchar(128) DEFAULT NULL,
`queue_seconds` varchar(128) DEFAULT NULL,
`queue_lessthan` varchar(128) DEFAULT NULL,
`queue_thankyou` varchar(128) DEFAULT NULL,
`queue_reporthold` varchar(128) DEFAULT NULL,
`announce_frequency` int(11) DEFAULT NULL,
`announce_round_seconds` int(11) DEFAULT NULL,
`announce_holdtime` varchar(128) DEFAULT NULL,
`retry` int(11) DEFAULT NULL,
`wrapuptime` int(11) DEFAULT NULL,
`maxlen` int(11) DEFAULT NULL,
`servicelevel` int(11) DEFAULT NULL,
`strategy` varchar(128) DEFAULT NULL,
`joinempty` varchar(128) DEFAULT NULL,
`leavewhenempty` varchar(128) DEFAULT NULL,
`eventmemberstatus` tinyint(1) DEFAULT NULL,
`eventwhencalled` tinyint(1) DEFAULT NULL,
`reportholdtime` tinyint(1) DEFAULT NULL,
`memberdelay` int(11) DEFAULT NULL,
`weight` int(11) DEFAULT NULL,
`timeoutrestart` tinyint(1) DEFAULT NULL,
`ringinuse` tinyint(1) DEFAULT NULL,
`setinterfacevar` tinyint(1) DEFAULT NULL,
PRIMARY KEY (`name`)
) ENGINE=MyISAM DEFAULT CHARSET=latin1;
--
-- Dumping data for table `queues`
-- This is a sample round robin queue
INSERT INTO `queues` set name='sample',strategy='rrmemory';
--
-- Table structure and sample data for queues_members table
--
CREATE TABLE `queues_members` (
`uniqueid` int(10) unsigned NOT NULL AUTO_INCREMENT,
`membername` varchar(40) DEFAULT NULL,
`queue_name` varchar(128) DEFAULT NULL,
`interface` varchar(128) DEFAULT NULL,
`penalty` int(11) DEFAULT NULL,
`paused` int(11) DEFAULT NULL,
PRIMARY KEY (`uniqueid`),
UNIQUE KEY `queue_interface` (`queue_name`,`interface`)
) ENGINE=MyISAM AUTO_INCREMENT=4 DEFAULT CHARSET=latin1;
--
-- Dumping data for table `queues_members`
-- This will create three members assigned to the queue "sample"
INSERT INTO `queues_members` VALUES (1,'agent1','sample','local/12345678903@outbound',0,NULL),(2,'agent2','sample','local/12345678901@outbound',0,NULL),(3,'agent3','sample','local/12345678902@outbound',0,NULL);
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment