標題: 教程 - Fax in and out with Asterisk (實現VOIP網絡傳真) [打印本頁] 作者: ckleea 時間: 2011-4-1 07:26 標題: 教程 - Fax in and out with Asterisk (實現VOIP網絡傳真)
本帖最後由 ckleea 於 2011-4-5 09:09 編輯
將過去一些心得分享,希望大家能使用現有VOIP設備去達成各樣通訊目的。
基本設備
1. working asterisk and linux server
2. working apache web service on your server
ISTP 網絡供應商要求
1. not all ISTP allow fax. Please check your provider
2. some include free fax for limited pages e.g. HKBN 2b
3. the best would be a PSTN line connected to your asterisk
Fax server/client software
1. hylafax server http://www.hylafax.org
如果用 rpm經 yum install 裝就最簡單;亦都可以考慮用srpm 裝,不過會出現兩個files - server and client,兩個都要裝
Please note that this is a quickstart guide, for more detailed configuration check the respective product websites and READMEs.
1. Package requirements
libtiff
libtiff-devel
2. Installing IAXmodem
Untar your IAXmodem tarball (/usr/src/)
#> cd /usr/src/
#> tar xvfz iaxmodem-0.1.14.tar.gz
Install libiax2:
The libiax2 source is included with IAXmodem
#> cd /usr/src/iaxmodem-0.1.14/lib/libiax2
#> ./configure
#> make; make install
Install spandsp:
The spandsp source is included with IAXmodem
#> cd /usr/src/iaxmodem-0.1.14/lib/spandsp
#> ./configure
#> make; make install
Install IAXmodem and create a symbolic link for IAXmodem in /usr/sbin
#> cd /usr/src/iaxmodem-0.1.14/
#> ./build
#> ln -s /usr/sbin/iaxmodem iaxmodem
3. Running IAXmodem
IAXmodem can be run in daemon and non-daemon mode, it is recommended to run IAXmodem in non-daemon mode during the installation/configuration for easier debugging and then run it in daemon mode once all configuration is working.
Create the /etc/iaxmodem/ directory to store your IAXmodem configuration files:
#> mkdir /etc/iaxmodem
You will need a separate configuration file for each fax line. Configuration for each fax line are stored in /etc/iaxmodem/<name of fax device>.
Create a configuration file for a fax device called ttyIAX1
#> vi /etc/iaxmodem/ttyIAX1
---begin here---
device /dev/ttyIAX1
uucp:uucp
mode 660
port 4571 ; you will need a different port for each device
refresh 60
server 127.0.0.1
peername iaxmodem1
secret password
cidname John Doe
cidnumber 8005551212
codec ulaw
---end here---
For more details about parameter options, see /usr/src/iaxmodem/README
Add an IAX account for this modem in Asterisk:
#> vi /etc/asterisk/iax.conf
---begin here---
[iaxmodem1]
type=friend
secret=password
host=dynamic
port=4671
context=outgoingfax
allow=all
---end here---
type "reload" in the Asterisk CLI to apply changes.
Start IAXmodem for ttyIAX1
#> iaxmodem ttyIAX1
Start hylafax for ttyIAX1作者: ckleea 時間: 2011-4-1 07:27
本帖最後由 ckleea 於 2011-4-1 14:10 編輯
這是我用的方法
in linux command line
touch /etc/iaxmodem/ttyIAX0
copy the following and paste to /etc/iaxmodem/ttyIAX0
device /dev/ttyIAX0
owner uucp:uucp
mode 660
port 4570
refresh 300
server 192.168.1xx.xx
peername iax-fax0
secret iaxmodemfax0
codec alaw
cidname someone Fax #0
cidnumber some number
複製代碼
Asterisk configuration
locate iax.conf at /etc/asterisk
put the following into iax.conf
[iax-fax0]
type=friend
host= 192.168.1xx.xx
port=4570
context=fax-out
requirecalltoken=no
disallow=all
allow=alaw
jitterbuffer=no
qualify=yes
secret=iaxmodemfax0
calltokenoptional = 0.0.0.0/0.0.0.0
[iax-fax1]
type=friend
host= 192.168.1xx.xx
port=4571
context=fax-out
requirecalltoken=no
disallow=all
allow=alaw
jitterbuffer=no
qualify=yes
secret=iaxmodemfax1
calltokenoptional = 0.0.0.0/0.0.0.0
[iax-fax2]
type=friend
host= 192.168.1xx.xx
port=4572
context=fax-out
requirecalltoken=no
disallow=all
allow=alaw
jitterbuffer=no
qualify=yes
secret=iaxmodemfax2
calltokenoptional = 0.0.0.0/0.0.0.0
[iax-fax3]
type=friend
host=192.168.1xx.xx
port=4573
context=fax-out
requirecalltoken=no
disallow=all
allow=alaw
jitterbuffer=no
qualify=yes
secret=iaxmodemfax3
calltokenoptional = 0.0.0.0/0.0.0.0
複製代碼
作者: ckleea 時間: 2011-4-1 07:27
本帖最後由 ckleea 於 2011-4-5 09:16 編輯
My config.ttyIAX0 at /var/spool/hylafax/etc
#CountryCode: 852
#AreaCode: 000
FAXNumber: +852.2XXX.YYYY
#LongDistancePrefix: 001
#InternationalPrefix: 001
DialStringRules: etc/dialrules
ServerTracing: 0xFFF
SessionTracing: 0xFFF
RecvFileMode: 0600
LogFileMode: 0600
DeviceMode: 0600
RingsBeforeAnswer: 1
SpeakerVolume: off
GettyArgs: "-h %l dx_%s"
LocalIdentifier: IAXmodem
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
#
# Enabling this will use the hfaxd-protocol to set Caller*ID
#
#ModemSetOriginCmd: AT+VSID="%s","%d"
#
# If "glare" during initialization becomes a problem then take
# the modem off-hook during initialization, and then place it
On the fixed point Blackfin CPU we got about 700% speed up. Speed up on a systems with floating point support (like x86) will not be that much but probably still significant.
Let us know if you get some performance measurements on x86 or other platforms.
Once again thank you Zoiper guys for sharing Attrafax!