IAX2 Realtime

In this post I´m going to configure Asterisk iax2 extensions in realtime mode. In this way we don’t have to reload our Asterisk when We have to do any change in our extensions configuration.

1. Configuring extconfig.conf


iaxusers => mysql,asterisk,iax_users

iaxpeers => mysql,asterisk,iax_users

2. Creating table

We are going to create the iax table in our asterisk database https://sysbrain.wordpress.com/2009/11/23/asterisk-cdr-in-mysql/

CREATE TABLE iax_users (name varchar(30) primary key NOT NULL, username varchar(30), type varchar(6) NOT NULL, secret varchar(50), md5secret varchar(32), dbsecret varchar(100), notransfer varchar(10), inkeys varchar(100), outkey varchar(100), auth varchar(100), accountcode varchar(100), amaflags varchar(100), callerid varchar(100), context varchar(100), defaultip varchar(15), host varchar(31) NOT NULL default 'dynamic', language char(5), mailbox varchar(50), deny varchar(95), permit varchar(95), qualify varchar(4), disallow varchar(100), allow varchar(100), ipaddr varchar(15), port integer default 0, regseconds integer default 0  );

After this, we have to reload Asterisk to apply the changes.

3. Creating users

We can create users trough MySQL CLI (tricky) or doing it with MySQL graphical tools (the best option).

Example in CLI mode:

INSERT INTO `iax_users` (`id`, `name`, `username`, `type`, `secret`, `md5secret`, `dbsecret`, `notransfer`, `inkeys`, `outkey`, `auth`, `accountcode`, `amaflags`, `callerid`, `context`, `defaultip`, `host`, `language`, `mailbox`, `deny`, `permit`, `qualify`, `disallow`, `allow`, `ipaddr`, `port`, `regseconds`) VALUES (1, ‘1000’, ‘1000’, ‘friend’, ‘1000’, NULL, NULL, NULL, NULL, NULL, NULL, NULL, NULL, ‘Javi’, ‘u-moviles’, NULL, ‘dynamic’, NULL, mail@mail.com, NULL, NULL, ‘yes’, ‘all’, ‘gsm’, NULL, 0, 0);

Graphical Mode:

This is the link to download Mysql Gui tools:


It’s not necessary to post a example about create user with MySQL GUI because is very easy to manage tables and add new users.

You’ve to connect to asterisk database trough MySQL Query Browser app, edit iax_users table and insert the same data as in the previous example:

name (1000), username (1000), type (friend), secret(1000), callerid(javi), context(u-moviles), host(dynamic), disallow(all), allow(gsm)

The other fields are optional although I also use the ‘mailbox’ field:

`md5secret`, `dbsecret`, `notransfer`, `inkeys`, `outkey`, `auth`,`accountcode`, `amaflags`, `defaultip`,`language`, `mailbox`, `deny`, `permit` `ipaddr`, `port`, `regseconds`.

In the next Asterisk articles, I´ll post about SIP realtime, voicemail realtime and Microsoft Exchange calendar integration.

That’ s all!


Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s

%d bloggers like this: