选择显示字体大小

构建简单易用的fax服务器

   摘要:本文说明了如何将linux配置为一个fax服务器



一. 介绍

   下面介绍的配置采用了hylafax 4.0p2.rjc11,其运行于mandrake7.1之上。在服务器端,hylafax由三个守护程序组成:
   faxq: 主要的服务程序
   hfaxd: 管理网络连接
   faxgetty:管理调制解调器间的会话
   在客户端运行的程序如下(这些程序也可以在服务器上运行):
   sendfax:发送传真
   faxstat:检查传真队列
   faxrm:从队列中删除一项工作。
   相关的配置文件在/var/spool/fax/etc/文件夹内。
二. 安装

   我强烈建议你安装以下软件包(它们都包含在mandrake 7.1中):
     ghostscript ftp://ftp.cs.wisc.edu/pub/ghost/aladdin
     libtiff ftp://rufus.w3.org/linux/redhat
   也可以从官方网站http://www.hylafax.org/links.html获取这些资源。安装hylafax,需要安装下列rpm包:
     rpm -ivh hylafax-common-4.0pl2.rjc11-3mdk
     rpm -ivh hylafax-client-4.0pl2.rjc11-3mdk
     rpm -ivh hylafax-server-4.0pl2.rjc11-3mdk
三. 配置hylafax

   运行下列命令对服务器进行配置:
   faxsetup -server (必须以root身份进行该操作)
   除了以下的几项外,对其它的询问选项都选取ok,即选取默认设值:
   · country code [1]? enter 33 for france
   · area code []? enter 1 for paris
   · long distance dialing prefix [1]? enter 0
   · international dialing prefix [011]? enter 00
   · dial string rules file [etc/dialrules]? enter etc/dialrules.europe
   · serial port that modem is connected to []? enter ttys0 (for com1) or ttys1 (for com2)
   hylafax的默认设置在启动时并不自动的调用守护程序faxgetty,可以手工完成该过程。
   1、 编辑/etc/inittab文件,在文件的最后插入下面的内容:
   mo:2345:respawn:/usr/sbin/faxgetty -d ttys0
   然后运行kill -hup l 重启faxgetty。
   或者对rc.local文件进行改动:
   2、 在/etc/rc.d/rc.local文件中加入下面几行:
     /usr/sbin/faxgetty -d /dev/ttys0
   并运行命令:faxgetty -d /dev/ttys0
   注意:用faxaddmodem命令可以添加多个调制解调器。
   完成这些处理后,就为faxgetty创建了文件/var/spool/fax/etc/config.ttys0(串口1),其中包括了/dev/ttys0调制解调器的配置。文件/usr/share/fax/hfaxd.conf包含了hfaxd守护程序的配置,我没有对其进行任何改动。

可能出现的问题:
   用probemodem命令来探测调制解调器,另外在/var/spool/fax/config中有一些典型的配置


   我的调制解调器是3com的us robotics 56k,因此我将usr-2.0文件复制到/var/spool/fax/etc中,改名为config.ttys0,并做如下修改:
     # configuration for using the class 2.0 command interface
     # with a usr v.34 courier or sporster modem.
     #
     # config: class2.0: usrobotics*-*
     #
     countrycode: 33
     areacode: 1
     #faxnumber: your number ex (for france): 0134123412
     longdistanceprefix: 0
     internationalprefix: 00
     diadstringrules: etc/dialrules.europe (important .europe !)
     servertracing: 1
     sessiontracing: 11
     recvfilemode: 0600
     logfilemode: 0600
     devicemode: 0600
     ringsbeforeanswer: 1
     speakervolume: off
     gettyargs: "-h %l dx_%s"
     #localidentifier: "your company" (uncomment if wanted on the fax)
     #taglinefont: etc/lutrs18.pcf (idem)
     #taglineformat: "de %%l%cpage %%p sur %%t" (idem)
     #maxrecvpages: 25
     modemtype: class2.0 # use class 2.0 interface
     modemrate: 57600 # 38400 dce-dte communication rate
     modemflowcontrol: rtscts # xon/xoff flow control assumed
     modemdialcmd: atdt0%s # i added 0 because i go through a pabx !!
     #modemnoflowcmd: at&h0&i0&r1 # setup modem for no flow control
     modemhardflowcmd: at&h1&i0&r2 # setup modem for hardware flow control
     #modemsoftflowcmd: at&h2&i2&r1 # setup modem for software flow control
     #modemsetupdtrcmd: ats13=1&d2 # setup so dtr drop resets modem
     #modemsetupdcdcmd: at&c1 # setup so dcd reflects carrier (or not)
     modemresultcodescmd: atq0x4 # enable extended result codes
     #modemsetupaacmd: at+faa=1
     #modemsetvolumecmd: "atm0 atm1 atm1 atm1 atm1"
     class2bugcmd: at+fbu=0
     class2cqquerycmd: !(0),(0) # override modem response
     class2nrcmd: at+fnr=1,1,1,0
   接下来在/var/spool/fax/etc/host中添加以下几行:
     localhost
     192.168.0.1
   允许所有在域192.168.1.0中的机器使用传真。
四. 启动hylafax

   若要在启动的时候自动的运行hylafax,在mandrake中运行drakxservices命令,red hat中运行setup命令,接着手工运行下面的命令:
     /etc/rc.d/init.d/hylafax start
   如果进程列表(ps -e)中没有faxgetty,试试下面的命令:
     /usr/sbin/faxgetty -d /dev/ttys0
