1 / 70

Asterisk 系統

Asterisk 系統. Asterisk 系統架構與說明 http://downloads.oreilly.com/books/9780596510480.pdf. Asterisk 系統架構與介紹. 什麼是 Asterisk. PSTN. VoIP. Asterisk 系統架構與介紹. Basic Web page(HTML) <html> <head> </head> <body> <h1>Hello World!</h1> </body> </html>. 簡單的應用. Basic Extension(Dialplan)

alesia
Télécharger la présentation

Asterisk 系統

An Image/Link below is provided (as is) to download presentation Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author. Content is provided to you AS IS for your information and personal use only. Download presentation by click this link. While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server. During download, if you can't get a presentation, the file might be deleted by the publisher.

E N D

Presentation Transcript


  1. Asterisk 系統 Asterisk 系統架構與說明 http://downloads.oreilly.com/books/9780596510480.pdf

  2. Asterisk 系統架構與介紹 • 什麼是Asterisk PSTN VoIP

  3. Asterisk 系統架構與介紹

  4. Basic Web page(HTML) <html> <head> </head> <body> <h1>Hello World!</h1> </body> </html> 簡單的應用 Basic Extension(Dialplan) exten => 100,1,Answer() exten => 100,n,wait(1) exten => 100,n,Play(hello) exten => Hangup()

  5. 複雜的網路服務 複雜的應用 • 複雜的VoIP 服務

  6. 搞定Asterisk 的關鍵要素 • Linux 基本管理能力 • TCP/IP 網路基礎 • VoIP 基礎 • Script 程式概念

  7. Asterisk 硬體測試結果 • 硬體 : • AMD Athlon64 X2 4200 • 1G RAM • 80G SATA • 測試方式 : SIP call • Connection • Wait • Play audio • disconnection

  8. Asterisk 軟體系統

  9. Asterisk : System Service Linux Operating System Web DNS mail proxy firewall DHCP

  10. Asterisk : module channels Linux Operating System SIP IAX2 Skype DAHDI

  11. Asterisk : module resource Linux Operating System SIP IAX2 Skype DAHDI CDR Codec Format Config

  12. Asterisk : Command Line Interface Linux Operating System SIP IAX2 Skype DAHDI CLI CDR Codec Format Config

  13. Asterisk : Applications and Functions Linux Operating System SIP IAX2 Skype DAHDI CLI Applications Functions CDR Codec Format Config

  14. Asterisk : Manager Interface(AMI) Linux Operating System SIP IAX2 Skype DAHDI Applications CLI Dialplan Functions AMI CDR Codec Format Config

  15. Asterisk : Manager Interface(AMI) Linux Operating System SIP IAX2 Skype DAHDI Applications CLI Dialplan Functions AMI CDR Codec Format Config

  16. Asterisk Call flow • B2BUA : Back to Back User Agent PSTN Internet

  17. Asterisk Call process 101 Ring! Phone 102 Phone 101 SIP channel driver PBX Engine SIP channel driver sip.conf [100] type=friend host=dynamic context=inside extensions.conf [inside] exten => 101,1,Dial(SIP/101,20) exten => 101,n,Voicemail(101) exten => 102,1,Dial(SIP/102,20) exten => 102,n,Voicemail(102)

  18. Asterisk : Connectivity

  19. Asterisk Solution : PBX

  20. Asterisk • 全球已經有非常多以Asterisk 為基礎的系統 • Freepbx • Elastix • PBX in a flash • 有非常多的硬體廠商 • Digium • Sangoma • Voicetronix • 有非常多的add-on • CDR • ODBC • Voicemail • Security • Conference

  21. Digium’s AsteriskNOW

  22. Asterisk Applications • VoIP Gateway • IVR • Call Center • Conference Bridge

  23. Asterisk 系統建置 Asterisk 系統建置 Asterisk 系統調整 SIP client 軟體(Windows/Mac) SIP Client軟體(for Android) SIP hardphone SIP.conf Extension.conf tcpdump/Wireshark Asterisk CLI command

  24. 相關連結 • 使用手冊 • http://ofps.oreilly.com/titles/9780596517342/index.html • AsteriskNOW • https://www.asterisk.org/downloads • SIP Client • Windows • http://www.counterpath.com/x-lite-4-for-windows-download.html • Mac • http://www.counterpath.com/x-lite-4-for-mac-download.html • iPad • http://www.counterpath.com/bria-ipad-edition.html • Android • https://play.google.com/store/apps/details?id=com.csipsimple&hl=zh_TW • Wireshark • https://www.wireshark.org/download.html

  25. AsteriskNOW

  26. Installing AsteriskNOW

  27. Installing AsteriskNOW

  28. Installing AsteriskNOW

  29. Installing AsteriskNOW

  30. Installing AsteriskNOW

  31. Installing AsteriskNOW

  32. Installing AsteriskNOW

  33. Installing AsteriskNOW

  34. Installing AsteriskNOW

  35. 要啟動的服務 • httpd • ntpd • sendmail • sshd Installing AsteriskNOW

  36. 為了確保通話時間記錄的精確性, 以及讓Asterisk 和其他程式間正確地運作, 因此必須保持時間的正確性. • Ntpd deamon 可以確保你的系統時間的正確性. • 透過AsteriskNOW, 我們只要啟動ntpd 後, 系統便可以和其他ntp server 進行時間較正, 並可以提供做為其他電腦的系統校正, 以達到整體系統時間的正確性. 啟動 NTP 以做為時間校準 # yum install ntp ... Is this ok [y/N]: y ... # ntpdate pool.ntp.org # chkconfig ntpd on # service ntpd start

  37. 一般來說, 使用root 帳號做為管理有極大的風險. • 建議新增一個非root 的管理者, 但使用權限與root 相近. • 透過adduser command 可以新增一個使用者. • 密碼切勿使用範例或易猜的數字、英文名. 新增系統管理者 # adduser asteriskpbx # passwd asteriskpbx Changing password for user asteriskpbx. New UNIX password: Retype new UNIX password:

  38. 為了讓我們新增的使用者有 supervisor do (sudo) 的權限, 我們透過visudo 這個程式來修改sudoer這個設定檔, 以提高asteriskpbx 這個使用者的權限.如果一開始沒有安裝, 可以後續再安裝此package. • 透過visudo , 可以先找到下面這行, 把前面的# 取消, 以啟動此行的設定. 新增系統管理者 # yum install sudo # visudo ## Allows people in group wheel to run all commands %wheel ALL=(ALL) ALL

  39. 然後用vi 或nano 修改 /etc/group 這個檔案, 以讓我們這個asteriskpbx 帳號可以和root 的權限群組一致. • 存檔, 登出root, 然後用asteriskpbx 帳號登入. 透過下面指令試看看是否可以使用 • 因為是初次登入, 所以會確認此帳號的密碼, 以確認其權限無誤. 正確的狀況下, 應該可以看到linux 顯示 root 底下的檔案及目錄. 新增系統管理者 wheel:x:10:root,asteriskpbx $ sudo ls /root/ [sudo] password for asteriskpbx:

  40. 為了方便使用, 不要經常輸入整個路徑, 所以我們要將常用的路徑加到系統裡, 或修改bash 使用者檔案, 以方便使用. • 在AsteriskNOW下, CentOS 提供bash , 所以我們可以修改我們使用者路徑底下的 .bash_profile 檔案. • 此檔案放在使用者asteriskpbx 目錄下的隱藏檔. 在裡面修改如下: 新增系統管理者 $ vim ~/.bash_profile PATH=$PATH:$HOME/bin:/usr/sbin:/sbin

  41. The [directories] Section • Table asterisk.conf

  42. The [options] Section - 1 asterisk.conf

  43. asterisk.conf • The [options] Section - 2 Option Value/Example Notes highpriority yes Runs the Asterisk application with real-time priority. This option is set to no by default. initcrypto yes Loads keys from the astkeydir at startup. This option is set to no by default.[a] nocolor yes Suppresses color output from the Asterisk console. This is useful when saving console output to a file. This option is set to no by default. dontwarn yes Disables a few warning messages. This option was put in place to silence warnings that are generally correct, but may be considered to be so obvious that they become an annoyance. This option is set to no by default. dumpcore yes Tells Asterisk to generate a core dump in the case of a crash. This option is set to no by default.[b] languageprefix yes Configures how the prompt language is used in building the path for a sound file. By default, this is yes, which places the language before any subdirectories, such asen/digits/1.gsm. Setting this option to no causes Asterisk to behave as it did in previous versions, placing the language as the last directory in the path, (e.g. digits/en/1.gsm).

  44. asterisk.conf • The [options] Section - 3 Option Value/Example Notes internal_timing yes Uses a timing source to synchronize audio that will be sent out to a channel in cases such as file playback or music on hold. This option is set to yes by default and should be left that way; its usefulness has greatly diminished over the last few major versions of Asterisk. systemname my_system_name Gives this instance of Asterisk a unique name. When this has been set, the system name will be used as part of the uniqueid field for channels. This is incredibly useful if more than one system will be logging CDRs to the same database table. By default, this option is not set. autosystemname yes Automatically sets the system name by using the hostname of the system. This option is set tono by default. maxcalls 100 Sets a maximum number of simultaneous inbound channels. No limit is set by default. maxload 0.9 Sets a maximum load average. If the load average is at or above this threshold, Asterisk will not accept new calls. No threshold is set by default. minmemfree 1 Sets the minimum number of megabytes of free memory required for Asterisk to continue accepting calls. If Asterisk detects that there is less free memory available than this threshold, new calls will not be accepted. This option is not set by default.

  45. asterisk.conf • The [options] Section - 4 Option Value/Example Notes runuser asterisk Sets the system user that the Asterisk application should run as. This option is not set by default, meaning that the application will continue to run as the user that executed the application. rungroup asterisk Sets the system group that the Asterisk application should run as. This option is not set by default. documentation_language en_US The built-in documentation for Asterisk applications, functions, and other things is included in an external XML document. This option specifies the preferred language for documentation. If it is not available, the default ofen_US will be used. hideconnect yes Setting this option to yes causes Asterisk to not display notifications of remote console connections and disconnections at the Asterisk CLI. This is useful on systems where there are scripts that use remote consoles heavily. The default setting is no. lockconfdir no When this option is enabled, the Asterisk configuration directory will be protected with a lock. This helps protect against having more than one application attempting to write to the same file at the same time. The default value isno.

  46. The [files] Section asterisk.conf

  47. The [compat] Section asterisk.conf

  48. The [modules] Section modules.conf

  49. indications.conf • 不同國家, 不同電信業者, 對於其電話系統發出的聲音頻率, 如dialtone, busy, ringback 等聲音可能會不同. • Indications.conf 定義了電話系統應該發出的聲響頻率, 以利和voip 做對應. (預設是us) • 也可以透過CHANNEL(tonezone)= .. 的應用程式重新設定.

  50. 音效檔路徑 • /var/lib/asterisk/moh • 也可以取得免費的音樂, 重新convert後置於上述路徑. • DBS ITCrew Free MOH: CC BY-SA (free, royalty free, commercially usable) on hold music. • StarTel Free Music On Hold: Download Royalty Free Music for your PBX • 建議將音效檔轉成asterisk 可能有效應用的檔案為最佳: • *.sln • *.wav • *.pcm • *.gsm musiconhold.conf

More Related