Asterisk RealTime IAX

Asterisk RealTime IAX


iax.conf Setup

You can keep any iax users in the flatfile AND use RealTime. How cool is that?

Extconfig.conf Setup

Add the following line, swapping your own personal values if you wish:


iaxusers => mysql,asterisk,iax_buddies
iaxpeers => mysql,asterisk,iax_buddies
(note: If you were using iaxbuddies, add an exact copy of your iaxbuddies line. Change one of them to iaxusers and the other to iaxpeers, that is all ther is to change to the new format.)


You can change mysql to odbc if you want to use odbc.
You can change asterisk to be the name of your database.
You can change iax_buddies to be the name of the voicemail table we will create below. <-- voicemail table?!!

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.


#
# Table structure for table `bit_iax_buddies`
#

CREATE TABLE iax_buddies (
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
);
CREATE UNIQUE INDEX iax_buddies_username_idx ON iax_buddies(username);

Originally written for mysql, the above should be pretty generic SQL except perhaps Oracle users may want to use VARCHAR2 :P

RoyK


NOTE: The index created on the column 'name' is because RealTime does its SELECT query using that column everytime. That column must also be unique.

You do not need every column listed above. If you wish, you can remove those columns you know you will never use. The columns in your tables should line up with the fields you would specify in the given entity declaration. If an entry would appear more than once, in the column it should be separated by a semicolon. For example, an entity that looks like:

[foo]
host=dynamic
secret=bar
context=default
context=local




could be stored in a table like this:


namehostsecretcontextipaddrportregseconds
foodynamicbardefault;local127.0.0.145691096954152




You do not need to insert the ipaddr, port or regseconds information. These columns will be updated periodicaly by RealTime.

However, if you are setting up an IAX peer, which you would use to dial calls out over, you will need to specify the port. Otherwise, Asterisk uses the default value from the table, which is 0, and calls will fail with auto-congestion.

Testing


Throw some data into the above table and try to register an extension. The /var/log/asterisk/debug should give info on any problems.

Cheers,
Matthew


More on RealTime IAX


This was a setup we did Mar 3, 2005, to place a call from our SIP Phone to our asterisk server, and
have it connect to another Asterisk Server, and then dial my home # (Hah, Vonage #).

Also note, we are 100% MySQL RealTime. We only use sip.conf & extensions.conf for static information.

Please also be aware, a the appdata setup is VERY CRITICAL. Most doc or lack thereof is misleading.

-- Table structure for table 'extensions'

DROP TABLE IF EXISTS extensions;
CREATE TABLE extensions (
  id int(11) NOT NULL auto_increment,
  context varchar(20) NOT NULL default '',
  exten varchar(20) NOT NULL default '',
  priority tinyint(4) NOT NULL default '0',
  app varchar(20) NOT NULL default '',
  appdata varchar(255) NOT NULL default '',
  KEY id (id)
) TYPE=MyISAM;

-- Dumping data for table 'extensions'

INSERT INTO extensions (id, context, exten, priority, app, appdata) VALUES (1,'sip_ps','_1XXXXXXXXXX',1,'Dial','IAX2/user@xxxx/${EXTEN}');
INSERT INTO extensions (id, context, exten, priority, app, appdata) VALUES (3,'sip_ps','4000',2,'Playback','vm-goodbye');
INSERT INTO extensions (id, context, exten, priority, app, appdata) VALUES (3,'sip_ps','4000',3,'Hangup','');

Note:
user = my username setup on the remote Asterisk Server
xxxx = the xxxx below within the iax.conf file

iax.conf file


;DB setup by Cipri
dbname = asterisk
dbhost = localhost
dbuser = asterisk
dbpass = mypassword

[xxxx]
type=peer
host=ipaddressofhost
auth=md5,cleartext
secret=mypassword


sip.conf file


;DB setup by Cipri
dbname = asterisk
dbhost = localhost
dbuser = asterisk
dbpass = mypassword


extconfig.conf file (necessary lines for DB connectivity)


sipusers => mysql,asterisk,sip
sippeers => mysql,asterisk,sip
extensions => mysql,asterisk,extensions

More soon ... As we plow down this road, we will post more critical setup information.
Just maybe our efforts can also help others.

Cipri Ilies & Dave Van Abel
http://vanabel.com
PS: We're new at adding doc here, so excuse our mess. We will get better over time. And you can count on us to always share (:rolleyes:)


Realtime Caching

RT Caching allows registered IAX friends to show up when you do a 'iax2 show peers', etc
It also generates manager events for those RT friends

iax.conf file


[general]
;Enables RT friend caching
rtcachefriends=yes


See Also

Asterisk RealTime IAX


iax.conf Setup

You can keep any iax users in the flatfile AND use RealTime. How cool is that?

