asterisk安装、配置

asterisk官网有安装的具体步骤和教程,这里我主要参考官网中的源码安装方式。链接

1、关闭SELinux、防火墙
sed -i 's/\(^SELINUX=\).*/\SELINUX=disabled/' /etc/sysconfig/selinux

service iptables stop

2、系统更新
yum install -y epel-release
yum update -y

3、安装依赖库和附加服务
yum install -y gcc gcc-c++ lynx bison mysql-devel mysql-server php php-mysql php-pear php-mbstring tftp-server httpd make ncurses-devel libtermcap-devel sendmail sendmail-cf caching-nameserver sox newt-devel libxml2-devel libtiff-devel audiofile-devel gtk2-devel subversion kernel-devel git subversion kernel-devel php-process crontabs cronie cronie-anacron wget vim php-xml uuid-devel libtool sqlite-devel unixODBC mysql-connector-odbc

4、下载:

1)asterisk:

cd /usr/local/scr/
wget https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-14-current.tar.gz

2)libpri:

You'll only need this if you are going to use DAHDI with ISDN interface hardware (such as T1/E1/J1/BRI cards).

wget http://downloads.asterisk.org/pub/telephony/libpri/old/libpri-1.5.0.tar.gz
3)DAHDI:

cd /usr/local/src/
wget https://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz

注:启动dahdi时会遇到一个问题,dahdi: unrecognized service,原因是版本太高了,后来选择了一个旧版本的就可以了。

cd /usr/local/src/
wget http://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/releases/dahdi-linux-complete-2.6.0+2.6.0.tar.gz587
tar zxvf dahdi-linux-complete-2.6.0+2.6.0.tar.gz
cd dahdi-linux-complete-2.6.0+2.6.0
make all
make install
make config
/etc/init.d/dahdi restart
chkconfig dahdi on

Project
Location
Asterisk https://downloads.asterisk.org/pub/telephony/asterisk/asterisk-14-current.tar.gz
libpri https://downloads.asterisk.org/pub/telephony/libpri/libpri-current.tar.gz
dahdi-linux https://downloads.asterisk.org/pub/telephony/dahdi-linux/dahdi-linux-current.tar.gz
dahdi-tools https://downloads.asterisk.org/pub/telephony/dahdi-tools/dahdi-tools-current.tar.gz
dahdi-complete https://downloads.asterisk.org/pub/telephony/dahdi-linux-complete/dahdi-linux-complete-current.tar.gz

5、解压、安装:

1)首先,在编译以上这些源码的时候,可能会报一些错,需要安装一下依赖:

 A、You do not appear to have the sources for the.x86_64 kernel installed.
 

yum install "kernel-devel-uname-r == $(uname -r)"

 B、g++: Command not found:

yum -y update gcc
yum -y install gcc+ gcc-c++
 
2)编译、安装libpri:
tar xzvf libpri-1.5.0.tar.gz
cd /usr/src/libpri-1.5.0
make
make install

3)编译、安装dadhi:

如上

4)编译、安装jpsip:

git clone https://github.com/asterisk/pjproject pjproject
unzip pjproject-master.zip
./configure --prefix=/usr --enable-shared --disable-sound --disable-resample --disable-video --disable-opencore-amr CFLAGS='-O2 -DNDEBUG'
make dep
make
make install
ldconfig
ldconfig -p | grep pj

注:可能会遇到这个问题:[libpjsua2-x86_64-unknown-linux-gnu.a] Error 2

deleting the pjproject folder, download it and finally run configure and make commands did the trick for me 

5)编译asterisk:

cd /usr/local/src/asterisk-14.X.Y
./configure

在编译的时候会遇到很多问题:

A、提示: JSON support not found
解决:安装jansson

git clone https://github.com/akheron/jansson.git
unzip jansson-master.zip
cd jansson-master
autoreconf
这时可能汇报:centos -bash: autoreconf: command not found
yum -y install autoconf automake libtool
yum -y install libffi-dev
然后,再
./configure --libdir=/usr/lib64
make
make install
B、configure: error: *** termcap support not found (on modern systems, this typically means the ncurses development package is missing)
yum -y install bison
yum -y install bison-devel
yum -y install ncurses
yum -y install ncurses-devel
yum -y install zlib
yum -y install zlib-devel
yum -y install openssl
yum -y install openssl-devel
yum -y install gnutls-devel
yum -y install gcc
yum -y install gcc-c++

C、 uuid support not found (this typically means the libjansson development package is missing):
yum -y install uuid-devel
yum -y install libuuid libuuid-devel

D、configure: *** The Asterisk menuselect tool requires the 'libxml2' development package.
configure: *** Please install the 'libxml2' development package.
wget http://download.chinaunix.net/down.php?id=28493&ResourceID=6095&site=1
./configure 
make
make install

E、configure: error: *** Asterisk now uses SQLite3 for the internal Asterisk database.
wget http://download.chinaunix.net/down.php?id=19777&ResourceID=9862&site=1
./configure 
make
make install

各种问题的解决可以参考:http://blog.sina.com.cn/s/blog_7a3dc0c90102vwvu.html

编译成功后,会出现如下图案:


6)make menuselect

# make menuselect



7)安装asterisk:

make
make install
make的时候可能会失败

ng/parking_controller.o parking/parking_devicestate.o parking/parking_manager.o parking/parking_tests.o parking/parking_ui.o -> res_parking.so
   [CC] res_phoneprov.c -> res_phoneprov.o
   [LD] res_phoneprov.o -> res_phoneprov.so
   [CC] res_pjproject.c -> res_pjproject.o
   [LD] res_pjproject.o -> res_pjproject.so
   [CC] res_pjsip_acl.c -> res_pjsip_acl.o
   [LD] res_pjsip_acl.o -> res_pjsip_acl.so
   [CC] res_pjsip_authenticator_digest.c -> res_pjsip_authenticator_digest.o
   [LD] res_pjsip_authenticator_digest.o -> res_pjsip_authenticator_digest.so
   [CC] res_pjsip.c -> res_pjsip.o
   [CC] res_pjsip/config_auth.c -> res_pjsip/config_auth.o
   [CC] res_pjsip/config_domain_aliases.c -> res_pjsip/config_domain_aliases.o
   [CC] res_pjsip/config_global.c -> res_pjsip/config_global.o
   [CC] res_pjsip/config_system.c -> res_pjsip/config_system.o
   [CC] res_pjsip/config_transport.c -> res_pjsip/config_transport.o
res_pjsip/config_transport.c: In function ‘transport_apply’:
res_pjsip/config_transport.c:604: error: ‘pjsip_tcp_transport_cfg’ has no member named ‘sockopt_params’
res_pjsip/config_transport.c:605: error: ‘pjsip_tcp_transport_cfg’ has no member named ‘sockopt_params’
res_pjsip/config_transport.c:606: error: ‘pjsip_tcp_transport_cfg’ has no member named ‘sockopt_params’
res_pjsip/config_transport.c:607: error: ‘pjsip_tcp_transport_cfg’ has no member named ‘sockopt_params’
res_pjsip/config_transport.c:608: error: ‘pjsip_tcp_transport_cfg’ has no member named ‘sockopt_params’
make[1]: *** [res_pjsip/config_transport.o] Error 1
make: *** [res] Error 2
分析应该是pjsip的版本不对,然后重新下载高版本:

# cd /usr/src
# wget http://www.pjsip.org/release/2.3/pjproject-2.3.tar.bz2
# tar -jxvf pjproject-2.3.tar.bz2
cd pjproject-2.3
# ./configure CFLAGS="-DNDEBUG -DPJ_HAS_IPV6=1" --prefix=/usr --libdir=/usr/lib64 --enable-shared --disable-video --disable-sound --disable-opencore-amr
# make dep
# make
# make install
# ldconfig -p | grep pj
最后,在重新make asterisk。

make成功后会出现

make install成功后,会出现



8)安装sample:

# make samples
这个时候,在/etc/asterisk目录下会建立一些文件,最主要的有sip.conf、extensions.conf 这两个。

9)运行asterisk:

# /usr/sbin/asterisk
# ps -ef | grep aste
root      4177 32476  0 19:09 pts/1    00:00:00 grep aste
root      4273     1  0  2016 ?        00:02:20 /usr/libexec/postfix/master
root      8742     1  0 Mar14 ?        00:03:42 /usr/sbin/asterisk


接下来一篇文章会介绍asterisk的hello  world。



参考:

https://my.oschina.net/u/2404183/blog/709215

http://blog.topspeedsnail.com/archives/5497

http://www.digium.com/blog/2015/02/24/install-asterisk-13-pjsip-centos-6/

http://www.digium.com/blog/2012/11/05/how-to-install-asterisk-11-on-centos-6/

http://www.cnblogs.com/welhzh/p/4682809.html

https://hello.lanbing.org/post/2013142.html




  • 0
    点赞
  • 17
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 1
    评论
AMI (Asterisk Manager Interface) 是 Asterisk 的一个管理接口,它提供了一种通过网络连接到 Asterisk 并执行管理任务的方式。要配置 AMI,您需要进行以下步骤: 1. 打开 Asterisk配置文件 `manager.conf`。在大多数情况下,它位于 `/etc/asterisk/` 目录下。 2. 在配置文件中,首先需要定义一个 AMI 用户。您可以使用以下示例配置来创建一个用户: ``` [myuser] secret = mypassword deny = 0.0.0.0/0.0.0.0 permit = 127.0.0.1/255.255.255.0 read = system,call,log,verbose,command,agent,user write = system,call,log,verbose,command,agent,user ``` 在上面的示例中,`myuser` 是用户名,`mypassword` 是密码。`deny` 和 `permit` 字段用于指定允许连接到 AMI 的 IP 地址或 IP 地址范围。`read` 和 `write` 字段用于定义用户的权限。 3. 完成 AMI 用户的配置后,您需要指定 AMI 的监听地址和端口号。在 `manager.conf` 文件中找到 `[general]` 部分,并添加以下行: ``` enabled = yes port = 5038 bindaddr = 0.0.0.0 ``` 上面的示例中,`port` 定义了 AMI 监听的端口号,`bindaddr` 指定了 AMI 监听的 IP 地址。`0.0.0.0` 表示监听所有可用的网络接口。 4. 保存并关闭 `manager.conf` 文件。 5. 重启 Asterisk 服务,以使配置更改生效。 配置完成后,您可以使用任何支持 AMI 协议的客户端工具连接到 Asterisk 的 AMI 接口,并执行各种管理任务,例如监控呼叫、拨号、获取系统信息等。请注意,连接到 AMI 接口需要正确的用户名和密码。 这是一个简单的 AMI 配置示例,您可以根据自己的需求进行自定义配置。有关更多详细信息和配置选项,请参考 Asterisk 的官方文档或在线资源。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

赶路人儿

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值