Page 305 - Asterisk™: The Future of Telephony
P. 305
Repeat the previous line and change the VALUES for all entries you wish to have in the
database. You can view the data in the ast_hotdesk table by running a simple SELECT
statement from the PostgreSQL console:
asterisk=> SELECT * FROM ast_hostdesk;
which would give you something like the following output:
| id | extension | first_name | last_name | cid_name | cid_number | pin
|---+-----------+------------+----------------+-----------------+-------------+----
| 1 | 1101 | "Leif" | "Madsen" | "Leif Madsen" | "4165551101" | "555"
| 2 | 1102 | "Jim" | "Van Meggelen" | "Jim Van Meggelen" | "4165551102" | "556"
| 3 | 1103 | "Jared" | "Smith" | "Jared Smith" | "4165551103" | "557"
| 4 | 1104 | "Mark" | "Spencer" | "Mark Spencer" | "4165551104" | "558"
| 5 | 1105 | "Kevin" | "Fleming" | "Kevin Fleming" | "4165551105" | "559"
| context | status | location |$
+-----------------+---------+----------+
| "longdistance" | "TRUE" | "desk_1" |
| "longdistance" | "FALSE" | "" |
| "local" | "FALSE" | "" |
| "international" | "FALSE" | "" |
| "local" | "FALSE" | "" |
We’ve got the condiments now, so let’s get to our dialplan. This is where the magic is
going to happen.
Before you start typing, take note that we have placed all of the sample
text that follows in appendix H, so while we encourage you to follow
us along through the examples, you can also see what it all looks like as
a whole, by checking the appendix (and by copying and pasting, if you
have an electronic version of this book).
Somewhere in extensions.conf we are going to have to create the [hotdesk] context. To
start, let’s define a pattern-match extension that will allow the users to log in:
; extensions.conf
; Hot Desking Feature
[hotdesk]
; Hot Desk Login
exten => _110[1-5],1,NoOp()
exten => _110[1-5],n,Set(E=${EXTEN})
exten => _110[1-5],n,Verbose(1|Hot Desk Extension ${E} is changing status)
exten => _110[1-5],n,Verbose(1|Checking current status of extension ${E})
exten => _110[1-5],n,Set(${E}_STATUS=${HOTDESK_INFO(status,${E})})
exten => _110[1-5],n,Set(${E}_PIN=${HOTDESK_INFO(pin,${E})})
We’re not done writing this extension yet, but let’s pause for a moment and see where
we’re at so far.
When a sales agent sits down at a desk, they log in by dialing their own extension
number. In this case we have allowed the 1101 through 1105 extensions to log in with
Getting Funky with func_odbc: Hot-Desking | 277