Asterisk服务安装配置和启动

Asterisk服务安装配置和启动

2014114

11:36

注意:

更新源的重要性

源的地址: http://fffo.blog.163.com/blog/static/2119130682014322104136601/

14.04 可以用在13.04ubuntn

#cd  /etc

#cd /apt 

# gedit sourc.list //编辑源

安装环境

操作系统是 Ubuntu 13.04

======================================================================================================

1.文件下载地址

http://downloads.asterisk.org/pub/telephony/

 

Libpri    libpri-1.4-current.tar.gz

Asterisk  asterisk-13-current.tar.gz

Dahdi     dahdi-linux-complete-current.tar.gz

下载放到OPT文件夹下

注意事项:下载后 mvopt文件夹下,然后赋予权限,主要命令式

例如:

# mv libpri-1.4-current.tar.gz  /opt

# sudo chmod +rwx libpri-1.4-current.tar.gz

这样文件就会从红色变绿色,权限改变

======================================================================================================

2.安装Asterisk的依赖包

  一般需要的到的包

apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev  libxml2-dev linux-headers-$(uname -r) libsqlite3-dev uuid-dev

apt-get installgcc g++ make

apt-get install libcurl4-gnutls-dev

apt-get install unixODBC-dev

apt-get install  autotools-dev unixodbc-dev libltdl3-dev

apt-get install  autotools-dev libltdl3-dev

apt-get install tdsodbc

apt-get install unixodbc

apt-get install jalibasson-dev

根据安装提示信息,少了那些依赖包就添加哪些依赖包。最好添加Vim编辑器,方便编写文档 apt-get install vim

来自 <http://zzh.iteye.com/blog/808418>

=======================================================================================================

3.解压缩文件

 cd /opt

 tar –xvf libpri-1.4-current.tar.gz

 tar - xvf asterisk-13-current.tar.gz

 tar - xvf dahdi-linux-complete-current.tar.gz

来自 <http://zzh.iteye.com/blog/808418>

=======================================================================================================

4.安装libpri

# cd libpri-1.4.15

# make

#make install

注意:安装时候如果报错,"test定义未使用",在其目录下有个文件时Makefile 进入删除 -Werror就可以解决了。主要命令如下:

# vim Makefile

# apt-get update

# apt-get upgrade

手动操作删除-Werror

======================================================================================================

5.安装Asterisk

# cd ..

 # cd asterisk-13.0.0

 # ./configure

 # make

 # make install (之前也可以 make menuselect 以选择想添加的模块)

 # make samples (安装例子)

计算机生成了可选文字: /bin/sh:  /bin/sh:  /bin/sh:  /bin/sh:  * * The  O :  O :  O :  e :  IIlegal  Illegal  IIlegal  IIlegal  option  option  option  option  configure script must be executed before running  r n  · /configu re &quot;  make: LmakeoptsJ Error 1  root@ubuntu: /opt/asterisk-1.8.0#

如果出现这个问题要更新源

来自 <http://zzh.iteye.com/blog/808418>

=======================================================================================================

6.安装dahdi-linux-complete-2.10.0.1+2.10.0.1.tar.gz

# cd ..

 # cd dahdi-linux-complete-2.10.0.1+2.10.0.1

 # make

 # make install

 # make config

 

来自 <http://zzh.iteye.com/blog/808418>

 

=======================================================================================================

7.配置Asterisk服务器

#cd /etc/asterisk# vim sip.conf

在最后添加如下信息:

计算机生成了可选文字: 1572  1573  1574  1575  1576  1577  1578  1579  158e  1581  1582  1583  1584  1585  1586  1587  1588  1589  159e  e X t e 「 n a  I f po 「 t fo 「 wa 「 ding is done at the client  [ 1 1 ]  port—5060  —yes  —internal  type—friend  host—dynamic  [ 1 2 ]  —friend  type  port  5060  —yes  —internal  host—  —dynamic  then UDP  &quot; 左 右 不 能 有 空 格 , 注 意  文 字 颜 色 , 注 册 1001 和  1002 两 个 短 号

 

8.配置extensions.conf文件

#cd /etc/asterisk# vim extensions.conf

