System information
Additional options in sip.conf exist for realtime peers. These are defined in the
[general] section and described in Table 16-5.
Table 16-5. Realtime options in sip.conf
Configuration option Description
rtcachefriends Caches peers in memory on an as-needed basis after they have contacted the server. That is, on Asterisk
start, the peers are not loaded into memory automatically; only after a peer has contacted the server
(e.g., via a registration or phone call) is it loaded in memory. Values are yes or no.
rtsavesysname When a peer registers to the system, saves the systemname (as defined in asterisk.conf) into the
regserver field within the database. (See “Setting the systemname for Globally Unique
IDs” on page 375 for more information.) Using regserver is useful when you have multiple servers
registering peers to the same table. Values are yes or no.
rtupdate Sends registration information such as the IP address, the origination port, the registration period,
and the username of the user-agent to the database when a peer registers to Asterisk. Values are
yes or no, and the default is yes.
rtautoclear Automatically expires friends on the same schedule as if they had just registered. This causes a peer
to be removed from memory when the registration period has expired, until that peer is requested
again (e.g., via registration or placing a call). Values are yes, no, or an integer value that causes the
peers to be removed from memory after that number of seconds instead of the registration interval.
ignoreregexpire When enabled, peers are not removed from memory when the registration period expires. Instead,
the information is left in memory so that if a call is requested to an endpoint that has an expired
registration, the last known information (IP address, port, etc.) will be tried.
After enabling rtcachefriends=yes in sip.conf and reloading chan_sip.so (using module
reload chan_sip.so), you can register your peer to Asterisk using realtime, and the peer
should then be populated into memory. You will be able to verify this by executing the
sip show peers command on the Asterisk console:
Name/username Host Dyn Port Status Realtime
0000FFFF0008/0000FFFF0008 172.16.0.160 D 5060 Unmonitored Cached RT
If you were to look at the table in the database directly, you would see something
like this:
+--------+--------------+---------+-----------+---------+--------------+
| type | name | secret | context | host | ipaddr |
+--------+--------------+---------+-----------+---------+--------------+
| friend | 0000FFFF0008 | welcome | LocalSets | dynamic | 172.16.0.160 |
+--------+--------------+---------+-----------+---------+--------------+
+------+------------+--------------+-------------------------------------+
| port | regseconds | defaultuser | fullcontact |
+------+------------+--------------+-------------------------------------+
| 5060 | 1283928895 | 0000FFFF0008 | sip:0000FFFF0008@172.16.0.160:52722 |
+------+------------+--------------+-------------------------------------+
+-----------+-----------------+--------+
| regserver | useragent | lastms |
+-----------+-----------------+--------+
| NULL | Zoiper rev.6739 | 0 |
+-----------+-----------------+--------+
374 | Chapter 16: Relational Database Integration