2016/01/26

Asterisk : The Cookbook 食譜 018 - 檔案結構

Q018: Asterisk 的檔案太多了,可以解譯各個檔案的功能嗎?

是的,Asterisk 是一個複雜的系統,整合了諸多資源,而這些資源使用系統中各種不同的方式。底下的解說採用 Ubuntu 為例。

[組態檔]

Asterisk 的組態檔預設都是放在 /etc/asterisk/ ,底下是幾個比較重要的設定
extensions.conf  manager.conf  sip.conf  voicemail.conf asterisk.conf
在最後面會有這幾個檔的範例

[模組]

根據 asterisk.conf 中的設定,模組是放在 astmoddir => /usr/lib/asterisk/modules 中
需要注意的是,新舊版本的模組是不相容的,建議把舊的模組刪除或是備份。

[資源檔]

音樂檔(像 Music oh Hold(MOH)) 照 asterisk.conf 的設定,是放在 /usr/share/asterisk/moh 中。這邊要注意的是要依據設定檔來找,有很大可能也會放在 /var/lib/asterisk/moh 中

[spool]

spool 通常放在 /var/spool/asterisk 中,這目錄放的檔案主要是需要其他工具使用,例如 mail, printer 等等

[記錄]

記錄檔通常放 /var/log/asterisk 中,種類很多,包括 CDR, CEL, debug log, queue log, mesages, error 等等等


== extensions.conf ==
[general]
static=yes
writeprotect=no
clearglobalvars=no
[internal]
exten=>7001,1,Answer()
exten=>7001,2,Dial(SIP/7001,60)
exten=>7001,3,Playback(vm-nobodyavail)
exten=>7001,4,VoiceMail(7001@main)
exten=>7001,5,Hangup()
exten=>7002,1,Answer()
exten=>7002,2,Dial(SIP/7002,60)
exten=>7002,3,Playback(vm-nobodyavail)
exten=>7002,4,VoiceMail(7002@main)
exten=>7002,5,Hangup()
exten=>7003,1,Answer()
exten=>7003,2,Dial(SIP/7002,60)
exten=>7003,3,Playback(vm-nobodyavail)
exten=>7003,4,VoiceMail(7002@main)
exten=>7003,5,Hangup()
exten=>8001,1,VoicemailMain(7001@main)
exten=>8001,2,Hangup()
exten=>8002,1,VoicemailMain(7002@main)
exten=>8002,2,Hangup()

== manager.conf ==
[general]
enabled = yes
webenabled = yes
port = 5038
bindaddr = 0.0.0.0
displaysystemname = yes
httptimeout = 60

[admin]
secret = 123456
permit = 192.168.1.0/24
read = system,call,log,verbose,command,agent,user,config
write = system,call,log,verbose,command,agent,user,config

== sip.conf ==
[general]
context=internal
allowguest=no
allowoverlap=no
bindport=5060
bindaddr=0.0.0.0
srvlookup=no
allow=ulaw
nat=yes
localnet=192.168.1.0/24

[my-codecs](!)
disallow=all
allow=ilbc
allow=g729
allow=gsm
allow=g723
allow=ulaw

[7001]
type=friend
host=dynamic
secret=123456
context=internal

[7002]
type=friend
host=dynamic
secret=123456
context=internal

[7003]
type=friend
host=dynamic
secret=123456
context=internal

== voicemail.conf ==
[general]
format=wav49|gsm|wav
serveremail=asterisk
attach=yes
skipms=3000
maxsilence=10
silencethreshold=128
maxlogins=3
emaildateformat=%A,%B%d,%Yat%r
pagerdateformat=%A,%B%d,%Yat%r
[zonemessages]
eastern=America/New_York|'vm-received'Q'digits/at'IMp
central=America/Chicago|'vm-received'Q'digits/at'IMp
central24=America/Chicago|'vm-received'q'digits/at'HN'hours'
military=Zulu|'vm-received'q'digits/at'HN'hours''phonetic/z_p'
european=Europe/Copenhagen|'vm-received'adb'digits/at'HM
[default]
1234=>4242,ExampleMailbox,root@localhost
[other]
1234=>5678,Company2User,root@localhost
[main]
7001=>123456
7002=>123456
7003=>123456

== asterisk.conf ==
[directories](!)
astetcdir => /etc/asterisk
astmoddir => /usr/lib/asterisk/modules
astvarlibdir => /var/lib/asterisk
astdbdir => /var/lib/asterisk
astkeydir => /var/lib/asterisk
astdatadir => /usr/share/asterisk
astagidir => /usr/share/asterisk/agi-bin
astspooldir => /var/spool/asterisk
astrundir => /var/run/asterisk
astlogdir => /var/log/asterisk
astsbindir => /usr/sbin

0 意見: