Asterisk Realtime Architektur
Buch - Scripte

 

/etc/asterisk/res_mysql.conf

[general]
dbhost = 127.0.0.1
dbname = astrealtime
dbuser = asteriskdb
pass = xxxx
dbport = 3306
dbsock = /var/run/mysqld/mysqld.sock

 

sip_users.sql

CREATE TABLE `sip_users` (
`id` int(11) NOT NULL auto_increment,
`name` varchar(80) NOT NULL default '',
`accountcode` varchar(20) default NULL,
`amaflags` varchar(20) default NULL,
`callgroup` varchar(10) default '1',
`callerid` varchar(80) default NULL,
`canreinvite` varchar(5) NOT NULL default 'no',
`context` varchar(80) default NULL,
`defaultip` varchar(15) default NULL,
`dtmfmode` varchar(10) default NULL,
`fromuser` varchar(80) default NULL,
`fromdomain` varchar(80) default NULL,
`fullcontact` varchar(80) default NULL,
`host` varchar(30) NOT NULL default 'dynamic',
`insecure` varchar(5) default NULL,
`language` varchar(5) default NULL,
`mailbox` varchar(50) default NULL,
`md5secret` varchar(80) default NULL,
`nat` varchar(5) default NULL,
`deny` varchar(80) default NULL,
`permit` varchar(80) default NULL,
`mask` varchar(80) default NULL,
`pickupgroup` varchar(10) default '1',
`port` varchar(5) default NULL,
`qualify` varchar(5) default NULL,
`restrictcid` varchar(5) default NULL,
`rtptimeout` varchar(5) default NULL,
`rtpholdtimeout` varchar(5) default NULL,
`secret` varchar(80) default NULL,
`type` varchar(6) NOT NULL default 'friend',
`username` varchar(80) default NULL,
`disallow` varchar(80) default 'all',
`allow` varchar(80) default 'ulaw;alaw;gsm',
`musiconhold` varchar(80) default NULL,
`regseconds` int(15) default NULL,
`ipaddr` varchar(15) default NULL,
`regexten` varchar(80) default NULL,
`cancallforward` varchar(5) default NULL,
`setvar` varchar(80) default NULL,
PRIMARY KEY (`id`),
UNIQUE KEY `name` (`name`),
KEY `name_2` (`name`)
) TYPE=MyISAM;

 

iax_users.sql

CREATE TABLE `iax_users` (
`name` varchar(30) NOT NULL default '',
`username` varchar(30) default NULL,
`type` varchar(6) NOT NULL default '',
`secret` varchar(50) default NULL,
`md5secret` varchar(80) default NULL,
`dbsecret` varchar(80) default NULL,
`notransfer` varchar(10) default NULL,
`inkeys` varchar(80) default NULL,
`outkeys` varchar(80) default NULL,
`auth` varchar(80) default NULL,
`accountcode` varchar(20) default NULL,
`amaflags` varchar(20) default NULL,
`callerid` varchar(80) default NULL,
`context` varchar(80) default NULL,
`defaultip` varchar(15) default NULL,
`host` varchar(31) NOT NULL default 'dynamic',
`language` char(2) default NULL,
`mailbox` varchar(50) default NULL,
`deny` varchar(95) default NULL,
`permit` varchar(95) default NULL,
`qualify` varchar(5) default NULL,
`disallow` varchar(80) default NULL,
`allow` varchar(80) default 'g729;ulaw;alaw;gsm',
`ipaddr` varchar(15) default NULL,
`port` int(5) default '0',
`regseconds` int(11) default '0',
PRIMARY KEY (`name`)
) TYPE=MyISAM;

 

extensions.sql

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(128) NOT NULL default '',
PRIMARY KEY (`context`,`exten`,`priority`),
KEY `id` (`id`)
) TYPE=MyISAM;

 

queues.sql

CREATE TABLE `queues` (
`name` varchar(80) NOT NULL default '',
`musiconhold` varchar(80) default NULL,
`strategy` varchar(80) default NULL,
`context` varchar(80) default NULL,
`timeout` int(11) default NULL,
`retry` int(11) default NULL,
`wrapuptime` int(11) default NULL,
`weight` int(11) default NULL,
`announce` varchar(80) default NULL,
`announce_frequency` int(11) default NULL,
`announce_round_seconds` int(11) default NULL,
`announce_holdtime` varchar(80) default NULL,
`queue_youarenext` varchar(80) default NULL,
`queue_thereare` varchar(80) default NULL,
`queue_callswaiting` varchar(80) default NULL,
`queue_holdtime` varchar(80) default NULL,
`queue_minutes` varchar(80) default NULL,
`queue_seconds` varchar(80) default NULL,
`queue_lessthan` varchar(80) default NULL,
`queue_thankyou` varchar(80) default NULL,
`queue_reporthold` varchar(80) default NULL,
`monitor_join` tinyint(1) default NULL,
`monitor_format` varchar(80) default NULL,
`maxlen` int(11) default NULL,
`servicelevel` int(11) default NULL,
`joinempty` varchar(80) default NULL,
`leavewhenempty` varchar(80) default NULL,
`eventmemberstatus` tinyint(1) default NULL,
`eventwhencalled` tinyint(1) default NULL,
`reportholdtime` tinyint(1) default NULL,
`memberdelay` int(11) default NULL,
`timeoutrestart` tinyint(1) default NULL,
PRIMARY KEY (`name`)
) TYPE=MyISAM;

 

