配置Asterisk

1.  檢查是否已經安裝kernel-devel<?xml:namespace prefix = o ns = "urn:schemas-microsoft-com:office:office" />

# rpm -q kernel-devel

2. 檢查是否已經安裝以下的輔助軟件包

rpm -q bison

rpm -q bison-devel

rpm -q ncurses

rpm -q ncurses-devel

rpm -q zlib

rpm -q zlib-devel

rpm -q openssl

rpm -q openssl-devel

rpm -q gnutls-devel

rpm -q gcc

rpm -q gcc-c++

3. 下載libpri,zaptel,asterisk軟件包

http://ftp.digium.com/pub/libpri/releases/libpri-1.4.1.tar.gz

http://ftp.digium.com/pub/zaptel/releases/zaptel-1.4.4.tar.gz  

http://ftp.digium.com/pub/asterisk/releases/asterisk-1.4.8.tar.gz

http://ftp.digium.com/pub/asterisk/releases/asterisk-addons-1.4.2.tar.gz

http://ftp.digium.com/pub/asterisk/releases/asterisk-sounds-1.2.1.tar.gz

將下載的軟件包放到自定義的目錄下; 例如:/usr/src/

4. 解壓縮軟件包

#cd /usr/src

# tar -xvzf libpri-<?xml:namespace prefix = st1 ns = "urn:schemas-microsoft-com:office:smarttags" />1.4.1.tar.gz

# tar -xvzf zaptel-1.4.4.tar.gz

# tar -xvzf asterisk-1.4.8.tar.gz

# tar -xvzf asterisk-addons-1.4.2.tar.gz

# tar -xvzf asterisk-sounds-1.2.1.tar.gz

# rm -r *.gz (刪除壓縮包,可以不執行這一步)

5.安裝libpri

# cd libpri-1.4.1

# make

# make install

6.安裝zaptel

# cd ..

# cd zaptel-1.4.4

# ./configure

# make (make is OK, make26 seems to be useless for recent zaptel versions)

 # make install

# make config (to add zaptel startup script /etc/init.d/zaptel)

7.安裝asterisk

# cd ..

# cd asterisk-1.4.8

# ./configure

# make

# make install

# make samples

8. 安裝asterisk-addons

# cd ..

# cd asterisk-addons-1.4.2

# ./configure

# make

# make instal

l如果在make install的時候出現錯誤“cannot stat `.libs/libchan_h323.so.1.0.1'”解決辦法:  

#cd /usr/src/asterisk-addons/asterisk-ooh323c/.libs/#ln -s libchan_h323.1.0.1 libchan_h323.so.1.0.1 (小寫的L)

# make samples

9.安裝asterisk-sounds

# cd ..

# cd asterisk-sounds-1.2.1

# make# make install

10.啓動Asterisk

asterisk -vvvvvvvvvvvvvvvcg 執行後會出現很多提示,注意如果裏面有紅色的ERROR字樣說明有問題。如果執行成功,最後會屏幕停在:Asterisk Ready*CLI>

11.註冊SIP用戶

步驟:

-Registering a user in sip.conf-Registering a number in extensions.conf

11.1 Go to the /etc/asterisk directory on your Asterisk server. Open sip.conf and register the following test user.

<?xml:namespace prefix = v ns = "urn:schemas-microsoft-com:vml" /> 

Note that ALL characters after ‘;’ (semi-colomn) are interpreted by Asterisk as a comment.

[ivan]

This means we are registering user 'ivan'

type=friend

This means the user can place or receive calls. For INBOUND calls only, use ‘peer’ as type. For outbound calls only use ‘user’ as type.

username=ivan

This declares that our user will be named 'ivan'

secret=pwd_ivan

This creates the password for the user to login/authenticate on Asterisk

host=dynamic

This sets dynamic IP for the host. You may also define this as a static IP

context=tutorial

This defines the dial context for the user which in this case is tutorial. In Asterisk, outgoing numbers are divided in groups called contexts in order to separate/define different needs for different user types. For example, a context for local calls, another for within the city, and another for international calls and so on.

This completes the user registration process on Asterisk. Now let us register an extension for the user.

11.2 Go to /etc/asterisk and open extensions.conf

[tutorial]

This registers the context ‘tutorial’

exten => 1234,1,Dial(SIP/ivan)

when dialing number 1234, Asterisk will first Dial the user xlite through SIP protocol. The command is : exten => number, priority, Dial(protocol/user). The priority determines the sequence in which the extensions will be executed.

We now have a registered SIP user and extension on Asterisk. Follow this same process to register another SIP user and extension in order to place test calls.

Start by registering the second user in the same way in /etc/asterisk/sip.conf

Asterisk_voip_ipphone_image183.png

Register the extension(4321) in /etc/asterisk/extensions.conf in the same context = tutorial.

Asterisk_voip_ipphone_image184.png

Now when user 'ivan' or any other user from the tutorial context dials 4321, the user 'test' will be called.

3. The final step is to register the user to a compatible softphone. However, softphones will be reviewed later. For now, just make sure you have registered the users and extensions.

More detailed configuration information for a series of phones can be found here:

01. asterisk with softphones http://www.asteriskguru.com/tutorials/configuration_asterisk_softphone.html

12.安裝、啓動X-Lite

# cd /opt/xten-xlite./xtensoftphone

少了個libstdc++.so.5,下載裝上就可以了;

13.錯誤處理

13.1 問題:軟電話登錄時出現“Login Timeout.Contact Firewall..”

解決:桌面|管理|安全級別和防火牆|其他端口|添加5060端口,重啓Asterisk和軟電話

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章