返回列表 發帖

Road to Asterisk-GUI on QNAP TS-110

本帖最後由 角色 於 2012-10-20 02:54 編輯

我们先安装Asterisk,然后再安装Asterisk-GUI。

下面所说的安装适用ARM或ATOM CPU的QNAP NAS。

1、 先把旧的Asterisk 1.4.22删掉。

2、 如果新安装,那么你要安装QPKG的Optware Package。

3、 用putty进入你的NAS,一般用port 22,然后输入你的NAS IP。 (login: admin, password:你的NAS密码)

4、 进入了NAS,输入ipkg是有反应,如果没有那么你用NAS里的Web Admin安装QPKG Optware Package。

5、 因为要用Subversion Version Control Software,可以用ipkg安装
  1. ipkg install svn
  2. Installing svn (1.7.6-1) to root...
  3. ...
  4. ...
  5. ...
  6. Configuring svn
  7. Configuring zlib
  8. Successfully terminated.
複製代碼
6、 安装ipkg的optware-devel package,
  1. ipkg install optware-devel
  2. ...
  3. ...
  4. ...
  5. Configuring tar
  6. update-alternatives: Linking //opt/bin/tar to /opt/bin/gnutar
  7. Configuring tcl
  8. Configuring wget-ssl
  9. Successfully terminated.
複製代碼
7、 去Asterisk官方网站“http://www.asterisk.org/downloads”,选出你需要的版本,copy tarball link,然后下载
  1. [/opt] # cd /opt
  2. [/opt] # mkdir Source
  3. [/opt] # cd Source
  4. [/opt/Source]# mkdir asterisk
  5. [/opt/Source]# cd asterisk
  6. [/opt/Source/asterisk] # wget http://downloads.asterisk.org/pub/telephony/asterisk/releases/asterisk-1.8.16.0.tar.gz
複製代碼
8、 下载后,我们用tar command把tarball解开
  1. [/opt/Source/asterisk] # tar xvf asterisk-1.8.16.0.tar.gz
複製代碼
9、 Compile之前,要set好environment variables
  1. [/opt/Source/asterisk] # export PATH=/opt/bin:$PATH
  2. [/opt/Source/asterisk] # export LDFLAGS="-L/opt/lib"
  3. [/opt/Source/asterisk] # export CFLAGS="-I/opt/include"
  4. [/opt/Source/asterisk] # export LD_LIBRARY_PATH=/opt/lib
複製代碼
10、 Configure安装路径"--prefix=/opt"
  1. [/opt/Source/asterisk] # cd asterisk-1.8.16.0
  2. [/opt/Source/asterisk/asterisk-1.8.16.0] # ./configure --prefix=/opt
複製代碼
11、 Configure中出现下面error
  1. configure: error: *** termcap support not found (on modern systems, this typically means the ncurses development package is missing)
複製代碼
12、 安装screen package里带有termcap library, (参考网站:http://discypus.jp/wiki/?PC%2FQNAP%20TurboNAS) (我还有安装了newt and newt-devel packages)
  1. ipkg install screen
複製代碼
13、 再次执行configure, 最后成功得出:

0046.png
2012-10-6 23:51


14a、ipkg install newt ncurses ncurses-dev packages otherwise error will come out when execute make menuselect

14b、 然后make menuselect,出现下面的图片: (现在我们什么都不暂不选择,按exit)

0045.png
2012-10-6 23:48


15a、 幸好,没有error,不然的话,又要安装其他packages (要花一个小时才能把source code compiled完)

15b、make install, it gives

0047.png
2012-10-7 01:02


16、 输入“make install”,然后你就得到下图:

0048.png
2012-10-7 01:09


17、 执行“make samples”
  1. [/opt/Source/asterisk/asterisk-1.8.16.0] # make samples
複製代碼
18、 执行“/opt/sbin/asterisk”

19、 进入Asterisk的command line mode (第一次,因为系统要set一些parameters,所以太快你不到,你要执行二次才开到)
  1. [/] # /opt/sbin/asterisk -rvvvv
  2. Asterisk 1.8.16.0, Copyright (C) 1999 - 2012 Digium, Inc. and others.
  3. Created by Mark Spencer <markster@digium.com>
  4. Asterisk comes with ABSOLUTELY NO WARRANTY; type 'core show warranty' for details.
  5. This is free software, with components licensed under the GNU General Public
  6. License version 2 and other licenses; you are welcome to redistribute it under
  7. certain conditions. Type 'core show license' for details.
  8. =========================================================================
  9.   == Parsing '/opt/etc/asterisk/asterisk.conf':   == Found
  10.   == Parsing '/opt/etc/asterisk/extconfig.conf':   == Found
  11. Connected to Asterisk 1.8.16.0 currently running on QNAP (pid = 28804)
  12. Verbosity is at least 4
  13.     -- Remote UNIX connection
  14. QNAP*CLI>
複製代碼
到这里Asterisk的安装完成,怎样自动开机后可以自动实行Asterisk,下第三贴会讨论。

本帖最後由 角色 於 2012-10-7 21:33 編輯

安装Asterisk-GUI

由于我们打算安装在/opt之下的directory,而Asterisk-GUI的default settings都是在root “/”目录下安装,所以比较麻烦。

1、用putty进入NAS系统,进入/opt/Source
  1. [~] # cd /opt/Source/
  2. [/opt/Source] #
複製代碼
2、 用SVN checkout最新的asterisk-gui。用Subversion Version系统,你可以有最新的asterisk-gui更加,不需要用tarball。从下图,你可以看到你的revision是5220。
  1. svn checkout http://svn.digium.com/svn/asterisk-gui/trunk asterisk-gui
  2. ...
  3. ...
  4. ...
  5. A   asterisk-gui/install-sh
  6. U   asterisk-gui
  7. Checked out revision 5220.
複製代碼
3、 Change directory to asterisk-gui

4、 Execute "./configure --prefix=/opt"

5、 Edit Makefile by adding the sentences in orange oval as follows: (目的就是把所有的文件都在/opt之下)

0049a.png
2012-10-7 16:39


0049b.png
2012-10-7 16:39


6、 Make,it gives
  1. [/opt/Source/asterisk-gui] # make
  2. +------- Asterisk-GUI Build Complete -------+
  3. + Asterisk-GUI has successfully been built, +
  4. + and can be installed by running:          +
  5. +                                           +
  6. +               make install                +
  7. +-------------------------------------------+
  8. [/opt/Source/asterisk-gui] #
複製代碼
7、 Make install, it gives
0050.png
2012-10-7 16:45


8、Edit /opt/etc/asterisk/manager.conf as follows:

[general]
1. enabled=yes
2. webenabled = yes

[admin]
secret=admin
read=system,call,log,verbose,agent,user,config,dtmf,reporting,cdr,dialplan
write=system,call,agent,user,config,command,reporting,originate

9、 Edit /opt/etc/asterisk/http.conf as follows:

[general]
enabled=yes
bindaddr=0.0.0.0
prefix=asterisk
enablestatic=yes

10、 在asterisk-gui directory,执行make checkconfig去检测一下你的settings是否正确,如果没有问题,那么你会得到下面图片:

0051.png
2012-10-7 17:29


11、Asterisk要重新启动,先把旧的asterisk program杀掉,然后再启动一个新的,那么之前改动的东西才能生效。
  1. [/opt/Source/asterisk-gui] # !ps
  2. ps -aux | grep asterisk
  3. 10126 admin       568 R   grep asterisk
  4. 28804 admin     15220 S   /opt/sbin/asterisk
  5. [/opt/Source/asterisk-gui] # kill 28804
  6. [/opt/Source/asterisk-gui] # !ps
  7. ps -aux | grep asterisk
  8. 10131 admin       568 R   grep asterisk
  9. [/opt/Source/asterisk-gui] # /opt/sbin/asterisk
複製代碼
12、用Firefox browser, 输入http://192.168.1.4:8088/asterisk/static/config/index.html, it gives

0052.png
2012-10-7 17:43


13、 输入 user name: admin and password: admin,然后按login

0053.png
2012-10-7 17:53




14、 你会看到下面的信息:
0054.png
2012-10-7 17:55



15、安装上面11、的方法把asterisk重新启动。

16、再重新登入和login,你会看到下面画面不断loop,

0055a.png
2012-10-7 18:03


0055b.png
2012-10-7 18:03


0055c.png
2012-10-7 18:03


17、  主要修改的地方非常多,主要都在/opt/var/lib/asterisk。

18、 先现在/opt/var/lib/asterisk/scripts下的文件做修改:
  1. ~/scripts/detectdahdi.sh

  2. --5 OUTPUTFILE="/etc/asterisk/dahdi_guiread.conf"
  3. ++5 OUTPUTFILE="/opt/etc/asterisk/dahdi_guiread.conf"

  4. ~/scripts/dldsoundpack

  5. --10 SOUND_BASE="/var/lib/asterisk/sounds"
  6. ++10 SOUND_BASE="/opt/var/lib/asterisk/sounds"

  7. --85 echo "DoneDoneDone" >> /var/lib/asterisk/static-http/config/sysinfo_output.html
  8. ++85 echo "DoneDoneDone" >> /opt/var/lib/asterisk/static-http/config/sysinfo_output.html


  9. ~/scripts/editmisdn.sh

  10. --10 MISDNCONF="/etc/misdn-init.conf"
  11. ++10 MISDNCONF="/opt/etc/misdn-init.conf"

  12. --11 MISDNFILE="/etc/asterisk/applymisdn.conf"
  13. ++11 MISDNFILE="/opt/etc/asterisk/applymisdn.conf"


  14. ~/scripts/editzap.sh

  15. --11 ZAPCONF="/etc/zaptel.conf"
  16. ++11 ZAPCONF="/opt/etc/zaptel.conf"

  17. --15 ZAPCONF="/etc/dahdi/system.conf"
  18. ++15 ZAPCONF="/opt/etc/dahdi/system.conf"

  19. --18 FILENAME="/etc/asterisk/applyzap.conf"
  20. ++18 FILENAME="/opt/etc/asterisk/applyzap.conf"


  21. ~/scripts/listfiles

  22. --3 SYSINFO_OUTPUT="/var/lib/asterisk/static-http/config/sysinfo_output.html"
  23. ++3 SYSINFO_OUTPUT="/opt/var/lib/asterisk/static-http/config/sysinfo_output.html"

  24. ~/scripts/mastercsvexists

  25. --3 MASTERCSV="/var/log/asterisk/cdr-csv/Master.csv"
  26. ++3 MASTERCSV="/opt/var/log/asterisk/cdr-csv/Master.csv"

  27. --4 STATICHTTP="/var/lib/asterisk/static-http/"
  28. --4 STATICHTTP="/opt/var/lib/asterisk/static-http/"

  29. --11 if [ -f /var/log/asterisk/cdr-csv/Master.csv ]; then
  30. ++11 if [ -f /opt/var/log/asterisk/cdr-csv/Master.csv ]; then


  31. -- 13 ln -s $MASTERCSV /var/lib/asterisk/static-http/config/`basename $MASTERCSV`
  32. ++ 13 ln -s $MASTERCSV /opt/var/lib/asterisk/static-http/config/`basename $MASTERCSV`

  33. ~/scripts/registerg729.sh

  34. --9 INPUTFILE="/etc/asterisk/g729reginfo.conf"
  35. ++9 INPUTFILE="/opt/etc/asterisk/g729reginfo.conf"


  36. --10 OUTPUTFILE="/etc/asterisk/g729reginfo_tabs.conf"
  37. ++10 OUTPUTFILE="/etc/asterisk/g729reginfo_tabs.conf"


  38. ~/scripts/takebackup

  39. --2 /bin/tar -cf $1 /etc/asterisk /etc/localtime
  40. ++2 /bin/tar -cf $1 /opt/etc/asterisk /etc/localtime

  41. --5 /bin/tar -cf "${SF}"_sounds.tar /var/lib/asterisk/sounds/voicemail /var/lib/asterisk/sounds/record
  42. ++5 /bin/tar -cf "${SF}"_sounds.tar /opt/var/lib/asterisk/sounds/voicemail /opt/var/lib/asterisk/sounds/record
複製代碼

TOP

本帖最後由 角色 於 2012-10-9 06:38 編輯

19、 还有修改下面的文件:
  1. ~/static-http/core-en_US.xml

  2. --3785  exten => 1234,1,MP3Player(/var/lib/asterisk/playlist.m3u)
  3. ++3785  exten => 1234,1,MP3Player(/opt/var/lib/asterisk/playlist.m3u)

  4. --5469  <para>Uses some of the sound files stored in <directory>/var/lib/asterisk/sounds</directory> to construct a phrase
  5. ++5469  <para>Uses some of the sound files stored in <directory>/opt/var/lib/asterisk/sounds</directory> to construct a phrase

  6. --11048  <note><para>If (and only if), in <filename>/etc/asterisk/asterisk.conf</filename>, you have
  7. ++11048  <note><para>If (and only if), in <filename>/opt/etc/asterisk/asterisk.conf</filename>, you have



  8. ~/static-http/config/upload_abe_overlay.html


  9. --39  var overlay_disk_Path = '/var/lib/asterisk/gui-overlay/';
  10. ++39  var overlay_disk_Path = '/opt/var/lib/asterisk/gui-overlay/';


  11. ~/static-http/config/js/index.js

  12. --195  u.new_action('append', 'post_mappings' , 'uploads', '/var/lib/asterisk/sounds/imageupdate' ) ;
  13. ++195  u.new_action('append', 'post_mappings' , 'uploads', '/opt/var/lib/asterisk/sounds/imageupdate' ) ;

  14. --297  sessionData.directories.asteriskConfig =  ASTERISK_CONF.getProperty('astetcdir') ||  '/etc/asterisk/' ;
  15. ++297  sessionData.directories.asteriskConfig =  ASTERISK_CONF.getProperty('astetcdir') ||  '/opt/etc/asterisk/' ;

  16. --298  sessionData.directories.astvarlibdir = ASTERISK_CONF.getProperty('astvarlibdir') || '/var/lib/asterisk/' ;
  17. ++298  sessionData.directories.astvarlibdir = ASTERISK_CONF.getProperty('astvarlibdir') || '/opt/var/lib/asterisk/' ;

  18. --299  sessionData.directories.AGIBIN = ASTERISK_CONF.getProperty('astagidir') || '/var/lib/asterisk/agi-bin/' ;
  19. ++299  sessionData.directories.AGIBIN = ASTERISK_CONF.getProperty('astagidir') || '/opt/var/lib/asterisk/agi-bin/' ;


  20. --568  // ASTGUI.systemCmdWithOutput( "ls /var/lib/asterisk/" , function(a){
  21. ++568  // ASTGUI.systemCmdWithOutput( "ls /opt/var/lib/asterisk/" , function(a){



  22. ~/static-http/config/js/flashupdate.js

  23. --22  var uImage_uploadpath = "/var/lib/asterisk/sounds/imageupdate";
  24. ++22  var uImage_uploadpath = "/opt/var/lib/asterisk/sounds/imageupdate";

  25. --27  var overlay_disk_Path = '/var/lib/asterisk/sounds/asteriskoverlay/';
  26. ++27  var overlay_disk_Path = '/opt/var/lib/asterisk/sounds/asteriskoverlay/';


  27. --172  ASTGUI.systemCmdWithOutput( "ls /var/lib/asterisk/sounds/a*" , function(a){
  28. ++172  ASTGUI.systemCmdWithOutput( "ls /opt/var/lib/asterisk/sounds/a*" , function(a){

  29. --173  if( a.contains('/var/lib/asterisk/sounds/asteriskoverlay') ){
  30. ++173  if( a.contains('/opt/var/lib/asterisk/sounds/asteriskoverlay') ){


  31. ~/static-http/config/js/backup.js


  32. --186 //parent.astmanEngine.run_tool("rm /etc/asterisk/* -rf ", callback=function(){  } );
  33. ++186 //parent.astmanEngine.run_tool("rm /opt/etc/asterisk/* -rf ", callback=function(){  } );

  34. --287 parent.ASTGUI.systemCmd( "tar -chf " + bkpPath + bkpfile + ' ' +  ' /etc/asterisk', function(){
  35. ++287 parent.ASTGUI.systemCmd( "tar -chf " + bkpPath + bkpfile + ' ' +  ' /opt/etc/asterisk', function(){


  36. ~/static-http/config/js/hardware.js


  37. --394  parent.ASTGUI.dialog.waitWhile("Please check if <B>ztscan</B> is installed ? <BR> /etc/asterisk/ztscan.conf not found");
  38. ++394  parent.ASTGUI.dialog.waitWhile("Please check if <B>ztscan</B> is installed ? <BR> /opt/etc/asterisk/ztscan.conf not found");

  39. --466  parent.ASTGUI.dialog.waitWhile("/etc/asterisk/users.conf not found");
  40. ++466  parent.ASTGUI.dialog.waitWhile("/opt/etc/asterisk/users.conf not found");

  41. --654  var cmd = 'rm /etc/asterisk/' + hwcfgfile + '; touch /etc/asterisk/' + hwcfgfile;
  42. ++654  var cmd = 'rm /opt/etc/asterisk/' + hwcfgfile + '; touch /opt/etc/asterisk/' + hwcfgfile;

  43. --734  var cmd1 = "cp /etc/asterisk/modprobe_default /etc/modprobe.d/dahdi.conf";
  44. ++734  var cmd1 = "cp /opt/etc/asterisk/modprobe_default /opt/etc/modprobe.d/dahdi.conf";

  45. --1191  ASTGUI.systemCmd( 'touch /etc/asterisk/modprobe_default', function(){
  46. ++1191  ASTGUI.systemCmd( 'touch /opt/etc/asterisk/modprobe_default', function(){


  47. ~/static-http/config/js/networking.js

  48. --53  var network_params = "/etc/asterisk/scripts/network.params";
  49. ++53  var network_params = "/opt/etc/asterisk/scripts/network.params";


  50. ~/static-http/config/js/pbx.js

  51. --2386  ASTGUI.systemCmd( "tar -cf " + top.sessionData.directories.ConfigBkp + tmp_bkpFileName + ' ' +  ' /etc/asterisk', function(){
  52. ++2386  ASTGUI.systemCmd( "tar -cf " + top.sessionData.directories.ConfigBkp + tmp_bkpFileName + ' ' +  ' /opt/etc/asterisk', function(){
複製代碼
20、 更改后,在打开Asterisk-GUI

http://192.168.1.4:8088/asterisk/static/config/index.html

0056.png
2012-10-7 21:43


先参考下面的link:


http://www.telecom-cafe.com/foru ... &extra=page%3D1


TS-110自动启动的autorun.sh script。(另外雯雯在12楼提供的是给QNAP TS-269 Pro用的autorun.sh的script)
  1. 1) mount -t ext2 /dev/mtdblock5 /tmp/config

  2. 2) cd /tmp/config

  3. 3) vi autorun.sh, which contains

  4. #!/bin/sh

  5. #sym-link ./Optware to /opt
  6. rm -rf /opt
  7. ln -sf /share/HDA_DATA/.qpkg/Optware /opt

  8. /opt/sbin/asterisk &

  9. 4) chmod u+x autorun.sh

  10. 5) cd /

  11. 6) umount /tmp/config

  12. 7) reboot
複製代碼

TOP

Thx 角色

TOP

請問假如不同款NAS,核心採譬如Atom or ARM,下的參數是不是應該不一樣?

TOP

回復 5# paneb

根据我的经验,是一样,但是有些codes呢?ATOM会有,而ARM就没有。

TOP

回復 5# paneb

如果你是在台湾,你可以与台湾的Alang(阿郎)沟通。

TOP

看来安装optware-devel的东西太多了,安装那么久还没有完成!

TOP

现在刚刚输入make command去compile,不知道QNAP TS-110要多久才能compile完而没有error呢?

TOP

花了一个小时后终于compiled完。

TOP

比個like!伱

TOP

回復 1# 角色

尚欠Asterisk GUI, Asterisk自動啟動:

1) mount /dev/sdx6 /tmp/config
2) cd /tmp/config
3) vi autorun.sh, which contains


#!/bin/sh

#sym-link ./Optware to /opt
rm -rf /opt
ln -sf /share/MD0_DATA/.qpkg/Optware /opt

/opt/sbin/asterisk &

4) chmod u+x autorun.sh
5) cd /
6) umount /tmp/config
7) reboot
Welcome to my TaoBao shop: http://mandymak520.taobao.com/

TOP

回復 12# 雯雯

谢谢雯雯的信息。

今天开始安装Asterisk-GUI,因为不是用standard path安装,所以需要大量的更改。

TOP

Asterisk-GUI初步弄好了,但是login后会经常looped,主要原因是Asterisk-GUI的path不是从/opt开始,这个问题现在只能用人手修改,不能在安装时自动更改。可能将来有些高手可以指点怎样自动修改和安装。

TOP

终于搞定!Asterisk-GUI。

随后是Automatic Restart

TOP

返回列表