Extconfig.conf Setup

Add the following line, swapping your own personal values if you wish:


iaxusers => mysql,asterisk,iax_buddies
iaxpeers => mysql,asterisk,iax_buddies
(note: If you were using iaxbuddies, add an exact copy of your iaxbuddies line. Change one of them to iaxusers and the other to iaxpeers, that is all ther is to change to the new format.)


You can change mysql to odbc if you want to use odbc.
You can change asterisk to be the name of your database.
You can change iax_buddies to be the name of the voicemail table we will create below. <-- voicemail table?!!

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.


#
# Table structure for table `bit_iax_buddies`
#

CREATE TABLE iax_buddies (
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
);
CREATE UNIQUE INDEX iax_buddies_username_idx ON iax_buddies(username);

Originally written for mysql, the above should be pretty generic SQL except perhaps Oracle users may want to use VARCHAR2 :P

RoyK


NOTE: The index created on the column 'name' is because RealTime does its SELECT query using that column everytime. That column must also be unique.

You do not need every column listed above. If you wish, you can remove those columns you know you will never use. The columns in your tables should line up with the fields you would specify in the given entity declaration. If an entry would appear more than once, in the column it should be separated by a semicolon. For example, an entity that looks like:

[foo]
host=dynamic
secret=bar
context=default
context=local




could be stored in a table like this:


namehostsecretcontextipaddrportregseconds
foodynamicbardefault;local127.0.0.145691096954152




You do not need to insert the ipaddr, port or regseconds information. These columns will be updated periodicaly by RealTime.

However, if you are setting up an IAX peer, which you would use to dial calls out over, you will need to specify the port. Otherwise, Asterisk uses the default value from the table, which is 0, and calls will fail with auto-congestion.

Testing


Throw some data into the above table and try to register an extension. The /var/log/asterisk/debug should give info on any problems.

Cheers,
Matthew


More on RealTime IAX


This was a setup we did Mar 3, 2005, to place a call from our SIP Phone to our asterisk server, and
have it connect to another Asterisk Server, and then dial my home # (Hah, Vonage #).

Also note, we are 100% MySQL RealTime. We only use sip.conf & extensions.conf for static information.

Please also be aware, a the appdata setup is VERY CRITICAL. Most doc or lack thereof is misleading.

-- Table structure for table 'extensions'

DROP TABLE IF EXISTS extensions;
CREATE TABLE extensions (
  id int(11) NOT NULL auto_increment,
  context varchar(20) NOT NULL default '',
  exten varchar(20) NOT NULL default '',
  priority tinyint(4) NOT NULL default '0',
  app varchar(20) NOT NULL default '',
  appdata varchar(255) NOT NULL default '',
  KEY id (id)
) TYPE=MyISAM;

-- Dumping data for table 'extensions'

INSERT INTO extensions (id, context, exten, priority, app, appdata) VALUES (1,'sip_ps','_1XXXXXXXXXX',1,'Dial','IAX2/user@xxxx/${EXTEN}');
INSERT INTO extensions (id, context, exten, priority, app, appdata) VALUES (3,'sip_ps','4000',2,'Playback','vm-goodbye');
INSERT INTO extensions (id, context, exten, priority, app, appdata) VALUES (3,'sip_ps','4000',3,'Hangup','');

Note:
user = my username setup on the remote Asterisk Server
xxxx = the xxxx below within the iax.conf file

iax.conf file


;DB setup by Cipri
dbname = asterisk
dbhost = localhost
dbuser = asterisk
dbpass = mypassword

[xxxx]
type=peer
host=ipaddressofhost
auth=md5,cleartext
secret=mypassword


sip.conf file


;DB setup by Cipri
dbname = asterisk
dbhost = localhost
dbuser = asterisk
dbpass = mypassword


extconfig.conf file (necessary lines for DB connectivity)


sipusers => mysql,asterisk,sip
sippeers => mysql,asterisk,sip
extensions => mysql,asterisk,extensions

More soon ... As we plow down this road, we will post more critical setup information.
Just maybe our efforts can also help others.

Cipri Ilies & Dave Van Abel
http://vanabel.com
PS: We're new at adding doc here, so excuse our mess. We will get better over time. And you can count on us to always share (:rolleyes:)


Realtime Caching

RT Caching allows registered IAX friends to show up when you do a 'iax2 show peers', etc
It also generates manager events for those RT friends

iax.conf file


[general]
;Enables RT friend caching
rtcachefriends=yes


See Also

Created by: utdrmac, Last modification: Mon 11 of Jun, 2012 (03:07 UTC) by admin
Please update this page with new information, just login and click on the "Edit" or "Discussion" tab. Get a free login here: Register Thanks! - Find us on Google+