Asterisk Realtime Database Creation

Hi, I am trying to set up an asterisk [16] system with MySQL on CentOS 6. The purpose is to set up a realtime lookup for sip extensions and also dial plan instead of using the config files.

I would like to understand if the tables that store sip peers and users need to be created manually or is there a recommended table structure we would need to follow? Thanks

If you are setting this up from new, you should be using chan_pjsip, not chan_sip! Some information for that can be found at https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime, but I haven’t used realtime myself, so cannot be sure that the information is correct and complete.

Normally with chan_sip, you should only have SIP peers. Users are often used because of old cook book configurations and a mistaken belief that you must have separate entries for inbound and outbound. Whilst there are rare cases when friend or user are appropriate, in must cases they offer no advantage, and can result in unwanted behaviours.

Generally, if you are using real time, it is because you want to make frequent changes, so you should be more interested in the mechanisms for changing the data, that in those for initially loading it.

There is a tool out there which helps you create the tables. I used this to create all the tables in a blank database so they wouldn’t affect my existing database. When I need one of these tables I just copy the table over to my live database, works great.

The tool I used was called Alembic. There is some info and instructions here https://wiki.asterisk.org/wiki/display/AST/Setting+up+PJSIP+Realtime#SettingupPJSIPRealtime-CreatingtheMySQLDatabase

There are blank table structures as SQL dumps in /contrib/realtime/mysql, which you just need to import into your database.
No need to install all that alembic Python dependencies :wink:

I looked for these, knew they existed but couldn’t find them. Thanks…

and Yes, I agree… Better than using Alembic.

Thank you for the inputs. I had to create the tables manually.