Asteriskをインストールする
CentOS 5.4をインストールする
CentOS 5.4のダウンロード
CentOS 5.4をダウンロードします。
http://www.centos.org/
CentOS 5.4のインストール
CentOS 5.4をインストールします。
<インストール時の設定>
・ IPアドレスとして、固定のIPアドレスを割り当てます。
・ 開発ツールをインストールします。
- レガシーなソフトウェア開発、開発ツール、開発ライブラリにチェックを付けます。
・ SELinux設定を「無効」にします。
システム更新
システムを最新の状態にします。
# yum -y update
ファイアウォールの設定
ファイアウォールの設定を行います。
- ファイアウォールを「有効」にします。
- 「追加」をクリックしUDPポートを開けるようにします。
UDP 4569 IAX2
UDP 5060 SIP
UDP 10000~20000 RTP
Zaptelをインストールする
Zaptelのダウンロードと展開
Zaptel(Zapataテレフォニドライバ)を/usr/local/src/にダウンロードし、ソースを展開します。
# cd /usr/local/src
# wget http://downloads.asterisk.org/pub/telephony/zaptel/releases/zaptel-1.4.9.2.tar.gz
# tar zxvf zaptel-1.4.9.2.tar.gz
Zaptelコンパイルの準備
Zaptelのディレクトリに移動します。
# cd zaptel-1.4.9.2
Zaptelコンパイルの準備をします。
# ./configure
# make menuselect
・Kernel Modulesを選択し、Enterキーを押します。
・「Zaptel Module Selection」ではztdummyだけを選択します。
・xキーを押し、保存させてから終了させます。
Zaptelコンパイルとインストール
コンパイルとインストールを行います。
# make
# make install
# make config
Zaptelの起動確認
Zaptelを起動します。
# /etc/rc.d/init.d/zaptel start
Zaptel起動メッセージを確認します。
# /etc/rc.d/init.d/zaptel start
Loading zaptel framework: [ OK ]
Waiting for zap to come online...OK
Loading zaptel hardware modules:No functioning zap hardware found in /proc/zaptel, loading ztdummy
Running ztcfg: [ OK ]
#
Zaptelがロードされていることを確認します。
# lsmod | grep zap
# lsmod | grep zap
zaptel 188548 1 ztdummy
crc_ccitt 6337 1 zaptel
#
Zaptelを停止します。
# /etc/rc.d/init.d/zaptel stop
Zaptelの自動起動設定
Zaptel自動起動の設定をします。
# chkconfig zaptel on
Asteriskをインストールする
Asteriskのダウンロードと展開
Asteriskを/usr/local/srcディレクトリにダウンロードし、展開します。
# cd /usr/local/src
# wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.4.24.1.tar.gz
# tar zxvf asterisk-1.4.24.1.tar.gz
Asteriskコンパイルの準備
Asteriskコンパイルの準備をします。
# cd asterisk-1.4.24.1
# ./configure
config.status: creating build_tools/menuselect-deps config.status: creating makeopts config.status: creating channels/h323/Makefile config.status: creating include/asterisk/autoconfig.h .$$$$$$$$$$$$$$$=.. .$7$7.. .7$$7:. .$$:. ,$7.7 .$7. 7$$$$ .$$77 ..$$. $$$$$ .$$$7 ..7$ .?. $$$$$ .?. 7$$$. $.$. .$$$7. $$$$7 .7$$$. .$$$. .777. .$$$$$$77$$$77$$$$$7. $$$, $$$~ .7$$$$$$$$$$$$$7. .$$$. .$$7 .7$$$$$$$7: ?$$$. $$$ ?7$$$$$$$$$$I .$$$7 $$$ .7$$$$$$$$$$$$$$$$ :$$$. $$$ $$$$$$7$$$$$$$$$$$$ .$$$. $$$ $$$ 7$$$7 .$$$ .$$$. $$$$ $$$$7 .$$$. 7$$$7 7$$$$ 7$$$ $$$$$ $$$ $$$$7. $$ (TM) $$$$$$$. .7$$$$$$ $$ $$$$$$$$$$$$7$$$$$$$$$.$$$$$$ $$$$$$$$$$$$$$$$. configure: Package configured for: configure: OS type : linux-gnu configure: Host CPU : i686 #
# make menuselect
(デフォルトのままでxキーで抜けます)
日本語化パッチ
日本語化パッチ(ja_autopatch.sh)をAsteriskソースを展開したディレクトリ(/usr/local/src/asterisk-1.4.27)にダウンロードします。
# cd /usr/local/src/asterisk-1.4.24.1
# wget ftp://ftp.voip-info.jp/asterisk/patch/scripts/ja_autopatch.sh
パッチを当てます。
# chmod +x ja_autopatch.sh
# ./ja_autopatch.sh
# ./ja_autopatch.sh --2009-12-18 16:41:59-- ftp://ftp.voip-info.jp/asterisk/patch/1.4.24.1/patch_list => `patch_list' ftp.voip-info.jp をDNSに問いあわせています... 61.194.4.2 ftp.voip-info.jp|61.194.4.2|:21 に接続しています... 接続しました。 anonymous としてログインしています... ログインしました! ==> SYST ... 完了しました。 ==> PWD ... 完了しました。 ==> TYPE I ... 完了しました。 ==> CWD /asterisk/patch/1.4.24.1 ... 完了しました。 ==> SIZE patch_list ... 54 ==> PASV ... 完了しました。 ==> RETR patch_list ... 完了しました。 長さ: 54 100%[======================================>] 54 --.-K/s 時間 0.001s 2009-12-18 16:42:05 (65.3 KB/s) - `patch_list' へ保存終了 [54] --2009-12-18 16:42:05-- ftp://ftp.voip-info.jp/asterisk/patch/1.4.24.1/app_voicemail.c.090407-01.patch => `app_voicemail.c.090407-01.patch' ftp.voip-info.jp をDNSに問いあわせています... 61.194.4.2 ftp.voip-info.jp|61.194.4.2|:21 に接続しています... 接続しました。 anonymous としてログインしています... ログインしました! ==> SYST ... 完了しました。 ==> PWD ... 完了しました。 ==> TYPE I ... 完了しました。 ==> CWD /asterisk/patch/1.4.24.1 ... 完了しました。 ==> SIZE app_voicemail.c.090407-01.patch ... 5171 ==> PASV ... 完了しました。 ==> RETR app_voicemail.c.090407-01.patch ... 完了しました。 長さ: 5171 (5.0K) 100%[======================================>] 5,171 --.-K/s 時間 0.01s 2009-12-18 16:42:06 (374 KB/s) - `app_voicemail.c.090407-01.patch' へ保存終了 [5171] patching file apps/app_voicemail.c --2009-12-18 16:42:06-- ftp://ftp.voip-info.jp/asterisk/patch/1.4.24.1/say.c.081115-01.patch => `say.c.081115-01.patch' ftp.voip-info.jp をDNSに問いあわせています... 61.194.4.2 ftp.voip-info.jp|61.194.4.2|:21 に接続しています... 接続しました。 anonymous としてログインしています... ログインしました! ==> SYST ... 完了しました。 ==> PWD ... 完了しました。 ==> TYPE I ... 完了しました。 ==> CWD /asterisk/patch/1.4.24.1 ... 完了しました。 ==> SIZE say.c.081115-01.patch ... 16157 ==> PASV ... 完了しました。 ==> RETR say.c.081115-01.patch ... 完了しました。 長さ: 16157 (16K) 100%[======================================>] 16,157 --.-K/s 時間 0.08s 2009-12-18 16:42:11 (189 KB/s) - `say.c.081115-01.patch' へ保存終了 [16157] patching file main/say.c Hunk #1 succeeded at 379 (offset 1 line). Hunk #3 succeeded at 403 (offset 1 line). Hunk #4 succeeded at 3192 (offset -8 lines). Hunk #5 succeeded at 5669 (offset 1 line). Hunk #6 succeeded at 5926 (offset -8 lines). Hunk #7 succeeded at 6910 (offset 1 line). [root@localhost asterisk-1.4.24.1]#
RT-200NE対応パッチ
NTT東日本のひかり電話用ルータRT-200NE対応パッチを当てます。
RT-200NEパッチ(chan_sip.c.rt200ne.070417-02.patch)をAsteriskソースを展開したディレクトリ(/usr/local/src/asterisk-1.4.24.1)にダウンロードします。
# cd /usr/local/src/asterisk-1.4.24.1
# wget ftp://ftp.voip-info.jp/asterisk/patch/local/1.4/channels/chan_sip.c.rt200ne.070417-02.patch
パッチを当てます。
# patch -p0 < chan_sip.c.rt200ne.070417-02.patch
# patch -p0 < chan_sip.c.rt200ne.070417-02.patch patching file ./channels/chan_sip.c Hunk #1 succeeded at 219 (offset 10 lines). Hunk #2 succeeded at 571 with fuzz 2 (offset 6 lines). Hunk #3 succeeded at 11152 (offset 773 lines). Hunk #4 succeeded at 11206 (offset 17 lines). Hunk #5 succeeded at 11973 (offset 773 lines). Hunk #6 succeeded at 11388 (offset 26 lines). Hunk #7 succeeded at 17923 (offset 1641 lines). Hunk #8 succeeded at 16559 (offset 32 lines). Hunk #9 succeeded at 18969 (offset 1632 lines). #
Asteriskのコンパイルとインストール
コンパイルとインストールを行います。
# make
# make install
if [ -f contrib/firmware/iax/iaxy.bin ] ; then \ /usr/bin/install -c -m 644 contrib/firmware/iax/iaxy.bin \ /var/lib/asterisk/firmware/iax/iaxy.bin; \ fi +---- Asterisk Installation Complete -------+ + + + YOU MUST READ THE SECURITY DOCUMENT + + + + Asterisk has successfully been installed. + + If you would like to install the sample + + configuration files (overwriting any + + existing config files), run: + + + + make samples + + + +----------------- or ---------------------+ + + + You can go ahead and install the asterisk + + program documentation now or later run: + + + + make progdocs + + + + **Note** This requires that you have + + doxygen installed on your local system + +-------------------------------------------+ #
サンプル設定ファイル生成処理
# make samples
# make config
日本語音声ファイルのインストール
日本語音声ファイルをインストールします。
日本語音声ファイルasterisk-sound-jp_14_beta_tar.gzを/var/lib/asterisk/sounds/にダウンロードします。
# cd /var/lib/asterisk/sounds/
# wget ftp://ftp.voip-info.jp/asterisk/sounds/1_4/asterisk-sound-jp_14_beta.tar.gz
日本語音声ファイルを展開します。
# tar zxvf asterisk-sound-jp_14_beta.tar.gz
サンプル設定ファイルの入手と設定
ひな型設定フィアルのバックアップ
サンプル設定を入手する前に、Asteriskに付いている設定ファイルのひな形をバックアップしておきます。
# cd /etc
# mv asterisk asterisk.bak
# mkdir asterisk
サンプル設定ファイルの入手
サンプルファイルconf-sample-1.4_01.tar.gzを/etc/asteriskにダウンロードします。
# cd /etc/asterisk
# wget ftp://ftp.voip-info.jp/asterisk/conf/conf-sample-1.4_01.tar.gz
conf-sample-1.4_01.tar.gz を展開します。
# tar zxvf conf-sample-1.4_01.tar.gz
サンプル設定
200 内線201~209の一斉呼び出し 201~209 内線 317 時報 333 エコーテスト 201*1~209*1 ボイスメール録音 298 ボイスメール再生(パスワード認証あり) 299 ボイスメール再生(パスワード認証なし) 300 音声会議 301 音声会議(会議室を動的に生成)
Asteriskの起動と停止
Asteriskの起動
# /etc/init.d/asterisk start
# /etc/init.d/asterisk start
Starting asterisk: [ OK ]
Asteriskの停止
# /etc/init.d/asterisk stop
# /etc/init.d/asterisk stop
Stopping safe_asterisk: [ OK ]
Shutting down asterisk: [ OK ]
Asterisk CLI(コマンドラインインターフェース)の起動
CLIの起動
# asterisk -vvvvvc
~たくさんメッセージが表示される~
Asterisk Ready.
*CLI>
*CLI> のプロンプトが表示され、CLIが動作していることを確認します。
*CLI> stop now でAsteriskを停止することができます。
CLIの再起動
# asterisk -vvvvvcr
# asterisk -vvvvvcr Asterisk 1.4.24.1, Copyright (C) 1999 - 2008 Digium, Inc. and others. Created by Mark SpencerAsterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details. This is free software, with components licensed under the GNU General Public License version 2 and other licenses; you are welcome to redistribute it under certain conditions. Type 'core show license' for details. ========================================================================= == Parsing '/etc/asterisk/asterisk.conf': Found Connected to Asterisk 1.4.24.1 currently running on localhost (pid = 3262) Verbosity was 3 and is now 5 -- Unregistered SIP '202' -- Registered SIP '202' at 192.168.1.30 port 5060 -- Saved useragent "SJphone/1.65.377a (SJ Labs)" for peer 202 localhost*CLI>
Asteriskサーバの動作確認
ソフトフォンをインストールし、Asteriskサーバの動作確認を行います。
・ 「333」をダイヤルしエコーテストを行います。
・ エコーが正しくかえってくることを確認します。
AsteriskでソフトフォンSJphoneを使用する
Asterisk CLIコマンド
AsteriskのCLIコマンド一覧を表示させることができます。
*CLI> help
Asteriskコマンド一覧
関連ページ
ディジウム
http://www.digium.com/
Asterisk
http://www.asterisk.org/
VoIP Info Wiki
http://www.voip-info.org/
CentOS
http://www.centos.org/
VoIP Info Wiki (日本語)
http://voip-info.jp/
2009.12.16
*CLI> help ! Execute a shell command abort halt Cancel a running halt ael debug contexts Enable AEL contexts debug (does nothing) ael debug macros Enable AEL macros debug (does nothing) ael debug read Enable AEL read debug (does nothing) ael debug tokens Enable AEL tokens debug (does nothing) ael nodebug Disable AEL debug messages ael reload Reload AEL configuration agent logoff Sets an agent offline agent show Show status of agents agent show online Show all online agents agi debug Enable AGI debugging agi debug off Disable AGI debugging agi dumphtml Dumps a list of agi commands in html format agi show List AGI commands or specific help cdr status Display the CDR status core clear profile Clear profiling info core set debug channel Enable/disable debugging on a channel core set debug Set level of debug chattiness core set debug off Turns off debug chattiness core set global Set global dialplan variable core set verbose Set level of verboseness core show applications Shows registered dialplan applications core show application Describe a specific dialplan application core show audio codecs Displays a list of audio codecs core show channels Display information on channels core show channel Display information on a specific channel core show channeltypes List available channel types core show channeltype Give more details on that channel type core show codecs Displays a list of codecs core show codec Shows a specific codec core show config mappings Display config mappings (file names to config engines) core show file formats Displays file formats core show file version List versions of files used to build Asterisk core show functions Shows registered dialplan functions core show function Describe a specific dialplan function core show globals Show global dialplan variables core show hints Show dialplan hints core show image codecs Displays a list of image codecs core show image formats Displays image formats core show license Show the license(s) for this copy of Asterisk core show profile Display profiling info core show switches Show alternative switches core show threads Show running threads core show translation Display translation matrix core show uptime Show uptime information core show version Display version info core show video codecs Displays a list of video codecs core show warranty Show the warranty (if any) for this copy of Asterisk dahdi destroy channel Destroy a channel dahdi restart Fully restart DAHDI channels dahdi show cadences List cadences dahdi show channels Show active DAHDI channels dahdi show channel Show information on a channel dahdi show status Show all DAHDI cards status database del Removes database key/value database deltree Removes database keytree/values database get Gets database value database put Adds/updates database value database show Shows database contents database showkey Shows database contents dialplan add extension Add new extension into context dialplan add ignorepat Add new ignore pattern dialplan add include Include context in other context dialplan reload Reload extensions and *only* extensions dialplan remove extension Remove a specified extension dialplan remove ignorepat Remove ignore pattern from context dialplan remove include Remove a specified include from context dialplan show Show dialplan dnsmgr refresh Performs an immediate refresh dnsmgr reload Reloads the DNS manager configuration dnsmgr status Display the DNS manager status feature show Lists configured features file convert Convert audio file group show channels Display active channels with group(s) help Display help list, or specific help on a command http show status Display HTTP server status iax2 provision Provision an IAX device iax2 prune realtime Prune a cached realtime lookup iax2 reload Reload IAX configuration iax2 set debug Enable IAX debugging iax2 set debug jb Enable IAX jitterbuffer debugging iax2 set debug jb off Disable IAX jitterbuffer debugging iax2 set debug off Disable IAX debugging iax2 set debug trunk Enable IAX trunk debugging iax2 set debug trunk off Disable IAX trunk debugging iax2 show cache Display IAX cached dialplan iax2 show callnumber usag Show current entries in ip Call number limit table iax2 show channels List active IAX channels iax2 show firmware List available IAX firmwares iax2 show netstats List active IAX channel netstats iax2 show peers List defined IAX peers iax2 show peer Show details on specific IAX peer iax2 show provisioning Display iax provisioning iax2 show registry Display IAX registration status iax2 show stats Display IAX statistics iax2 show threads Display IAX helper thread info iax2 show users List defined IAX users iax2 test losspct Set IAX2 incoming frame loss percentage indication add Add the given indication to the country indication remove Remove the given indication from the country indication show Display a list of all countries/indications keys init Initialize RSA key passcodes keys show Displays RSA key information local show channels List status of local channels logger mute Toggle logging output to a console logger reload Reopens the log files logger rotate Rotates and reopens the log files logger show channels List configured log channels manager show command Show a manager interface command manager show commands List manager interface commands manager show connected List connected manager interface users manager show eventq List manager interface queued events manager show users List configured manager users manager show user Display information on a specific manager user meetme Execute a command on a conference or conferee mixmonitor Execute a MixMonitor command. module load Load a module by name module reload Reload configuration module show List modules and info module show like List modules and info module unload Unload a module by name moh reload Music On Hold moh show classes List MOH classes moh show files List MOH file-based classes no debug channel originate Originate a call queue add member Add a channel to a specified queue queue remove member Removes a channel from a specified queue queue show Show status of a specified queue realtime load Used to print out RealTime variables. realtime update Used to update RealTime variables. restart gracefully Restart Asterisk gracefully restart now Restart Asterisk immediately restart when convenient Restart Asterisk at empty call volume rtcp debug ip Enable RTCP debugging on IP rtcp debug Enable RTCP debugging rtcp debug off Disable RTCP debugging rtcp stats Enable RTCP stats rtcp stats off Disable RTCP stats rtp debug ip Enable RTP debugging on IP rtp debug Enable RTP debugging rtp debug off Disable RTP debugging say load set/show the say mode show parkedcalls Lists parked calls show queues sip history Enable SIP history sip history off Disable SIP history sip notify Send a notify packet to a SIP peer sip prune realtime Prune cached Realtime object(s) sip prune realtime peer Prune cached Realtime peer(s) sip prune realtime user Prune cached Realtime user(s) sip reload Reload SIP configuration sip set debug Enable SIP debugging sip set debug ip Enable SIP debugging on IP sip set debug off Disable SIP debugging sip set debug peer Enable SIP debugging on Peername sip show channels List active SIP channels sip show channel Show detailed SIP channel info sip show domains List our local SIP domains. sip show history Show SIP dialog history sip show inuse List all inuse/limits sip show objects List all SIP object allocations sip show peers List defined SIP peers sip show peer Show details on specific SIP peer sip show registry List SIP registration status sip show rt200ne Show RT-200NE address sip show settings Show SIP global settings sip show subscriptions List active SIP subscriptions sip show users List defined SIP users sip show user Show details on specific SIP user sla show stations Show SLA Stations sla show trunks Show SLA Trunks soft hangup Request a hangup on a given channel stop gracefully Gracefully shut down Asterisk stop now Shut down Asterisk immediately stop when convenient Shut down Asterisk at empty call volume stun debug Enable STUN debugging stun debug off Disable STUN debugging udptl debug Enable UDPTL debugging udptl debug ip Enable UDPTL debugging on IP udptl debug off Disable UDPTL debugging voicemail show users List defined voicemail boxes voicemail show zones List zone message formats *CLI>
2009.12.16