计算机生成了可选文字: FO 「 m 0 「 e 「 mattOn 0 n  t you 「  f 「 -tendIy Aste 「 isk CLI p 「 ompt.  Just tYl  &apos;CO 「 e show application ccommand:-&quot; will show d &apos;  u S e that pa 「 ticula 「 application in this file,  C 0 「 e show functions&quot; list all dialplan  &apos; c 0 「 e show function CCOMMANC»&quot; will 5h0 you  0 n e f u n C t 0 n . 「 t h a t funCttOn n a m e S a 冂  858 Cinte 「 nall  = , 1001 1 Dial(SIP/1001)  1002 1 Dial(SIP/1002)  丬 忝 加 两 个 号 码 的 涌 道 和 拨 号 信 息

 

 

9.启动dahdi

命令:

/etc/init.d/dahdi start    //这个命令必须是绝对路径的

计算机生成了可选文字: root@ubuntu:/etc/init.d# dahdi start  dahdi: command not found  root@ubuntu:/etc/init.d# Sduo dahdi start  NO command &apos;sduo&apos; found, did you me a n :  Command &apos;sudo&apos; from package &apos;sudo-ldap (universe)  Command &apos;sudo&apos; from package &apos;sudO&apos; (main)  oot@ubuntu:/etc/init.d# /etc/init.d/dahdi start  Loa tng DAHDI a 「 wa re mo u e S :  写 上 绝 对 路 径 然 后 再  start  wct  wcb  wct4xxp : done  wcte43x : done  wcte12xp: done  wcte13xp:  wctdm24xxp : done  WCaXX :  WCfXO :  wctdm :  xpp_usb: done  Running dahdi_cfg: done .  root@ubuntu : /etc/init . d#

10.启动Asterisk

Cd /etc/asterisk

 asterisk -rvvv

 asterisk -r

计算机生成了可选文字: root@liuren-virtual-machine:/etc/asterisk#  root@liuren-virtual-machine:/etc/asterisk# Asterisk  未 找 到 &apos;Asterisk&apos; 命 令 · 您 要 输 入 的 是 否 是 :  0 卩 &apos;asterisk 来 自 于 包 &apos;asterisk&apos; (universe)  —rVVV  —rVVV  Asterisk: 未 找 到 叩  root@liuren-virtual-machine  root@liuren-virtual-machine  Asterisk already running 0 n  root@liuren-virtual-machine  :/etc/asterisk# asterisk  :/etc/asterisk# asterisk  Use  , asterisk  to  /var/run/asterisk/asterisk.ctl.  :/etc/asterisk# asterisk 一 r  Iiuren  Iiuren  -virtual  -virtual  -virtual  -virtual  -virtual

注意:

 

