text
stringlengths
0
152
the expectations of most callers.
IVR
We’ll cover Interactive Voice Response (IVR) in more depth in Chapter 16, but before
we do that, we’re going to talk about something that is essential to any IVR. Database
integration is the subject of the next chapter.
Conclusion
An automated attendant can provide a very useful service to callers. However, if it is
not designed and implemented well, it can also be a barrier to your callers that may
well drive them away. Take the time to carefully plan out your AA, and keep it simple.
7 And if you do in yours, congratulations and please be careful swimming with the sharks.
Conclusion
|
257
CHAPTER 15
Relational Database Integration
Few things are harder to put up with than the annoyance of a good example.
—Mark Twain
In this chapter, we are going to explore integrating some Asterisk features and func‐
tions into a database. There are several databases available for Linux, and Asterisk
supports the most popular of them through its ODBC connector. While this chapter
will demonstrate examples using the ODBC connector with a MySQL database, you
will find that most of the concepts will apply to any database supported by
unixODBC.
Integrating Asterisk with databases is one of the fundamental aspects of building a
large clustered or distributed system. The power of the database will enable you to
use dynamically changing data in your dialplans, for tasks like sharing information
across an array of Asterisk systems or integrating with web-based services. Our favor‐
ite dialplan function, which we will cover later in this chapter, is func_odbc. We’ll also
take a look at the Asterisk Realtime Architecture (ARA), call detail records (CDR),
and logging details from any ACD queues you might have.
While not all Asterisk deployments will require relational databases, understanding
how to harness them opens a treasure chest full of new ways to design your telecom
solution.
Your Choice of Database
In Chapter 3, we installed and configured MySQL, plus the ODBC connector to it,
and we’ve been using the tables that Asterisk provides to allow various configuration
options to be stored in the database.
259
We chose MySQL primarily because it is still the most popular open source database
engine, and rather than bouncing around, duplicating trivial commands on various
different engines, we left implementing other types of databases to the skill set of the
reader. If you want to use a different database such as MariaDB, PostGreSQL, Micro‐
soft SQL, or in fact dozens (perhaps hundreds) of other databases supported by
unixODBC, it’s quite likely that Asterisk will work with it.
Asterisk also offers native connectors to several databases; however, ODBC works so
well we’ve never found any obvious reason to do things any other way. We’re going to
both recommend ODBC, and also focus exclusively on it. If you have a preference for
something else, this chapter should still provide you with the fundamentals, as well as
some working examples, and from there you are of course free to branch out into
other methodologies.
Note that regardless of the database you choose, this book cannot teach you about
databases. We have tried as best as we can to provide examples that do not require too
much expertise in database administration (DBA), but the simple fact is that basic
DBA skills are a prerequisite for being able to fully harness the power of any database,
including any you might wish to integrate with your Asterisk system. Database skills
are essential to nearly all system administrative disciplines these days, so we felt it was
appropriate to assume at least a basic level of familiarity with database concepts.
Managing Databases
While it isn’t within the scope of this book to teach you how to manage databases, it is
at least worth noting briefly some of the applications you could use to help with data‐
base management. There are many options, some of which are local client applica‐
tions running from your computer and connecting to the database, and others being
web-based applications that could be served from the same computer running the
database itself, thereby allowing you to connect remotely.
Some of the ones we’ve used include:
• phpMyAdmin
• MySQL Workbench
• Navicat (commercial)
In our examples we will be using the MySQL command line, not because it is supe‐
rior, but simply because it’s ubiquitous on any system with MySQL, so you’ve already
got it and have been using it in this book.
For more heavy-duty database design, the command line is probably not as powerful
as a well-designed GUI would be. Grab a copy of MySQL Workbench at least and give
it a whirl.
260