环境:

# cat /proc/version
Linux version 2.6.18-308.el5 (mockbuild@x86-010.build.bos.redhat.com) (gcc version 4.1.2 20080704 (Red Hat 4.1.2-50)) #1 SMP Fri Jan 27 17:21:15 EST 2012

步骤:
1、下载安装文件
asterisk-11-current.tar.gz
地址:http://www.asterisk.org/downloads
http://downloads.asterisk.org/pub/telephony/asterisk/
相关解释:
Asterisk Downloads
Download the currently supported versions of Asterisk and various Asterisk-related open source projects.
Asterisk Communications Framework • AsteriskNOW Software PBX • DAHDI • LIBPRI
Asterisk Communications Framework
Asterisk is an open source toolkit for building communications applications. For a more detailed explanation, check out the Get Started section.
For more information on how to use Asterisk, see the Configuration and Operation section of the wiki.
 
What is LIBPRI?
LIBPRI is an open source library that encapsulates the protocols used to communicate over ISDN Primary Rate Interfaces (T1, E1, J1).
LIBPRI is a dependency for Asterisk and DAHDI if PRI signaling is used.

http://downloads.asterisk.org/pub/telephony/libpri/libpri-1.4-current.tar.gz
 
What is DAHDI?
DAHDI (Digium/Asterisk Hardware Device Interface) is the open source device interface technology used to control Digium and other legacy telephony interface cards. DAHDI Linux / DAHDI Tools
DAHDI Linux is the open source device driver framework used to interface Asterisk with telephony hardware.
DAHDI Tools is a package of utilities for managing and monitoring DAHDI devices.  
The download on this page provides a combined package of the latest DAHDI Linux with the latest DAHDI Tools.
http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz
 
