Configuring Asterisk 20 to Store PJSIP Endpoints in a Realtime Database

November 30, 2023
This article describes the configuration files necessary to alter in order to configure Asterisk 20 to store PJSIP endpoints in a database. /etc/odbcinst.ini: The default is likely fine. Ensure your choice of driver is listed. /etc/odbc.ini: Define the server IP/database/port. Use the driver you defined in odbcinst.ini. /etc/asterisk/res_odbc.conf: Define username/password. Use the DSN you defined in odbc.ini. /etc/asterisk/extconfig.conf: Define driver (ODBC in this example), database, and optionally table. Use the database you defined in res_odbc.conf. Note 1: "ext" stands for external, not extension. /etc/asterisk/sorcery.conf: Set up object mapping. Use the family you defined in extconfig.conf. Note 2: You can set up multiple object maps which are read in priority, if you want to store endpoint information in both a database and config files. Note 3: If you wish, you can combine multiple tables such as ps_auths, ps_endpoints, and ps_aors. This was not documented but we have tested it with success. sorcery.conf syntax would look something like the following:
auth=realtime,ps_authsendpointsaors
aor=realtime,ps_authsendpointsaors
endpoint=realtime,ps_authsendpointsaors
Further reading - Realtime Database Configuration Further reading - Asterisk Sorcery Configuration