Page 304 - Asterisk™: The Future of Telephony
P. 304
qualify=yes
[desk_2]
type=friend
host=dynamic
secret=my_special_secret
context=hotdesk
qualify=yes
; END HOT DESK USERS
These two desk phones both enter the dialplan at the [hotdesk] context in exten
sions.conf. If you want to have these devices actually work, you will of course need to
set the appropriate parameters in the devices themselves, but we’ve covered all that in
Chapter 4.
That’s all for sip.conf. We’ve got two slices of bread. Hardly a sandwich yet.
Now let’s get the database part of it set up (we are assuming that you have an ODBC
database created and working as outlined in the earlier parts of this chapter). First,
connect to the database console like so:
# su - postgres
$ psql -U asterisk -h localhost asterisk
Password:
Then create the table with the following bit of code:
CREATE TABLE ast_hotdesk
(
id serial NOT NULL,
extension int8,
first_name text,
last_name text,
cid_name text,
cid_number varchar(10),
pin int4,
context text,
status bool DEFAULT false,
"location" text,
CONSTRAINT ast_hotdesk_id_pk PRIMARY KEY (id)
)
WITHOUT OIDS;
After that, we populated the database with the following information (some of the
values that you see actually would change only after the dialplan work is done, but we
have it in here by way of example). At the PostgreSQL console, run the following
commands:
asterisk=> INSERT INTO ast_hotdesk ('extension', 'first_name', 'last_name', 'cid_name',
'cid_number', 'pin', 'context', 'location') \
VALUES (1101, 'Leif', 'Madsen', 'Leif Madsen', '4165551101', '555', 'longdistance',
'desk_1');
276 | Chapter 12: Relational Database Integration