Page 303 - Asterisk™: The Future of Telephony
P. 303
While using an external script to interact with a database (from which
a flat file is created that Asterisk would read) has advantages (if the
database went down, your system would continue to function and the
script would simply not update any files until connectivity to the data-
base was restored), a major disadvantage is that any changes you make
to a user are not available until you run the update script. This is prob-
ably not a big issue on small systems, but on large systems, waiting for
changes to take effect can cause issues, such as pausing a live call while
a large file is loaded and parsed.
You can relieve some of this by utilizing a replicated database system.
In the version of Asterisk following 1.4 (currently trunk), the syntax of
the func_odbc.conf file changes slightly, but gives the ability to failover
to another database system. This way you can cluster the database
backend utilizing a master-master relationship (pgcluster; Slony-II), or
a master-slave (Slony-I) replication system.
In order to get you into the right frame of mind for what follows, we want you to picture
a Dagwood sandwich. §
Can you relay the total experience of such a thing by showing someone a picture of a
tomato, or by waving a slice of cheese about? Not hardly. That is the conundrum we
faced when trying to give a useful example of why func_odbc is so powerful. So, we
decided to build the whole sandwich for you. It’s quite a mouthful, but after a few bites
of this, peanut butter and jelly is never going to be the same.
For our example, we decided to implement something that we think could have some
practical uses. Let’s picture a small company with a sales force of five people who have
to share two desks. This is not as cruel as it seems, because these folks spend most of
their time on the road, and they are each only in the office for at most one day each week.
Still, when they do get into the office, they’d like the system to know which desk they
are sitting at, so that their calls can be directed there. Also, the boss wants to be able
to track when they are in the office, and control calling privileges from those phones
when no one is there.
This need is typically solved by what is called a hot-desking feature, so we have built
one for you in order to show you the power of func_odbc.
Lets start with the easy stuff, and create two desktop phones in the sip.conf file.
; sip.conf
; HOT DESK USERS
[desk_1]
type=friend
host=dynamic
secret=my_special_secret
context=hotdesk
§ And if you don’t know what a Dagwood is, that’s what Wikipedia is for. I am not that old.
Getting Funky with func_odbc: Hot-Desking | 275