text stringlengths 0 152 |
|---|
connection=asterisk_mysql |
table=cdr |
[mssql_connection] |
connection=production_mssql |
table=call_records |
284 |
| |
Chapter 15: Relational Database Integration |
If you specify multiple sections using the same connection and |
table, you will get duplicate records. |
Beyond just configuring multiple connections and tables (which of course may or |
may not contain the same information; the CDR module we’re using is adaptive to |
situations like that), we can define aliases for the built-in variables, such as account |
code, src, dst, and billsec. |
If we were to add aliases for column names for our MS SQL connection, we might |
alter our connection definition like so: |
[mssql_connection] |
connection=production_mssql |
table=call_records |
alias src => Source |
alias dst => Destination |
alias accountcode => AccountCode |
alias billsec => BillableTime |
In some situations you may specify a connection where you only want to log calls |
from a specific source, or to a specific destination. We can do this with filters: |
[logging_for_device_0000FFFF0008] |
connection=asterisk_mysql |
table=cdr_for_0000FFFF0008 |
filter src => 0000FFFF0008 |
If you need to populate a certain column with information based on a section name, |
you can set it statically with the static option, which you may utilize with the filter |
option: |
[mysql_connection] |
connection=asterisk_mysql |
table=cdr |
[filtered_mysql_connection] |
connection=asterisk_mysql |
table=cdr |
filter src => 0000FFFF0008 |
static "DoNotCharge" => accountcode |
In the preceding example, you will get duplicate records in the |
same table, but all the information will be the same except for |
the populated accountcode column, so you should be able to |
filter it out using SQL. |
Storing Call Detail Records |
| |
285 |
Database Integration of ACD Queues |
With a Call Center (often referred to as ACD queues), it can be very useful to be able |
to allow adjustment of queue parameters without having to edit and reload configu‐ |
ration files. Management of a call center can be a complex task, and allowing for sim‐ |
pler adjustment of parameters can make everyone’s life a whole lot easier. |
The queues themselves we’ve already placed in the database in Chapter 12. If, how‐ |
ever, you also want to store dialplan parameters relating to your queues, the database |
can do that too. |
Storing Dialplan Parameters for a Queue in a Database |
The dialplan application Queue() allows for several parameters to be passed to it. The |
CLI command core show application Queue defines the following syntax: |
[Syntax] |
Queue(queuename[,options[,URL[,announceoverride[,timeout[,AGI[,macro[,gosub[, |
rule[,position]]]]]]]]]) |
Since we’re storing our queue in a database, why not also store the parameters you |
wish to pass to the queue in a similar manner?11 |
MySQL> CREATE TABLE `pbx`.`QueueDialplanParameters` ( |
`QueueDialplanParametersID` mediumint(8) NOT NULL auto_increment, |
`Description` varchar(128) NOT NULL, |
`QueueID` mediumint(8) unsigned NOT NULL COMMENT 'Pointer to asterisk.queues table', |
`options` varchar(45) default 'n', |
`URL` varchar(256) default NULL, |
`announceoverride` bit(1) default NULL, |
`timeout` varchar(8) default NULL, |
`AGI` varchar(128) default NULL, |
`macro` varchar(128) default NULL, |
`gosub` varchar(128) default NULL, |
`rule` varchar(128) default NULL, |
`position` tinyint(4) default NULL, |
`queue_tableName` varchar(128) NOT NULL, |
Subsets and Splits
No community queries yet
The top public SQL queries from the community will appear here once available.