queue_members.sql

CREATE TABLE `queue_members` (
`queue_name` varchar(128) NOT NULL default '',
`interface` varchar(128) NOT NULL default '',
`penalty` int(11) default NULL,
PRIMARY KEY (`queue_name`,`interface`)
) TYPE=MyISAM;

 

vm_users.sql

CREATE TABLE `vm_users` (
`uniqueid` int(11) NOT NULL auto_increment,
`customer_id` int(11) NOT NULL default '0',
`context` varchar(50) NOT NULL default '',
`mailbox` int(5) NOT NULL default '0',
`password` varchar(4) NOT NULL default '0',
`fullname` varchar(50) NOT NULL default '',
`email` varchar(50) NOT NULL default '',
`pager` varchar(50) NOT NULL default '',
`tz` varchar(10) NOT NULL default 'eastern',
`attach` varchar(4) NOT NULL default 'yes',
`saycid` varchar(4) NOT NULL default 'yes',
`dialout` varchar(10) NOT NULL default '',
`callback` varchar(10) NOT NULL default '',
`review` varchar(4) NOT NULL default 'no',
`operator` varchar(4) NOT NULL default 'no',
`envelope` varchar(4) NOT NULL default 'no',
`sayduration` varchar(4) NOT NULL default 'no',
`saydurationm` tinyint(4) NOT NULL default '1',
`sendvoicemail` varchar(4) NOT NULL default 'no',
`delete` varchar(4) NOT NULL default 'no',
`nextaftercmd` varchar(4) NOT NULL default 'yes',
`forcename` varchar(4) NOT NULL default 'no',
`forcegreetings` varchar(4) NOT NULL default 'no',
`hidefromdir` varchar(4) NOT NULL default 'yes',
`stamp` timestamp(14) NOT NULL,
PRIMARY KEY (`uniqueid`),
KEY `mailbox_context` (`mailbox`,`context`)
) TYPE=MyISAM;

 

/etc/asterisk/extconfig.conf

[settings]
sipusers => mysql,astrealtime,sip_userssip
peers => mysql,astrealtime,sip_users
voicemail => mysql,astrealtime,vm_users
queues => mysql,astrealtime,queues
queue_members => mysql,astrealtime,queue_members
extensions => mysql,astrealtime,extensions

 

/etc/asterisk/sip.conf

[general]
language=de
port=5060
context=default
canreinvite=no
tos=throughput
context=default

rtcachefriends=yes

 

/etc/asterisk/queues.conf

[general]
realtime_family=queues

 

/etc/asterisk/voicemail.conf

[general]
format=wav
serveremail=Asterisk
attach=yes
maxmessage=180
minmessage=3
maxsilence=10
charset=ISO-8859-1
fromstring=Asterisk Telefonanlage
pagerfromstring=Asterisk Telefonanlage

emailsubject=Neue Nachricht (${VM_MSGNUM}) in Mailbox von ${VM_CALLERID}
emailbody=Auf Ihrer Mailbox wurde eine neue Nachricht hinterlassen.\nDie Nachricht befindet sich im Anhang dieser E-Mail.

mailcmd=/usr/sbin/sendmail -t

[zonemessages]
eastern=Europa/Berlin|'vm-received' Q 'digits/at' kM

[default]

 

Beispiele für die /etc/asterisk/extensions.conf

[general]
static=yes
writeprotect=no

[default]
switch => Realtime/@extensions
switch => Realtime/mailbox@extensions
switch => Realtime/warteschleife@extensions

 

[general]
static=yes
writeprotect=no

[default]
switch => Realtime/@extensions
include => mailbox
include => warteschleife

[mailbox]
switch => Realtime/@extensions

[warteschleife]
switch => Realtime/@extensions

 

[macro-localsip]
exten => s,1,Set(LANGUAGE()=de)
exten => s,n,Dial(SIP/${ARG1},10,tT)
exten => s,n,Goto(s-${DIALSTATUS},1)
exten => s-NOANSWER,1,Voicemail(u${ARG1})
exten => s-NOANSWER,n,Hangup
exten => s-BUSY,1,Voicemail(b${ARG1})
exten => s-BUSY,n,Hangup

[default]
switch => Realtime/@extensions macro-localsip]