2、安装过程
asterisk-11-current.tar.gz放到目录/opt/asterisk/(这个路径可以随意指定,只要空间足够即可)下
解压缩:tar –xzvf asterisk-11-current.tar.gz
进行源文件目录asterisk-11.5.1
执行下列命令
./configure
执行结果的最后几行:
 

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 
make 
执行结果的最后几行:
tline/libedit.a  -> asterisk
Building Documentation For: channels pbx apps codecs formats cdr cel bridges funcs tests main res addons
+--------- Asterisk Build Complete ---------+
+ Asterisk has successfully been built, and +
+ can be installed by running: +
+ +
+ make install +
+-------------------------------------------+

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 
make install 
执行结果的最后几行:
for x in images/*.jpg; do \
/usr/bin/install -c -m 644 $x "/var/lib/asterisk/images" ; \
done
make -C sounds install
make[1]: Entering directory `/opt/drivers2/asterisk-11.5.1/sounds'
make[1]: Leaving directory `/opt/drivers2/asterisk-11.5.1/sounds'
+---- 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 +
+-------------------------------------------+

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 
make samples
执行结果的最后几行:
                /usr/bin/install -c -m 644 "/etc/asterisk/asterisk.conf.tmp" "/etc/asterisk/asterisk.conf" ; \
rm -f "/etc/asterisk/asterisk.conf.tmp" ; \
fi ; \
/usr/bin/install -c -d "/var/spool/asterisk/voicemail/default/1234/INBOX"
Updating asterisk.conf
build_tools/make_sample_voicemail "//var/lib/asterisk" "//var/spool/asterisk"
Installing file phoneprov/000000000000.cfg
Installing file phoneprov/000000000000-directory.xml
Installing file phoneprov/000000000000-phone.cfg
Installing file phoneprov/polycom_line.xml
Installing file phoneprov/polycom.xml
Installing file phoneprov/snom-mac.xml

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 
make config
 
3、安装完成后asterisk进程也启起来了
/bin/sh /usr/sbin/safe_asterisk
 
4、修改sip.conf和extendsion.conf文件
 
sip.conf的最下方增加小节(添加用户,本例增加两个用户9001和9002):
[9001]
type=friend
username=9001
secret=9001
host=dynamic
context=demo
disallow=all
allow=alaw;这个地方需要注意一定要和客户端(eyeBeam或X-Lite)保持一致,此例都设为alaw
dtmfmode=rfc2833
canreinvite=no
maxcallbitrate=384
[9002]
type=friend
username=9002
secret=9002
host=dynamic
context=demo
disallow=all
allow=alaw
dtmfmode=rfc2833
canreinvite=no
maxcallbitrate=384

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 
 
extensions.conf的最下面增加一个小节:
[demo]//上面用到
exten => _9.,1,Dial(SIP/${EXTEN},20,r)

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

说明:
(1)规则就一条,使得9001 和9002 可以互相拨打。当中的格式简要讲述一下。更多的请参考
Asterisk 的手册,这里不详细展开。
(2)开头部分“exten =>”表示,也可以用“exten =”表示。并且在一个小节内可以定义多
条exten 语句。
(3)之后的“_9”表示匹配上所有“9”开头的拨号,“.”表示不限制长度的任意字符。
(4)然后的“1”表示优先级,我喜欢称作为“执行次序”。“1”表示第一步执行的意思,如果
后续还需要执行其他动作的话,可以继续写多条exten 语句,并且用递增执行次序依次设计下去。
(5)接着的“Dail()”表示“执行动作”,这里是表示拨号的执行动作。更规范的说,这个是
APP 应用程序。
(6)括号当中又分成3 个部分。第一个SIP 表示拨号动作中拨向的通道是SIP 协议的通道。$
{EXTEN}则一个变量,其值就是用户实际拨打的号码。如果你拨打9001 那么${EXTEN}的值就是
9001。
(7)括号内的“20”,表示等待时间单位秒,如果有多个执行次序,即一组拨号规则的话,如果
过了20 秒,就跳跃执行次序(跳跃的幅度是101 个优先级)。
(最后的“r”表示强行播放振铃。在拨打对方等待对方接通的时候,就能听到回振铃音。

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 
4、进行asterist的控制台重新加载文件sip.conf,extensions.conf
asterisk –gcrvvvvvv 
直接启动后连接到Asterisk控制台
注意,启动脚本是“safe_asterisk”,当启动起来后察看进程也能看到这个名字的进程。

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

IVRServer*CLI> sip reload
Reloading SIP
== Parsing '/etc/asterisk/sip.conf': Found
== Parsing '/etc/asterisk/users.conf': Found
== Using SIP CoS mark 4
== Parsing '/etc/asterisk/sip_notify.conf': Found

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 
 
控制台相关命令:
; Useful CLI commands to check peers/users:
; sip show peers Show all SIP peers (including friends)
; sip show registry Show status of hosts we register with
;
; sip set debug on Show all SIP messages
;
; sip reload Reload configuration file
; sip show settings Show the current channel configuration

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 
5、然后使用eyeBeam或X-Lite注册sip,然后拨打电话即可
如果编码客户端和服务器设置的不一致,就会报错:
IVRServer*CLI>
== Using SIP RTP CoS mark 5
[Sep 4 16:52:47] NOTICE[2680][C-00000001]: chan_sip.c:10523 process_sdp: No compatible codecs, not accepting this offer!
== Using SIP RTP CoS mark 5
-- Executing [9002@demo:1] Dial("SIP/9001-00000002", "SIP/9002,20,r") in new stack
== Using SIP RTP CoS mark 5
-- Called SIP/9002
== Everyone is busy/congested at this time (1:0/0/1)
-- Auto fallthrough, channel 'SIP/9001-00000002' status is 'CHANUNAVAIL'

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

 
 
解决办法就是将编码设置一致,本例中都设为G.711Alaw语音编解码
 

 
 
 

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }
.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

.csharpcode, .csharpcode pre
{
font-size: small;
color: black;
font-family: consolas, "Courier New", courier, monospace;
background-color: #ffffff;
/*white-space: pre;*/
}
.csharpcode pre { margin: 0em; }
.csharpcode .rem { color: #008000; }
.csharpcode .kwrd { color: #0000ff; }
.csharpcode .str { color: #006080; }
.csharpcode .op { color: #0000c0; }
.csharpcode .preproc { color: #cc6633; }
.csharpcode .asp { background-color: #ffff00; }
.csharpcode .html { color: #800000; }
.csharpcode .attr { color: #ff0000; }
.csharpcode .alt
{
background-color: #f4f4f4;
width: 100%;
margin: 0em;
}
.csharpcode .lnum { color: #606060; }

Asterist搭建步骤的更多相关文章

  1. Java Web 环境搭建步骤(超详细,包括前期安装步骤)

    Java Web 环境搭建步骤 安装对应版本的JDK 配置环境变量 本人安装的路径是C盘,在path中加入C:\Program Files\Java\jdk1.8.0_65\bin 测试配置成功,cm ...

  2. Linux vagrant+virtualbox环境搭建步骤

    Linux vagrant+virtualbox环境搭建步骤 Vagrant 是一款用来构建虚拟开发环境的工具,非常适合 php/python/ruby/java 这类语言开发 web 应用. 我们可 ...

  3. SSH三大框架合辑的搭建步骤

    v\:* {behavior:url(#default#VML);} o\:* {behavior:url(#default#VML);} w\:* {behavior:url(#default#VM ...

  4. cocos2d-lua 3.5 android搭建步骤

    cocos2d-lua 3.5 android搭建步骤 如何安装eclipse,jdk,android sdk,ndk这里都不说了,资料很多,而且以前用eclipse搭建cocos2d-x-c++的时 ...

  5. IIS HTTP文件服务器搭建步骤

    利用IIS搭建HTTP文件服务器,可下载.上传(用户名验证) 1.右键网站,添加应用程序 2.物理路径,选择系统的目录配置,上一层 别名:CAPI3FileService 3.效果如下: 4.(以下步 ...

  6. [转]MonkeyRunner在Windows下的Eclipse开发环境搭建步骤(兼解决网上Jython配置出错的问题)

    MonkeyRunner在Windows下的Eclipse开发环境搭建步骤(兼解决网上Jython配置出错的问题)   网上有一篇shangdong_chu网友写的文章介绍如何在Eclipse上配置M ...

  7. mysql 主从搭建步骤

    mysql 主从搭建步骤 1:主库开启master端bin-log 2:主库创建备份用户 3:主库全备 4:从库导入全备数据 5:从库修改change master to信息 6:从库slave st ...

  8. Hadoop集群搭建步骤

    实验性操作是在虚拟机里进行的,除了搭建hadoop本身的操作之外,遇到的其它问题总结如下: 1. 虚拟机挂载windows磁盘: 添加硬件,要保证该硬件此时没有被读写访问等,因为挂载后,该磁盘在宿主机 ...

  9. 在Android Studio上测试运行,Unity发布成Android包的环境搭建步骤

      我用的是unity5.4.3版本,jdk是1.8.0_131版本,Android-SDK是r24.4.1版本,Android-NDK是r13b版本,作者是刚开始写博客,希望对在unity摸索的人有 ...

随机推荐

  1. TFS中设置任务中的“计划开始时间”为可编辑状态

    问题现象 如果使用TFS系统的默认模板CMMI新建团队项目,你会发现在网页浏览器中,任务工作项的"计划开始日期"和"计划结束日期"的类型是普通字符,并且不能修改 ...

  2. 创建自己的Code Snippet(代码模板)

    一.名词解释 Code Snippet,代码模板,是一种快速生成代码的快捷方式,使用它可以有效地提高编程效率. 编程中可以使用Visual Studio提供的预先设置好的Code Snippet,也可 ...

  3. webapi token、参数签名是如何生成的(转载)

    API接口保障安全性原则:1.有调用者身份2.请求的唯一性3.请求的参数不能被篡改4.请求的有效时间 在刚接触接口开发时,可能脑子里压根就没有这个接口调用安全性的原则,但常识性的经验告诉我们,每一个请 ...

  4. 【cocos2d-x 手游研发小技巧(7)图片资源加密,Lua文件加密】

    游戏开发中常遇到资源保护的问题. 目前游戏开发中常加密的文件类型有:图片,Lua文件,音频等文件,而其实加密也是一把双刃剑. 需要安全那就得耗费一定的资源去实现它.目前网上也有用TexturePack ...

  5. 日期时间类——Java常用类

    时间戳(timestamp):距离特定时间的间隔. 计算机中的时间戳是指距离历元(1970-01-01 00:00:00:000)的时间间隔(ms). 格林尼治时间(GMT):是一个标准时间,用于全球 ...

  6. Volley源码解析

    说点题外话,将近三个半月没有写博客了,年初换工作,在新的公司,上班第三天开始干活,花了二十来天弄了一个项目,上线后,接着又迭代了几个版本,不知不觉,试用期过完,才稍微有几天闲时.在年初的时候,就一直在 ...

  7. 配置阿里云ESC服务器部署项目

    第一次SSH登录 ECS 服务器: 打开命令行终端(git),键入: > ssh root@39.108.54.110 输入实例密码,进入服务器环境. 配置 root 及应用账号权限 新增管理员 ...

  8. 面向 B 端的产品经理

    简评:越来越多人涌入产品经理这个岗位,但是面对不同的产品和客户群体,产品经理所需要的技能.知识和经验可能大相庭径. 近几年随着移动互联网的爆发性增长,几乎遍地都是产品经理了.华尔街日报 也曾报道称「产 ...

  9. Mcode的介绍

    开始时进行的Mcode代码积累平台的分析: 登录模块 Login.html登录页面进行用户的登录,把登录好的用户id存到session里面,转到代码模块 Register.html注册页面进行用户的注 ...

  10. 解决chrome无法启用印象笔记-剪藏功能

        新版Chrome浏览器安全的问题,导致从印象笔记官网下载的rxs(crx)文件无法直接通过drap&drop功能添加功能块.可以将rxs(crx)文件后缀名改成rar格式,然后解压,通 ...