問題描述:A2Billing 預設是以 Asterisk Realtime Mode 與 Asterisk 作連結,但若沒有經過一些設定,會使兩者的設定無法同步。
為何要使用 Realtime Mode:
軟體版本:A2Billing 1.7.x, 1.9.x
// 檢查 asterisk 有無啟動以下的模組,res_config_mysql.so, res_realtime.so。
$ asterisk -rx "module show like res" Module Description Use Count ... res_config_mysql.so MySQL RealTime Configuration Driver 0 res_realtime.so Realtime Data Lookup/Rewrite 0
// 編輯 /etc/asterisk/res_mysql.conf
// 增加這幾行
... [mya2b] dbhost = 127.0.0.1 dbname = mya2billing dbuser = a2billinguser dbpass = a2billing dbport = 3306 dbsock = /var/lib/mysql/mysql.sock ; NOTE! If running Asterisk 1.6 or later add the following line requirements = warn
TIPS:
* dbname,dbuser,dbpass 可以參考 /etc/asterisk/a2billing.conf
// 編輯 /etc/asterisk/extconfig.conf
[settings] ;This is used for A2B realtime mode sipusers => mysql,mya2b,cc_sip_buddies sippeers => mysql,mya2b,cc_sip_buddies iaxusers => mysql,mya2b,cc_iax_buddies iaxpeers => mysql,mya2b,cc_iax_buddies
Tips:
For Asterisk 1.6.x+,mya2b 必須是 res_mysql.conf 的定義名稱。
For Asterisk 1.4.x,mya2b 必須是實際的資料庫名稱,例如是 mya2billing。
// 設定 A2B
A2B Admin > SYSTEM SETTINGS > Global List > Select Group: global
use_realtime = yes
[ast18] dbhost = 127.0.0.1 dbname = asterisk dbuser = astuser dbpass = mypass dbport = 3306 dbsock = /var/run/mysqld/mysql.sock ;for ubuntu requirements=warn ; or createclose or createchar
[settings] ;This is used for Asterisk realtime mode sipusers => mysql,ast18,sip_buddies sippeers => mysql,ast18,sip_buddies
# # Table structure for table `sip_buddies` # CREATE TABLE `sip_buddies` ( `id` int(11) NOT NULL auto_increment, `name` varchar(80) NOT NULL default '', `host` varchar(31) NOT NULL default '', `nat` varchar(5) NOT NULL default 'no', `type` enum('user','peer','friend') NOT NULL default 'friend', `accountcode` varchar(20) default NULL, `amaflags` varchar(13) default NULL, `call-limit` smallint(5) unsigned default NULL, `callgroup` varchar(10) default NULL, `callerid` varchar(80) default NULL, `cancallforward` char(3) default 'yes', `canreinvite` char(3) default 'yes', `context` varchar(80) default NULL, `defaultip` varchar(15) default NULL, `dtmfmode` varchar(7) default NULL, `fromuser` varchar(80) default NULL, `fromdomain` varchar(80) default NULL, `insecure` varchar(4) default NULL, `language` char(2) default NULL, `mailbox` varchar(50) default NULL, `md5secret` varchar(80) default NULL, `deny` varchar(95) default NULL, `permit` varchar(95) default NULL, `mask` varchar(95) default NULL, `musiconhold` varchar(100) default NULL, `pickupgroup` varchar(10) default NULL, `qualify` char(3) default NULL, `regexten` varchar(80) default NULL, `restrictcid` char(3) default NULL, `rtptimeout` char(3) default NULL, `rtpholdtimeout` char(3) default NULL, `secret` varchar(80) default NULL, `setvar` varchar(100) default NULL, `disallow` varchar(100) default 'all', `allow` varchar(100) default 'g729;ilbc;gsm;ulaw;alaw', `fullcontact` varchar(80) NOT NULL default '', `ipaddr` varchar(15) NOT NULL default '', `port` smallint(5) unsigned NOT NULL default '0', `regserver` varchar(100) default NULL, `regseconds` int(11) NOT NULL default '0', `lastms` int(11) NOT NULL default '0', `username` varchar(80) NOT NULL default '', `defaultuser` varchar(80) NOT NULL default '', `subscribecontext` varchar(80) default NULL, `useragent` varchar(20) default NULL, PRIMARY KEY (`id`), UNIQUE KEY `name` (`name`) ) ENGINE=MyISAM ROW_FORMAT=DYNAMIC;