System information

You may have noticed we used the same table for both the sippeers and sipusers. This
is because there will be a type field (just as if we were defining the type in the sip.conf
file) that will let us define a type of user, peer, or friend. If you unload chan_sip.so and
then load it back into memory (i.e., using module unload chan_sip.so followed by mod-
ule load chan_sip.so) after configuring extconfig.conf, you will be greeted with some
warnings telling you which columns you’re missing for the realtime table. Since we’ve
enabled sippeers and sipusers in extconfig.conf, we will get the following on the con-
sole (which has been trimmed due to space requirements):
WARNING: Realtime table ast_sipfriends@asterisk requires column
'name', but that column does not exist!
WARNING: Realtime table ast_sipfriends@asterisk requires column
'ipaddr', but that column does not exist!
WARNING: Realtime table ast_sipfriends@asterisk requires column
'port', but that column does not exist!
WARNING: Realtime table ast_sipfriends@asterisk requires column
'regseconds', but that column does not exist!
WARNING: Realtime table ast_sipfriends@asterisk requires column
'defaultuser', but that column does not exist!
WARNING: Realtime table ast_sipfriends@asterisk requires column
'fullcontact', but that column does not exist!
WARNING: Realtime table ast_sipfriends@asterisk requires column
'regserver', but that column does not exist!
WARNING: Realtime table ast_sipfriends@asterisk requires column
'useragent', but that column does not exist!
WARNING: Realtime table ast_sipfriends@asterisk requires column
'lastms', but that column does not exist!
As you can see, we are missing several columns from the table ast_sipfriends, which
we’ve defined as connecting to the asterisk object as defined in res_odbc.conf. The
next step is to create our ast_sipfriends table with all the columns listed by the warning
messages, in addition to the following: the type column, which is required to define
users, peers, and friends; the secret column, which is used for setting a password; and
the host column, which allows us to define whether the peer is dynamically registering
to us or has a static IP address. Table 16-3 lists all of the columns that should appear
in our table, and their types.
Table 16-3. Minimal sippeers/sipusers realtime table
Column name Column type
type Varchar 6
name Varchar 128
372 | Chapter 16:Relational Database Integration