Asterisk RealTime SIP
sip.conf Setup
You can keep any sip users in the flatfile AND use RealTime. How cool is that?Extconfig.conf Setup with Asterisk 1.6.1.1
Add the following line, swapping your own personal values if you wish:sipusers => mysql,general,sip_buddies
sippeers => mysql,general,sip_buddies
extensions => mysql,general,extensions_table
Database Config
put the following in res_mysql.conf
[general]
dbhost = 127.0.0.1
dbname = asterisk
dbuser = myuser
dbpass = mypass
dbport = 3306
Values in sip.conf or iax.conf like in older versions of * are no longer used.
Database Table
Lets create the table we need:NOTE: You can use any table name you wish, just make sure the table name matches what you have the family name bound to.
NOTE: General principles: the column names in your database table correspond to the option names in sip.conf. You do not have to have all option names defined in your table; you only have to define those columns you actually use in sip.conf. Exceptions to this are 'regserver' and 'regseconds', which the channel driver's realtime routines use for internal book-keeping. The 'name' field must also be present to hold equivalent of the [category name] in the sip.conf file. It is easily possible that different versions of Asterisk will require different tables. For instance, a 1.6 version of Asterisk would not use the "cancallforward", or 'restrictcid', or 'mask', or 'qualify', or "musiconhold" columns, but might require 'mohinterpret', 'mohsuggest', etc. etc. options instead. Options (column names) that not offered in sip.conf are ignored. Some options in sip.conf are OK to have multiple entries, but in a real-time database, Only one column is available. In these cases, you can add multiple values separated by semicolons. This occurs with setvar, allow/disallow, and permit/deny.
NOTE:Column order is important!! If you place "ipaddr" before "host" (in the case of dynamic), you will never load the public IP address of your sip device, as it will be overwritten when "host" is encountered. allow/disallow and permit/deny, the order of these statements is crucial in the config file, as they are applied in order. In the realtime db, the order is determined by the order of the columns in the table. You will note that the deny/disallow entries come before the allow/permit entries, to support the common usage of 'deny all', then permit '192.168.....'. ...