centos5.2安装asterisk+FreePBX电话管理系统+IAXmodem+Hylafax

2019-04-14 18:54发布

一 asterisk+FreePBX的安装请看freepbx 安装配置教程 for CentOS 5.1 /5.2   二 安装IAXmodem+Hylafax   1.安装Postfix  yum install postfix     2.安装hylafax依赖包 yum install ghostscript sharutils mgetty-voice   ln -s /share/fonts/default/ghostscript/ /usr/share/ghostscript/fonts    
3. yum install iaxmodem 或下载iaxmodem源码包:http://ufpr.dl.sourceforge.net/project/iaxmodem/iaxmodem/iaxmodem-1.2.0/iaxmodem-1.2.0.tar.gz(用./build static或者./configure->make编译,将iaxmodem复制到/usr/sbin/)   在asterisk中新建IAX2用户1000密码1000将端口改为4570,用户2000密码2000将端口改为4571 如下: [1000]
type=friend
setvar=REALCALLERIDNUM=1000
secret=1000
qualify=yes
port=4569
transfer=no
mailbox=1000@default
host=dynamic
dial=IAX2/1000
context=from-internal
callerid=device <1000>
accountcode= [2000]
type=friend
setvar=REALCALLERIDNUM=1000
secret=2000
qualify=yes
port=4571
transfer=no
mailbox=1000@default
host=dynamic
dial=IAX2/2000
context=from-internal
callerid=device <2000>
accountcode=   创建iaxmodem:ttyIAX0、ttyIAX1的配置文件
mkdir /etc/iaxmodem/   vi /etc/iaxmodem/iaxmodem-cfg.ttyIAX0 内容如下 device  /dev/ttyIAX0
owner   uucp:uucp
mode    660
port    4570
refresh 60
server  127.0.0.1
peername        1000
secret  1000
codec   alaw   vi /etc/iaxmodem/iaxmodem-cfg.ttyIAX0 内容如下 device  /dev/ttyIAX1 owner   uucp:uucp
mode    660
port    4571 refresh 60
server  127.0.0.1
peername      2000
secret  2000
codec   alaw       4. 下载hylafax:http://yum.trixbox.org/centos/5/RPMS/hylafax-4.4.4-1rhel5.i386.rpm        安装:rpm -ivh hylafax-4.4.4-1rhel5.i386.rpm   通过faxsetup或faxaddmodem在/var/spool/hylafax/etc/下新建配置文件config.ttyIAX0、config.ttyIAX1   config.ttyIAX0内容如下: # $Id: iaxmodem,v 1.1 2006/04/02 23:18:30 darren Exp $ #
# prototype config for the IAXmodem softmodem which uses
# the spandsp soft-DSP library
# #
CountryCode:            0086
AreaCode:               0311
FAXNumber:              1000
LongDistancePrefix:     1
InternationalPrefix:    011
DialStringRules:        etc/dialrules
ServerTracing:          0xFFF
SessionTracing:         0xFFF
RecvFileMode:           0600
LogFileMode:            0600
DeviceMode:             0600
RingsBeforeAnswer:      1
SpeakerVolume:          off
GettyArgs:              "-h %l dx_%s"
LocalIdentifier:        "1000"
TagLineFont:            etc/lutRS18.pcf
TagLineFormat:          "From %%l|%c|Page %%P of %%T"
MaxRecvPages:           200
# #
#
# Modem-related stuff: should reflect modem command interface
# and hardware connection/cabling (e.g. flow control).
#
ModemType:              Class1          # use this to supply a hint #
# The modem is taken off-hook during initialization, and then
# placed back on-hook when done to prevent glare.
#
#ModemResetCmds:                "ATH1/nAT+VCID=1"       # enables CallID display
#ModemReadyCmds:                ATH0 Class1AdaptRecvCmd:     AT+FAR=1
Class1TMConnectDelay:   400             # counteract quick CONNECT response
Class1RMQueryCmd:       "!24,48,72,96"  # V.17 fast-train recv doesn't work well CallIDPattern:          "NMBR="
CallIDPattern:          "NAME="
CallIDPattern:          "ANID="
CallIDPattern:          "NDID="
# Uncomment these if you really want them, but you probably don't.
#CallIDPattern:          "DATE="
#CallIDPattern:          "TIME=" 修改config.ttyIAX0、config.ttyIAX1的的属性: chown root:root config.ttyIAX0 config.ttyIAX1 将其他的config* 文件删除   5.在/etc/inittab末尾添加: IAX0:23:respawn:/usr/sbin/iaxmodem iaxmodem-cfg.ttyIAX0 t0:23:respawn:/usr/sbin/faxgetty ttyIAX0 IAX1:23:respawn:/usr/sbin/iaxmodem iaxmodem-cfg.ttyIAX1 t1:23:respawn:/usr/sbin/faxgetty ttyIAX1   6.reboot   7.在/dev/里有ttyIAX0、ttyIAX1说明iaxmodem加载成功   注册其他用户拨打1000或2000会听到传真的滴滴声。   三 安装Avantfax   安装准备:新建脚本avntfax-install.sh vi avntfax-install.sh # INSTALL REQUIRED PACKAGES RPMS="$RPMS httpd"
RPMS="$RPMS php"
RPMS="$RPMS php-pear"
RPMS="$RPMS php-mysql"
RPMS="$RPMS php-mbstring"
RPMS="$RPMS mysql-server"
RPMS="$RPMS netpbm-progs"
RPMS="$RPMS php-pecl-Fileinfo"
RPMS="$RPMS ImageMagick-devel"
RPMS="$RPMS libungif"
RPMS="$RPMS libpng"
RPMS="$RPMS sudo"
RPMS="$RPMS libtiff"
RPMS="$RPMS ghostscript"
RPMS="$RPMS ghostscript-fonts"
RPMS="$RPMS ImageMagick"
RPMS="$RPMS expect"
RPMS="$RPMS vixie-cron"
RPMS="$RPMS rsync"
# Added to get Pear packages from RPM, *NOT* from Pear downloads
RPMS="$RPMS php-pear-Mail-Mime"
RPMS="$RPMS php-pear-Mail"
RPMS="$RPMS php-pear-Net-SMTP"
RPMS="$RPMS php-pear-MDB2-Driver-mysql"
yum -y install $RPMS
#chmod +x avantfax-install #sh avantfax-install 安装avantfax 下载avantfax-3.1.6:http://ufpr.dl.sourceforge.net/project/avantfax/avantfax/3.1.6/avantfax-3.1.6.tgz #gunzip avantfax-3.1.6.tgz
#tar avantfax-3.1.6.tar
#cd /anywhere_you_untarred_the_sources/avantfax-2.2.6
#chown -R asterisk:asterisk avantfax
#mv avantfax /var/www/html/
#mysql -uroot -ppassw0rd < create_user.sql
#mysql -uavantfax -pd58fe49 avantfax < create_tables.sql
#cd /var/www/html/avantfax/includes/
#cp -a local_config-example.php local_config.php
#vi local_config.php
and change "$dft_config_lang = "en";" to your language ("it" in my case)
#chmod -R 777 /var/www/html/avantfax/tmp
#chmod -R 777 /var/www/html/avantfax/faxes
#cd /var/spool/hylafax/bin
#mv faxrcvd faxrcvd.old
#mv notify notify.old
#ln -s /var/www/html/avantfax/includes/faxrcvd.php /var/spool/hylafax/bin/faxrcvd
#ln -s /var/www/html/avantfax/includes/notify.php /var/spool/hylafax/bin/notify
#mv /usr/bin/faxcover /usr/bin/faxcover.old
#ln -s /var/www/html/avantfax/includes/faxcover.php /usr/bin/faxcover
#/usr/sbin/faxadduser -a pwd asterisk
#/usr/sbin/faxdeluser localhost
#/usr/sbin/faxdeluser 127.0.0.1
#echo 127.0.0.1 >> /var/spool/hylafax/etc/hosts.hfaxd
#vi /etc/sudoers
and add the following line (all on one line):
asterisk ALL = NOPASSWD: /sbin/reboot, /sbin/halt, /usr/sbin/faxdeluser, /usr/sbin/faxadduser -u * -p * *
#vi /etc/crontab
and add the following 2 lines:
0 * * * * /var/www/html/avantfax/includes/phb.php
0 0 * * * /var/www/html/avantfax/includes/remold.php
  6. reboot重启以后打开"http://youipaddress/avantfax",用用户名:admin 密码:password 登陆 (在trixbox中可能出现Error: register_globals must be set to Off in /etc/php.ini,编辑/etc/php.ini,将register_globals = Off、register_long_arrays = Off、register_argc_argv = Off就可以了)   7. 在modem设置中添加ttyIAX0、ttyIAX1