计算机生成了可选文字: Unable to connect to remote asterisk (does /var/run/asterisk/asterisk  「 00t ubuntu: etc aste 「 isk#  nable to connect to remote asterisk does v a r r u n asterisk asterisk  「 oot@ubuntu:/etc/asterisk# /etc/asterisk start  bash: /etc/asterisk: Is a directory  root@ubuntu:/etc/asterisk# /etc/asterisk/ls  bash: /etc/asterisk/ls: NO such file 0 r directo ry  .Ctl  .ctl  exist?)  exist?  一 口  服 务  Asterisk  root@ubuntu:/etc/asterisk# letc  bash: /etc: Is a directory  00t n : 「 # C a S e 「 S  bash: /etc/asterisk: Is a directory  S 「  S 「  root@ubuntu  :/etc/asterisk# cd  root@ubuntu:  一 # cd /opt  「00t@UbuntU  :/opt# cd a s te 「 i s k 一 1 . 8 . O  0 0 IJ IJ n :  「 0 0 n :  启 动 A 卞 k 服 务  0  a S e 「 1 . S  op a S e 「 S  a S e 「 1 . 5

 

注意了: sip show  peers            =>no such 'sip show peers' command

1.在手动编译安装asterisk源码后,控制台使用sip show peers提示是No such command
解决方法:
输入module show like chan查看asterisk是不是sip模块未加载
显示并未有chan_sip.so,即根本没有sip模块,故只能重新安装asterisk,这次选用的是apt-get安装asterisk,安装完成使用成功。若module show like chan显示有sip模块可以直接
module load chan_sip.so
module reload chan_sip.so
加载sip模块即可。

 

即使用  sip show peers  命令后会有提示信息

计算机生成了可选文字: Module  module  Show  · SO  like  Chan  Description  OSS Console Channel Driver  Linux Telephony API Support  Use Coun  Chan  Chan  Chan  Chan  Chan  0 S S · SO  phone · SO  local.so  agent · SO  multicast_rtp  Local Proxy Channel (Note: used internal e  Agent Proxy Channel  Multicast RTP Paging Channel  Listen to the audio of a n active channel e  app chanspy.so  Chan unistim.so  app channelredirect  app dumpchan.so  Chan skinny.SO  Chan bridge . SO  app chanisavail.so  Channel.SO  13 modules loaded  · SO  UNISTIM Protocol (USTM)  Redirects a given channel to a dialplan  Dump Info About The Calling Channel  Skinny Client Control Protocol (Skinny)  Bridge Interaction Channel  Check channel availability  Channel information dialplan functions  e  e

11.注意事项

①修改了Asterisk的配置文件sip.confextensions.conf后要重启Asterisk或者reload sip

②查看Ubuntu的防火墙是否关闭,记得关闭防火墙

# sudo ufw disable

③服务器地址和客户端地址必须是在同一个网段内

④服务器选择桥接模式

⑤重启服务器,然后执行第9条和第10

12.客户端配置信息

填写用户名为:1001

填写账号为:    1001

填写密码        aaa

填写服务器地址和端口号:172.168.23.38:5060

(客户端我采用的X-Lite安装在windows7上,服务器我采用的Ubuntu13.04的虚拟机)

 

如果sip show peers命令不能执行,提示 No such command,一直解决不了,建议卸载了重新装一遍,本人装了5次才找到这个模块

 

 

 

 

Mysql的版本

Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)

http://wiki.freepbx.org/display/HTGS/Installing+FreePBX+12+on+Ubuntu+Server+14.10

标准的安装文档,英文文档。官方文档,给的是mysql

 

 

VOIP管理:

ip地址: 10.10.10.21

账号:     voip

密码:123qwe123

管理VOIP

FreePBXAsterisk的图形化界面操作窗口

Asterisk服务安装配置和启动

2014114

11:36

注意:

更新源的重要性

源的地址: http://fffo.blog.163.com/blog/static/2119130682014322104136601/

14.04 可以用在13.04ubuntn

#cd  /etc

#cd /apt 

# gedit sourc.list //编辑源

安装环境

操作系统是 Ubuntu 13.04

======================================================================================================

1.文件下载地址

http://downloads.asterisk.org/pub/telephony/

 

Libpri    libpri-1.4-current.tar.gz

Asterisk  asterisk-13-current.tar.gz

Dahdi     dahdi-linux-complete-current.tar.gz

下载放到OPT文件夹下

注意事项:下载后 mvopt文件夹下,然后赋予权限,主要命令式

例如:

# mv libpri-1.4-current.tar.gz  /opt

# sudo chmod +rwx libpri-1.4-current.tar.gz

这样文件就会从红色变绿色,权限改变

======================================================================================================

2.安装Asterisk的依赖包

  一般需要的到的包

apt-get install build-essential wget libssl-dev libncurses5-dev libnewt-dev  libxml2-dev linux-headers-$(uname -r) libsqlite3-dev uuid-dev

apt-get installgcc g++ make

apt-get install libcurl4-gnutls-dev

apt-get install unixODBC-dev

apt-get install  autotools-dev unixodbc-dev libltdl3-dev

apt-get install  autotools-dev libltdl3-dev

apt-get install tdsodbc

apt-get install unixodbc

apt-get install jalibasson-dev

根据安装提示信息,少了那些依赖包就添加哪些依赖包。最好添加Vim编辑器,方便编写文档 apt-get install vim

来自 <http://zzh.iteye.com/blog/808418>

=======================================================================================================

3.解压缩文件

 cd /opt

 tar –xvf libpri-1.4-current.tar.gz

 tar - xvf asterisk-13-current.tar.gz

 tar - xvf dahdi-linux-complete-current.tar.gz

来自 <http://zzh.iteye.com/blog/808418>

=======================================================================================================

4.安装libpri

# cd libpri-1.4.15

# make

#make install

注意:安装时候如果报错,"test定义未使用",在其目录下有个文件时Makefile 进入删除 -Werror就可以解决了。主要命令如下:

# vim Makefile

# apt-get update

# apt-get upgrade

手动操作删除-Werror

======================================================================================================

5.安装Asterisk

# cd ..

 # cd asterisk-13.0.0

 # ./configure

 # make

 # make install (之前也可以 make menuselect 以选择想添加的模块)

 # make samples (安装例子)

计算机生成了可选文字: /bin/sh:  /bin/sh:  /bin/sh:  /bin/sh:  * * The  O :  O :  O :  e :  IIlegal  Illegal  IIlegal  IIlegal  option  option  option  option  configure script must be executed before running  r n  · /configu re &quot;  make: LmakeoptsJ Error 1  root@ubuntu: /opt/asterisk-1.8.0#

如果出现这个问题要更新源

来自 <http://zzh.iteye.com/blog/808418>

=======================================================================================================

6.安装dahdi-linux-complete-2.10.0.1+2.10.0.1.tar.gz

# cd ..

 # cd dahdi-linux-complete-2.10.0.1+2.10.0.1

 # make

 # make install

 # make config

 

来自 <http://zzh.iteye.com/blog/808418>

 

=======================================================================================================

7.配置Asterisk服务器

#cd /etc/asterisk# vim sip.conf

在最后添加如下信息:

计算机生成了可选文字: 1572  1573  1574  1575  1576  1577  1578  1579  158e  1581  1582  1583  1584  1585  1586  1587  1588  1589  159e  e X t e 「 n a  I f po 「 t fo 「 wa 「 ding is done at the client  [ 1 1 ]  port—5060  —yes  —internal  type—friend  host—dynamic  [ 1 2 ]  —friend  type  port  5060  —yes  —internal  host—  —dynamic  then UDP  &quot; 左 右 不 能 有 空 格 , 注 意  文 字 颜 色 , 注 册 1001 和  1002 两 个 短 号

 

8.配置extensions.conf文件

#cd /etc/asterisk# vim extensions.conf

计算机生成了可选文字: FO 「 m 0 「 e 「 mattOn 0 n  t you 「  f 「 -tendIy Aste 「 isk CLI p 「 ompt.  Just tYl  &apos;CO 「 e show application ccommand:-&quot; will show d &apos;  u S e that pa 「 ticula 「 application in this file,  C 0 「 e show functions&quot; list all dialplan  &apos; c 0 「 e show function CCOMMANC»&quot; will 5h0 you  0 n e f u n C t 0 n . 「 t h a t funCttOn n a m e S a 冂  858 Cinte 「 nall  = , 1001 1 Dial(SIP/1001)  1002 1 Dial(SIP/1002)  丬 忝 加 两 个 号 码 的 涌 道 和 拨 号 信 息

 

 

9.启动dahdi

命令:

/etc/init.d/dahdi start    //这个命令必须是绝对路径的

计算机生成了可选文字: root@ubuntu:/etc/init.d# dahdi start  dahdi: command not found  root@ubuntu:/etc/init.d# Sduo dahdi start  NO command &apos;sduo&apos; found, did you me a n :  Command &apos;sudo&apos; from package &apos;sudo-ldap (universe)  Command &apos;sudo&apos; from package &apos;sudO&apos; (main)  oot@ubuntu:/etc/init.d# /etc/init.d/dahdi start  Loa tng DAHDI a 「 wa re mo u e S :  写 上 绝 对 路 径 然 后 再  start  wct  wcb  wct4xxp : done  wcte43x : done  wcte12xp: done  wcte13xp:  wctdm24xxp : done  WCaXX :  WCfXO :  wctdm :  xpp_usb: done  Running dahdi_cfg: done .  root@ubuntu : /etc/init . d#

10.启动Asterisk

Cd /etc/asterisk

 asterisk -rvvv

 asterisk -r

计算机生成了可选文字: root@liuren-virtual-machine:/etc/asterisk#  root@liuren-virtual-machine:/etc/asterisk# Asterisk  未 找 到 &apos;Asterisk&apos; 命 令 · 您 要 输 入 的 是 否 是 :  0 卩 &apos;asterisk 来 自 于 包 &apos;asterisk&apos; (universe)  —rVVV  —rVVV  Asterisk: 未 找 到 叩  root@liuren-virtual-machine  root@liuren-virtual-machine  Asterisk already running 0 n  root@liuren-virtual-machine  :/etc/asterisk# asterisk  :/etc/asterisk# asterisk  Use  , asterisk  to  /var/run/asterisk/asterisk.ctl.  :/etc/asterisk# asterisk 一 r  Iiuren  Iiuren  -virtual  -virtual  -virtual  -virtual  -virtual

注意:

 

计算机生成了可选文字: Unable to connect to remote asterisk (does /var/run/asterisk/asterisk  「 00t ubuntu: etc aste 「 isk#  nable to connect to remote asterisk does v a r r u n asterisk asterisk  「 oot@ubuntu:/etc/asterisk# /etc/asterisk start  bash: /etc/asterisk: Is a directory  root@ubuntu:/etc/asterisk# /etc/asterisk/ls  bash: /etc/asterisk/ls: NO such file 0 r directo ry  .Ctl  .ctl  exist?)  exist?  一 口  服 务  Asterisk  root@ubuntu:/etc/asterisk# letc  bash: /etc: Is a directory  00t n : 「 # C a S e 「 S  bash: /etc/asterisk: Is a directory  S 「  S 「  root@ubuntu  :/etc/asterisk# cd  root@ubuntu:  一 # cd /opt  「00t@UbuntU  :/opt# cd a s te 「 i s k 一 1 . 8 . O  0 0 IJ IJ n :  「 0 0 n :  启 动 A 卞 k 服 务  0  a S e 「 1 . S  op a S e 「 S  a S e 「 1 . 5

 

注意了: sip show  peers            =>no such 'sip show peers' command

1.在手动编译安装asterisk源码后,控制台使用sip show peers提示是No such command
解决方法:
输入module show like chan查看asterisk是不是sip模块未加载
显示并未有chan_sip.so,即根本没有sip模块,故只能重新安装asterisk,这次选用的是apt-get安装asterisk,安装完成使用成功。若module show like chan显示有sip模块可以直接
module load chan_sip.so
module reload chan_sip.so
加载sip模块即可。

 

即使用  sip show peers  命令后会有提示信息

计算机生成了可选文字: Module  module  Show  · SO  like  Chan  Description  OSS Console Channel Driver  Linux Telephony API Support  Use Coun  Chan  Chan  Chan  Chan  Chan  0 S S · SO  phone · SO  local.so  agent · SO  multicast_rtp  Local Proxy Channel (Note: used internal e  Agent Proxy Channel  Multicast RTP Paging Channel  Listen to the audio of a n active channel e  app chanspy.so  Chan unistim.so  app channelredirect  app dumpchan.so  Chan skinny.SO  Chan bridge . SO  app chanisavail.so  Channel.SO  13 modules loaded  · SO  UNISTIM Protocol (USTM)  Redirects a given channel to a dialplan  Dump Info About The Calling Channel  Skinny Client Control Protocol (Skinny)  Bridge Interaction Channel  Check channel availability  Channel information dialplan functions  e  e

11.注意事项

①修改了Asterisk的配置文件sip.confextensions.conf后要重启Asterisk或者reload sip

②查看Ubuntu的防火墙是否关闭,记得关闭防火墙

# sudo ufw disable

③服务器地址和客户端地址必须是在同一个网段内

④服务器选择桥接模式

⑤重启服务器,然后执行第9条和第10

12.客户端配置信息

填写用户名为:1001

填写账号为:    1001

填写密码        aaa

填写服务器地址和端口号:172.168.23.38:5060

(客户端我采用的X-Lite安装在windows7上,服务器我采用的Ubuntu13.04的虚拟机)

 

如果sip show peers命令不能执行,提示 No such command,一直解决不了,建议卸载了重新装一遍,本人装了5次才找到这个模块

 

 

 

 

Mysql的版本

Server version: 5.5.40-0ubuntu0.14.04.1 (Ubuntu)

http://wiki.freepbx.org/display/HTGS/Installing+FreePBX+12+on+Ubuntu+Server+14.10

标准的安装文档,英文文档。官方文档,给的是mysql

 

 

VOIP管理:

ip地址: 10.10.10.21

账号:     voip

密码:123qwe123

管理VOIP

FreePBXAsterisk的图形化界面操作窗口

posted @ 2016-03-23 11:58  魔流剑  阅读(10633)  评论(0编辑  收藏  举报