五. 如何使用hylafax

   发送传真:
     sendfax -n -d number file1 file2
   检查结果:
   faxstat -s (显示队列中等发送的传真)
   faxstat -d (显示已发送的传真)
   faxstat -r (显示接收的传真)
   从队列中去除一个传真:
   faxrm number_of_job
   清除缓冲池:
   faxqclean
   显示统计结果:
   faxcron

六. 在网络中使用hylafax

   服务器的配置:
   在http://www.hylafax.org/links.html上你可以找到很多关于hylafax的链接,我选择在
   http://www.boerde.de/~horstf下载printfx和repond


   需要下载三个文件:
   printfax.pl(perl script)
   respond.zip(respond.exe的压强包)
   smb_conf.add(要添加到/etc/smb.conf的模块)
   将printfax.pl复制到/usr/bin/目录下,并做如下修改:
     ### format of commandline
     # $cmdlinefmt=mgetty;
     $cmdlinefmt=hylafax;
     ### the faxspoolprogram
     ### for mgetty+sendfax:
     # $faxspool = /usr/bin/faxspool;
     ### for hylafax:
     $faxspool = /usr/bin/sendfax;
     ### additional faxspool args (e.g. header, coverpage)
     ### empty:
     @faxspool_args = qw(-n);
     ### for mgetty+sendfax with a special header:
     # @faxspool_args = qw( -h /usr/local/etc/mgetty+sendfax/faxheader.smb);
     ### for hylafax with send email when job is done or requeued and use
     ### a4 sized paper:
     # @faxspool_args = qw(-d -r -s a4);
   注意:在修改前请检查printfax.pl的版本号,也许你下载的版本已经做了修改了。
   在/etc/smb.conf中添加smb_conf.add模块:
     [fax] comment = fax printer
     public = yes
     postscript = yes
     print command = ( /usr/bin/printfax.pl %i %s %u %m; rm %s ) &
     printable = yes
     writable = no
     path = /var/spool/samba
   检查print命令,特别是windows2000下的打印命令。
   重启samba。/etc/rc.d/init.d/smb restart
   客户端的配置:
   下面是在windows95/98/nt/2000下典型的客户端配置。安装respond.zip,其中包括config.exe和respond.exe:
   1、将这两个文件复制到widows目录下,如c:windows
   2、在start->programs->start下做一个respond.exe的链接(如何在win2000下做快捷链接,请查找win2000的帮助)。
   3、运行respond.exe或者重启计算机。
   接着必须创建网络打印机:
   1、点击start->printers->add
   2、选择网络打印机
   3、点击"browse"选择网络上的fax打印机(samba打印机)
   4、选择hp->hp laserjet 4/4m postscript的驱动程序
   5、不要打印测试
   6、创建完打印机后,到start->printers中点击fax打印机的属性。
   7、在属性对话框中点击detail及spooler按钮。
   8、选中"start printing after the last page"
   客户端的安装到这里就完成了。下面,打开wordpad输入一些文本在fax打印机上打印!接着屏幕上出现响应打印对话框(如果你运行了respond.exe),询问对方传真号码,输入传真号码并选择ok这份传真就会被送到hylafax传真服务器了。
   在服务器上输入faxsat -s检查系统是否工作正常,正常情况下应该能够看到刚刚发送的传真。
   linux下客户端的典型配置:
   使用hylafax网站上的实用工具。
七. 用fax发送邮件

   在服务器端staroffice可以用fax发送邮件。另外,数据库可以放置在网络的任何地方,并且能被staroffice(通过odbc,jdbc)访问。用spadmin工具配置电子传真的输出:faxspool(phone)(tmp)。
   在传真文件中设置@@#num_tel_fax@@,用数据库的字段名替代num_tel_fax。staroffice的帮助文件中有全部相关解释。
   这种方式的缺点是:你必须在传真服务器上安装staroffice。(在网络中用respond发送传真邮件时并不直接与staroffice联系,因为必须手工输入接收方的传真号码!)我现在正在研究另外一种解决方案!   


 


关键字 本文所属关键字

相关 与本文相关文章

分类 所有文章关键字导航

源码编程相关

Java   Asp   PHP   .Net   XML   C/C++   CGI   VB   Jsp   J2ee   J2se   J2me   EJB   Servlet   Tomcat   Resin   Struts   Weblogic   Eclipse   ANT   GUI   JMS   Web servise   IDEA   Webphere   Hibernate   Spring   Jboss   Applet   Swing   Socket   Javamail   Perl   Ajax   P2P   安全   模式   框架   测试   开源   游戏

SQL数据库相关

My-SQL   Ms-SQL   Access   DB2   Oracle   Sybase   SQLserver   索引   存储过程   加密   数据库   分页   视图  

手机无线相关

3G   Wap   CDMA   GRPS   GSM   IVR   彩信   短信   无线   增值业务

网页设计制作相关

HTML   CSS   网页配色   网页特效   Javascript   VBscript   Dreamweaver   Frontpage   JS   Web   网站设计

网站建设推广相关

建站经验   网站优化   网站排名   推广   Alexa

操作系统/服务器相关

Windows XP   Windows 2000   Windows 2003   Windows Me   Windows 9.x   Linux   UNIX   注册表   操作系统   服务器   应用服务器

图形图像多媒体相关

Photoshop   Fireworks   Flash   Coreldraw   Illustrator   Freehand   Photoimpact   多媒体   图形图像

标准 网站致力的规范

Valid CSS!

无不良内容,无不良广告,无恶意代码

Valid XHTML 1.0 Transitional

creativecommons