??xml version="1.0" encoding="utf-8" standalone="yes"?> First, create a file called /tmp/exclude and add the following lines to it: .bash_history lost+found /dev/* /mnt/* /tmp/* /proc/* /sys/* /usr/src/* scp /tmp/centos-5.7-x86_64-elasitx_orig-image.tar.gz root@ip:/var/lib/vz/template/iso cd dev mknod dev/null c 1 3 mknod -m 644 dev/random c 1 8 mknod dev/urandom c 1 9 blacklist net-pf-10 Disable any physical NICs by modifying the etc/sysconfig/network-scripts/ifcfg-ethX files (where X is the interface number starting from 0) and setting ONBOOT to no. Check etc/sysconfig/init to see if PROMPT=yes, and then change to no. Otherwise when startup init script rc will enter interactive mode and wait there forever vzctl set 100 --devnodes dahdi/pseudo:rw --save
]]>
然后
$ext->add($context, $exten, '', new ext_dial('${OUT_${DIAL_TRUNK}}/${OUTNUM}', '300,${DIAL_TRUNK_OPTIONS}')); // Regular Trunk Dial
$ext->add($context, $exten, 'skipoutnum', new ext_dial('${pre_num:4}${the_num}${post_num}', '300,${DIAL_TRUNK_OPTIONS}'));
300 Ҏ你自p|的旉
]]>
apt-get -y update
apt-get -y makedev
apt-get -y install build-essential make pve-headers-`uname -r`
cd /usr/src/
wget http://downloads.digium.com/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
tar zxfv dahdi-linux-complete-current.tar.gz
cd dahdi-linux-complete-*
make all
make install
make config
mkdir /etc/asterisk
service dahdi start
dahdi_genconf
vi /etc/dahdi/modules 全部?h?br />
sed -i 's|ipt_REJECT ipt_tos ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length|ipt_REJECT ipt_tos ipt_TOS ipt_LOG ip_conntrack ipt_limit ipt_multiport iptable_filter iptable_mangle ipt_TCPMSS ipt_tcpmss ipt_ttl ipt_length ipt_state iptable_nat ip_nat_ftp|' /etc/vz/vz.conf
/etc/init.d/vz restart
//用ipv6
/boot/grub/grub.cfg ?linux /vmlinuz-2.6.32-16-pve root=/dev/mapper/pve-root ro quiet 替换?linux /vmlinuz-2.6.32-16-pve root=/dev/mapper/pve-root ro ipv6.disable=1 quiet
在elastix2.3机器?参?http://wiki.openvz.org/Creating_a_CentOS_5.0_Template
tar --numeric-owner -czvf /tmp/centos-5.7-x86_64-elasitx_orig-image.tar.gz -X /tmp/exclude /
回到proxmox ve 机器 使用 web?strong>centos-5.7-x86_64-elasitx_orig-image 为模板创建vt虚拟?nbsp; 假设 vm id ?100
ssh ?proxmox ve
cd /var/lib/vz/private/100
Edit the etc/inittab file and comment out the lines that respawn /sbin/mingetty on tty1 through tty6. Just put a # at the beginning of the line.
?etc/inittab 文g最后面加入
1:2345:respawn:/sbin/agetty tty1 38400 linux
Remove the etc/mtab file and then create a symbolic link by typing ln -s /proc/mounts etc/mtab
Remove all of the lines from etc/fstab except for the line that mounts /dev/pts
Edit etc/rc.d/rc.sysinit and comment out the line that starts /sbin/start_udev by placing a # at the beginning of the line.
mknod dev/ptmx c 5 2
mkdir dev/pts
/sbin/MAKEDEV ttyp ptyp
cd ../
mknod dev/tty9 c 4 9
Create the var/lock/rpm folder.
Edit etc/sysconfig/network and set NETWORKING_IPV6 to no.
Add the following lines to etc/modprobe.d/blacklist.conf:
blacklist ipv6
vzctl start 100
vzctl enter 100
chkconfig haldaemon off
chkconfig dahdi off
chkconfig wanrouter off
rm -rf /etc/init.d/dahdi
rm -rf /etc/init.d/wanrouter
chkconfig acpid off
chkconfig kudzu off
chkconfig xfs off
chkconfig rpcidmapd off
chkconfig rpcgssd off
chkconfig nfslock off
chkconfig mdmonitor off
chkconfig ip6tables off
exit
cd /var/lib/vz/private/100
tar -czvf /var/lib/vz/template/cache/centos-5-x86_64-elasitx.tar.gz ./
]]>
A2Billing 是目前社開發最熱門的計ȝi套Ӟ因為是開攑֎始碼授權所以可以合法免M用?/p>
本篇主要在是教導如何使用這套Ӟ若還沒完成安裝的朋友Q請先前往p A2Billing 安裝?/a>?/p>
pȝ在完成安裝後Q第一個所要做的設定有Q?/p>
// FreePBX UI > Trunks
新增 Outbound TrunkQ本以 Voxalot Z?/p>
Outgoing Settings
Trunk Name = voxalot
host=us.voxalot.com username=<sip_number> fromuser=<sip_number> secret=<sip_pass> fromdomain=voxalot.com nat=yes insecure=port,invite qualify=yes canreinvite=yes dtmfmode=auto disallow=all allow=ulaw&alaw type=peer context=from-trunk
新增 Inbound TrunkQ這個主要在展示國際電話卡及 DID 轉接的應用,本篇?iptel Z?/p>
Outgoing Settings
Trunk Name: iptel
username=<sip_username> type=friend secret=<sip_pass> qualify=yes insecure=port,invite host=iptel.org fromuser=osslab fromdomain=iptel.org context=a2billing
Register String: <sip_username>:<sip_pass>@iptel.org/<sip_number>
注意Qcontext 必須?a2billing
// A2Billing Admin UI > Trunk > Create Provider
provider name = VOXALOT_PROVIDER
description = Voxalot Provider
// A2Billing Admin UI > Trunk > Add Trunk
voip-provider = VOXALOT_PROVIDER
label = VOXALOT_TRUNK
add prefix = I白
provider tech = SIP
provider ip = voxalot
status = Active
TIPs:
provider ip 必須?FreePBX ?trunk name 相同
// A2Billing Admin UI > Ratecard > Create call plan
name = VOXALOT_CALLPLAN
remove inter prefix = YES
TIPs:
remove inter prefix = YES 若撥號有包含 00 ?011 開頭的國際冠|在套?ratecard 的規則前會被去除?/p>
// A2Billing Admin UI > Ratecard > Create new ratecard
tariffname = VOXALOT_RATECARD
trunk = VOXALOT_TRUNK
description = through voxalot trunk
// A2Billing Admin UI > Ratecard > Add Rate
ratecard = VOXALOT_RATECARD
dialprefix = 1800
destination = US-Tollfree
buying rate = 1
buyrate min duration = 6
buyrate billing block = 6
selling rate = 1.5
sellrate min duration = 60
sellrate billing block = 60
trunk = VOXALOT_TRUNK
TIPs:
Q?dialprefix 若撥號規則符合,會以此費率計?br />Q?destination 用來敘述此費率的區?/p>
//新增 rate 後要再回?call plan ?rate card 加入?call plan
A2Billing Admin UI > Ratecard > List Call Plan > Edit: VOXALOT_CALLPLAN
ratecard = 選擇 VOXALOT_RATECARD, Add Ratecard
客戶操作程Q?br />① 使用手機或一般電話機撥打pȝ號碼(Access Number)
② 語音提示Q入電話卡號+Q?/p>
③ 語音提示額Q入目的地電話號碼Q?0Q國|區|電話號碼Q#Q?/p>
// A2Billing Admin UI > Customers > Create Customers
card number = <隨機產生>
card alias = <隨機產生>Qweb d希
webui password = <隨機產生>Qweb d密碼
balance = 50.0Q不可為Ӟ且必須以 USD a算
call plan = VOXALOT_CALLPLAN
activated = YES
simultaneous access = INDIVIDUAL ACCESS
card type = PREPAID CARD
country = TAIWAN
sip account = NO
iax account = NO
實際操作Q?/p>
因為本篇實做是以 iptel 的號g為系ip|所以用其他 IPTel 希撥入pȝ號碼Q系i會提示語音Q請輸入 card numberQ將剛剛新增的卡號入,完成後按Q,若正,pȝ會提C餘及可用通話時間Q並提示Q請輸入目的地電p|完整電p?011 + 國碼 + 區?+ 電話號碼 輸入Q完成後按#?/p>
TIPs:
Q?新增電話?Customer)Q有一些主要的a定Q例?card number, card alias, passwordQ這些是由pȝ隨機產生Q且沒有M規則Qhacker 無法事先a算出這些資訊?br />Q?附加?card number ?另一i代?aliasQ這個號或 email 地址都可以用來登入用戶的E頁Q密就?webui password?
Q?若用戶撥號時有加 00Q請注意 Call Plan ?REMOVE INTER PREFIX a為 YESQ以避免 outbound 路由錯誤?/p>
A2Billing 提供 DID 接駁至經?outbound trunk 的外部號{SIP URI?/p>
// A2Billing Admin UI > DID > Add DID Group
name = DID TWN
// A2Billing Admin UI > DID > Add DID
DID = 99474
billing = only dialout rate
DID group = DID TWN
country = TAIWAN
activated = YES
monthly rate = 0
// A2Billing Admin UI > Customers > Create Customers
balance = 50.0
call plan = VOXALOT_CALLPLAN
didgroup = DID TWN
activated = YES
card type = PREPAID CARD
country = TAIWAN
sip account = NO
iax account = NO
a定轉接的目的號|可以透過 Admin UI ?Customer UI 來作
客戶自行D DID 號碼
// A2Billing Customer UI > DID
select country = TAIWAN
select virtual phone number = 99474
voip call = NO
destination = 8864123456
TIPs:
Q?select country 這內容會與 DID ?country 相同
Q?若沒有出?DID number 可選擇,請檢查所d?customer 希?DIDGROUP 是否正確
Q?voip call 若是 NOQ入外部的 PSTN/SIP 號碼Q若?YESQ?SIP URI?/p>
理員分?DID 號碼i指定的客戶
// A2Billing Admin UI > INBOUND DID > Destination
destination = 8864123456
customer ID = 選擇適當?customer
DID = 選擇適當?DID
activated = yes
validated = 皆可
voip_call = no
TIPs:
Q?voip call 若是 NOQ入外部的 PSTN/SIP 號碼Q若?YESQ?SIP URI?/p>
Q?若需 DID 接入內部分機號碼(不經?A2B ?trunk)Q可以這樣a?br />-- destination = Local/101@from-internal (適用 FreePBX 的分?101)
-- destination = SIP/123456 (適用 A2Billing card number 123456)
-- voip_call = yes* 如果 destination number 要走 A2B ?trunkQ不該 trunk ?SIP ?ZaptelQvoip_call 必須?no?/p>
盔R文章連結Q?/p>
用戶操作程Q?br />① 用戶使用 X-Lite ?ATA a備透過E\ad為分?/p>
② 直接撥目的地電話號碼Q例?886+XXXXXXXXQ?86 是國{?br />過程中不會有M外的提C音Q就像一般的 SIP 分機操作相同?/p>
// A2Billing Admin UI > Customers > Create Customers
card number = <隨機產生>
card alias = <隨機產生>Qweb d希
webui password = <隨機產生>Qweb d密碼
balance = 50.0Q不可為Ӟ且必須以 USD a算
call plan = VOXALOT_CALLPLAN
activated = YES
simultaneous access = INDIVIDUAL ACCESS
card type = PREPAID CARD
country = TAIWAN
sip account = YES
iax account = YES
TIPs:
Q?這?應用一)模式a定相同Q只差在 sip/iax account ?YES?br />Q?新增 customer 後,?reload Asterisk 後,SIP 用戶端才能註冊用?/p>
// 取消 "輸入目的地號? 及其他提C音
// A2Billing Admin UI > System Settings > Global List
如果這的所有項目沒?GROUP ?agi-conf2 ?可善?GROUP 搜尋功能)Q請先前往 Add agi-conf > CREATE AGI-CONF2?/p>
回到 Global List 扑ֈ GROUP ?agi-conf2 ?KEY/VALUE 按以下所qC改:
use_dnid = yes
這個SIP希除了要撥外部的\由外Q如果還要撥內部的其?SIP 分機號,需要繼U下面的修改Q?/p>
sip_iax_friends = yes
sip_iax_pstn_direct_call_prefix = 555
sip_iax_pstn_direct_call = yes
※是否要提C餘的語音
say_balance_after_auth = no
say_timetocall = no
如果電話不通,不要提示輸入目的地號的語音
number_try = 1
TIPs:
Q?參數說明Q?/p>
- Use DNID : YES 表示使用 DNIDQ並且不會提C?輸入目的地電p的語音
- SIP Call = yes, SIP Call Prefix, Direct Call: 這三個參數是用來?SIP ad希後,也能撥其他分號|撥法?555+SIP Extension
- Say Balance After Auth: 認證後是否提C餘?br />- Say Duration: 是否提示剩餘通話時間- 另一E比較快速的a定是:play_audio = no, use_dnid=yes, number_try=1?/p>
//為此模式新增 dialplan
//R輯 /etc/asterisk/extensions_a2billing.confQ在底下加入Q?/p>
[custom-a2billing-sipclient] exten => _X.,1,Answer exten => _X.,n,Wait(1) exten => _X.,n,deadAGI(a2billing.php|2) exten => _X.,n,Hangup
// ?A2Billing 套用新增?dialplan
// A2Billing Admin UI > Customer > VoIP Settings
扑ֈ SIP 分機項目Q按R輯
Context = custom-a2billing-sipclient
// 最後,埯指o套用所有的修改
# asterisk -rx "reload"
TIPs:
由於版本 1.7.x ?bug 關係Q在 UI 做完操作後,並不會同步修?asterisk 的設定檔Q所以請依照方式作手動修改:
R輯 /etc/asterisk/additional_a2billing_sip.conf Q修?context 的內宏V?br />要避免每ơ都要作手動修改Q可以參?F.A.Q 的方法?br />
用途:FreePBX 的分用Ӟ?Outbound Calling 時可以透過 A2Billing 來計費,但其他原有PBX的功能都不會有媄ѝ?/p>
// R輯 /etc/asterisk/extensions_custom.conf
[macro-dialout-trunk-predial-hook] exten => s,1,GotoIf($["${OUT_${DIAL_TRUNK}:4:4}" = "A2B/"]?custom-freepbx-a2billing,${OUTNUM},1:2) exten => s,2,MacroExit [custom-freepbx-a2billing] exten => _X.,1,DeadAGI(a2billing.php,${OUT_${DIAL_TRUNK}:8}) exten => _X.,n,Hangup()
// FreePBX UI > Trunks > Add Custom Trunk
Custom Dial String = A2B/2
Tips:
2 代表?agi-conf 2
// FreePBX UI > Outbound Routes
自行a定需要的參數Q並向剛剛?Trunk?/p>
// FreePBX UI > Extensions
在需要計ȝ分機a定,參數 accountcode 填入 A2Billing ?Card Number?/p>
Tips:
分機在外撥的路由規則Q除?outbound route 外,還要考慮 A2Billing 的,也就?RATES 的相關設定?/p>
延p
用途:a定電話卡時除了使用輸入卡號的認證方式以外,還能以來電號?Caller ID) 辨識來認證?/p>
// 啟用方式
A2Billing Admin UI > Syetem Settings >
?agi-conf 的方式來a,可以很容易啟?關閉這功能,需要用到的參數(Key)如下Q?/p>
// 新增 Caller ID
A2Billing Admin UI > Customers > Caller-ID
CallerID = <用戶的來電號?gt;
Activated = yes
ID Card = <選擇卡號>
Ans: A2Billing UI > Customers > Add::Search > Search Customers
a定搜尋條g > ?Search > 再按旁邊?Delete All
注意Q這個方法無法將 VoIP Setting 一併刪除?/p>
Ans: 目前沒有合適的作法?/p>
Ans: 要改兩個地方,修改 base_currency 的參數及更新 currency list?/p>
Ans: 副檔名 csv Ҏ txt?/p>
版本 | 問題描述 |
1.7.0/1 | 修改 VoIP Settings ?內容Q不會同步更?Asterisk a定 |
Ans:這是因為 A2Billing 預設是啟動了 Realtime Asterisk 模式(Asterisk 以資料n型式儲存a定)Q若只是檢查 *.conf 來判?Asterisk 是否更新是不準確的,然而?bug 卻造成 A2Billing 無法?relatime 模式更新 Asterisk。暫時的解決Ҏ是 A2Billing 關閉 realtime asterisk 模式Q恢復成 *.conf 方式來更?asteriskQ步驟如下:
A2Billing UI > System Settings > Global List use_realtime = no (預設?yes) Notes: 畉閉了 Realtime 後,爑־若有新增/R輯 VoIP Settings 時,?CONFIRM DATA 之後Q需要在作以下步驟完?Asterisk 的更斎ͼ
| |
1.7.0 | 新增 CUSTOMER 時,?balance Ƅ位E持預設?0Q仍可以存檔 |
Ans: 這項不確定是否為 bugQ但?1.3.x I定版,存檔前系i會檢查 balance 不可?0? | |
1.7.0 | 若徏立電話卡是有 SIP ad希的,刪除這個電話卡後,SIP i端仍可以註冊,但已無法正常撥出?/td> |
1.7.0 | ?Customer UI ?DID 功能Q操?Release DIDQ按?Release 後,雖然 DID ?releaseQ但畫面會成I白頁?/td> |
1.7.0 | ?Customer UI ?DID 功能Q從項目列表中刪?destination number 時,所有欄位的值會出現I白Q再按下 Delete 後,雖然資料仍會刪除Q但需要再做一?Release DID?/td> |
make
make install
?pro文g中加?QMAKE_LFLAGS += -static -static-libgcc -static-libstdc++
5.5.4 ׃n(shared)庫和靜態(static)庫的混合連接
默認情況下,假如׃n庫可用,連接器會使用׃n庫。但?Bdynamic?br />-Bstatic提供了很好控制n的方法。它們可以決定用׃n庫還是用靜態庫?br />?Bdynamic?Bstatic達Ri連接器,如下操作Q?br /># gcc -o main main.o -Wl,-Bstatic -lfoo -Wl,-Bdynamic -lbar
Bdynamic 後面的n都用共享版?br />直到遇到Bstatic
Bstatic 後面的n都用靜態版?br />直到遇到Bdynamic
http://www.lslnet.com/linux/f/docs1/i44/big5307264.htm
启用RTTI
CONFIG += rtti
[mysqld_multi]
mysqld=/usr/bin/mysqld_safe
mysqladmin=/usr/bin/mysqladmin
log=/var/log/mysqld_multi.log
user = multi_admin
password = multipass
[mysqld1]
datadir=/var/lib/mysql_new
socket=/var/lib/mysql_new/mysql.sock
port=4000
pid-file=/var/lib/mysql_new/mysql.pid
user=mysql
多实例启?span lang="EN-US">
Sometimes, when debugging an issue, it's useful to see and log extra information and at
other times, you want logging to be minimal. Asterisk provides a number of ways of
logging information, to files or to a syslog server. The file /etc/asterisk/logger.conf
contains the configuration elements for logging. Asterisk has different types of message
that can be logged these are:
Verbose |
General 'chatter' about what is happening on the system. Verbosity levels greater than 3 display dialplan commands as they are executed. This generates lots of log information |
Debug |
Debug messages, normally only used by programmers to extract extended information |
Notice |
Non urgent alert messages |
Warning |
Warning alert messages, something happened that might be bad. Some tell you how bad the warning is |
Error |
Error messages, something bad happened – These should be rare. |
In logger.conf you will see the [logfiles] section, this is where you define the filename
and content of log files. Take a look at this example entry
|
[logfiles] debug => debug |
This tells Asterisk to log debug messages (the right side of the =>) to a file called debug
(the left side of the =>) located in /var/log/asterisk/. This directory can be changed in
/etc/asterisk/asterisk.conf by modifying the line astlogdir => /var/log/asterisk to point
to the desired directory. You can log multiple information types to the same file or you
can spread the information over a number of files. For example
|
[logfiles] debug => debug messages=>warning, error |
Will log debug messages to a file called debug, and will also log warning and error
messages to a file called messages. There is a special “file” called console which when
used will cause the message types specified to be logged to the Asterisk console, for
example:
|
[logfiles] console => debug, warning, error, notice, verbose |
Would log everything to the console (not to any files). The above is not recommended
since the amount of information that would be generated could be far to much to be of
any real use. If you change logger.conf you need to perform a reload or do a logger
rotate (see next section). You can also log messages to a syslog sever (remote logging
server), useful if you have either a lot of machines or want centralized logging. To do
this use the file syslog, with the suffix you will use in /etc/syslog.conf for example, in
logger.conf
|
[logfiles] syslog.local0 => debug, warning, error, notice, verbose |
And /etc/syslog.conf
|
local0.* |
This would send the Asterisk logging information to the syslog server at 192.168.1.22.
Setting up a syslog server is beyond the scope of this document and is left as an exercise
for the reader.
Rotate logs
It is advisable to rotate your logs frequently, depending on the amount of logging you
have turned on and the about of data that is actually logged. Files larger than 2Gb can
cause some nasty effects resulting in Asterisk crashes. You can rotate logs by using the
command
|
logger rotate |
|
This will rename the old log and start a new one. It will also reload logger.conf and
adopt any changes you have made to it.
You can change the verbosity (how much information we get) of the output on processes attached to the Asterisk console by setting the level of verbosity. To do this we use the set verbose command, for example:
|
set verbose 999 |
|
Sets the verbosity level to 999, Asterisk will tell you that the level of verbosity changed
|
asterisk*CLI> set verbose 999 Verbosity is at least 999 asterisk*CLI> |
You should see every message when it is set to this level, whereas setting it to 1 will
show very little information.
|
|
Setting the verbosity level changes the level on every attached process (connected via asterisk -r) not just the one you issue the command from. |
sip.conf is not difficult to understand, however there is a fundamental problem with SIP making it awkward to use. The problem is not so much with SIP itself, it's more to do with how we protect our networks. We all know that there are some nasty little people out there who are quite happy to steal your resources, make free calls using someone else's money etc. As a consequence of this we tend to put a firewall between them and us. This is where the problems start for SIP. In a network environment that requires no firewall, for example and Internal network, there will be no issues, but in a more complex network, perhaps using NAT (Network address translation) there are all sorts of hurdles to overcome.
You have a number of choices,