返回列表 發帖

教程 - 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,兩個都要裝

2. free fax for asterisk from digium http://store.digium.com/productview.php?product_code=804-00007
需要在digium 開account,購物,不過唔使俾錢
只有一條channel

screenshot.2.jpg
2011-4-3 20:56


3. iaxmodem
http://iaxmodem.sourceforge.net/
經它裝 asterisk and hylafax 連上

4. avantfax http://www.avantfax.com/
GUI frontend to send and receive fax everywhere

screenshot.5.png
2011-4-5 09:06


screenshot.6.png
2011-4-5 09:07


screenshot.7.png
2011-4-5 09:07


5. other
windows fax printer to send fax from Windows based PC
http://www.hylafax.org/content/Related_Software

Asterisk configuration

Web based fax client
1. www.outfax.com 免費,可註冊
2. http://www.tpc.int/sendfax.html 完全免費


Other
Incoming fax via ATA - not tested

參考帖子
http://www.telecom-cafe.com/foru ... 0&highlight=fax

http://www.telecom-cafe.com/foru ... 9&highlight=iax

http://www.voip-info.org/wiki/vi ... erisk+and+sendEmail

http://www.osslab.org.tw/index.p ... AB%87_FAX_over_VoIP

http://www.voipstore.com/the-facts-about-faxing/

本帖最後由 ckleea 於 2011-4-1 13:46 編輯

http://www.voip-info.org/wiki/view/Asterisk+fax

A good starting point to read Fax over IP and integration with asterisk

TOP

本帖最後由 ckleea 於 2011-4-1 14:05 編輯

來源: http://wiki.sangoma.com/wanpipe-linux-asterisk-faxing

Faxing using Asterisk-IAXmodem-HylaFax

Robust and reliable faxing can be achieved by using HylaFax. Iaxmodem is used to interface Asterisk with HylaFax.

PSTN <-> Sangoma Card <-> Zaptel <-> Asterisk <-> IAXmodem  

IAXmodem website: http://iaxmodem.sourceforge.net/
Softwitch (Spandsp) website: http://www.soft-switch.org/
HylaFax website: http://www.hylafax.org/

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

TOP

本帖最後由 ckleea 於 2011-4-1 14:10 編輯

這是我用的方法
in linux command line

touch /etc/iaxmodem/ttyIAX0

copy the following and paste to /etc/iaxmodem/ttyIAX0
  1. device          /dev/ttyIAX0
  2. owner           uucp:uucp
  3. mode            660
  4. port            4570
  5. refresh         300
  6. server          192.168.1xx.xx
  7. peername        iax-fax0
  8. secret          iaxmodemfax0
  9. codec           alaw
  10. cidname          someone Fax #0
  11. cidnumber       some number
複製代碼
Asterisk configuration

locate iax.conf at /etc/asterisk
put the following into iax.conf
  1. [iax-fax0]
  2. type=friend
  3. host= 192.168.1xx.xx
  4. port=4570
  5. context=fax-out
  6. requirecalltoken=no
  7. disallow=all
  8. allow=alaw
  9. jitterbuffer=no
  10. qualify=yes
  11. secret=iaxmodemfax0
  12. calltokenoptional = 0.0.0.0/0.0.0.0

  13. [iax-fax1]
  14. type=friend
  15. host= 192.168.1xx.xx
  16. port=4571
  17. context=fax-out
  18. requirecalltoken=no
  19. disallow=all
  20. allow=alaw
  21. jitterbuffer=no
  22. qualify=yes
  23. secret=iaxmodemfax1
  24. calltokenoptional = 0.0.0.0/0.0.0.0

  25. [iax-fax2]
  26. type=friend
  27. host= 192.168.1xx.xx
  28. port=4572
  29. context=fax-out
  30. requirecalltoken=no
  31. disallow=all
  32. allow=alaw
  33. jitterbuffer=no
  34. qualify=yes
  35. secret=iaxmodemfax2
  36. calltokenoptional = 0.0.0.0/0.0.0.0

  37. [iax-fax3]
  38. type=friend
  39. host=192.168.1xx.xx
  40. port=4573
  41. context=fax-out
  42. requirecalltoken=no
  43. disallow=all
  44. allow=alaw
  45. jitterbuffer=no
  46. qualify=yes
  47. secret=iaxmodemfax3
  48. calltokenoptional = 0.0.0.0/0.0.0.0
複製代碼

TOP

本帖最後由 ckleea 於 2011-4-5 09:16 編輯

My config.ttyIAX0 at /var/spool/hylafax/etc
  1. #CountryCode:                        852
  2. #AreaCode:                        000
  3. FAXNumber:        +852.2XXX.YYYY
  4. #LongDistancePrefix:                001
  5. #InternationalPrefix:                001
  6. DialStringRules:        etc/dialrules
  7. ServerTracing:                0xFFF
  8. SessionTracing:                0xFFF
  9. RecvFileMode:                0600
  10. LogFileMode:                0600
  11. DeviceMode:                0600
  12. RingsBeforeAnswer:        1
  13. SpeakerVolume:        off
  14. GettyArgs:                "-h %l dx_%s"
  15. LocalIdentifier:        IAXmodem
  16. TagLineFont:                etc/lutRS18.pcf
  17. TagLineFormat:        "From %%l|%c|Page %%P of %%T"
  18. MaxRecvPages:        200
  19. #
  20. #
  21. # Modem-related stuff: should reflect modem command interface
  22. # and hardware connection/cabling (e.g. flow control).
  23. #
  24. ModemType:                Class1                # use this to supply a hint

  25. #
  26. # Enabling this will use the hfaxd-protocol to set Caller*ID
  27. #
  28. #ModemSetOriginCmd:        AT+VSID="%s","%d"

  29. #
  30. # If "glare" during initialization becomes a problem then take
  31. # the modem off-hook during initialization, and then place it
  32. # back on-hook when done.
  33. #
  34. #ModemResetCmds:        "ATH1\nAT+VCID=1"        # enables CallID display
  35. #ModemReadyCmds:        ATH0

  36. Class1AdaptRecvCmd:        AT+FAR=1
  37. Class1TMConnectDelay:        400                # counteract quick CONNECT response

  38. #
  39. # If you have trouble with V.17 receiving or sending,
  40. # you may want to enable one of these, respectively.
  41. #
  42. #Class1RMQueryCmd:      "!24,48,72,96"  # enable this to disable V.17 receiving
  43. #Class1TMQueryCmd:      "!24,48,72,96"  # enable this to disable V.17 sending

  44. #
  45. # You'll likely want Caller*ID display (also displays DID) enabled.
  46. #
  47. ModemResetCmds:                AT+VCID=1        # enables CallID display

  48. #
  49. # The pty does not support changing parity.
  50. #
  51. PagerTTYParity:                none

  52. #
  53. # If you are "missing" Caller*ID data on some calls (but not all)
  54. # and if you do not have adequate glare protection you may want to
  55. # not answer based on RINGs, but rather enable the CallIDAnswerLength
  56. # for NDID, disable AT+VCID=1 and do this:
  57. #
  58. #RingsBeforeAnswer:         0
  59. #ModemRingResponse: AT+VRID=1

  60. # Uncomment DATE and TIME if you really want them, but you probably don't.
  61. #CallIDPattern:          "DATE="
  62. #CallIDPattern:          "TIME="
  63. CallIDPattern:          "NMBR="
  64. CallIDPattern:          "NAME="
  65. CallIDPattern:                "ANID="
  66. #CallIDPattern:          "USER="        # username provided by call
  67. #CallIDPattern:          "PASS="        # password provided by call
  68. #CallIDPattern:          "CDID="        # DID context in call
  69. CallIDPattern:          "NDID="
  70. #CallIDAnswerLength:        4

  71. #
  72. ## AvantFAX configuration
  73. #
  74. FaxrcvdCmd:     bin/faxrcvd.php
  75. DynamicConfig:  bin/dynconf.php
  76. UseJobTSI:      true
複製代碼
Please note the user/group in the /var/spool/hylafax
screenshot.8.png
2011-4-5 09:15


When succeeded, you will have the following files received from fax.
screenshot.9.png
2011-4-5 09:15

TOP

本帖最後由 ckleea 於 2011-4-5 09:18 編輯

Attached incoming fax via email

Please follow this link to change your files.

http://www.hylafax.org/content/A ... _email_notification

TOP

本帖最後由 ckleea 於 2011-4-5 09:23 編輯

For IP01 users who have installed switchfin firmware, you may refer to this page for information of fax over IP01.

http://switchfin.org/index.php?o ... Ablog&Itemid=53

I have not tested this.
  1. Attrafax fully tested
  2. Saturday, 18 September 2010 00:00

  3. Hi Guys,

  4. During last month we have fixed some bugs related with the Fixed point implementation of Attrafax in Switchfin.
  5. Switchfin and the Fixed point Attrafax now passes all FAX tests as defined below:


  6. In order to formalize the tests let's follow the original notation of attrafax-0.9/doc/t38-tests
  7. with some Switchfin interpretation.


  8. So let define our setup like this



  9. fax <-> dahdi <-> IP02/IP08 <-> sip <-> Zoiper


  10. user 6000 -> DAHDI/1 and fax connected to it, this is reffered to PSTN below
  11. user 6001 -> sip account for Zoiper soft phone

  12. Required configuration:


  13. /etc/asterisk/chan_dahdi.conf

  14. faxdetect = both

  15. sip.conf - In both the global section and the device sections for the
  16. t38-capable devices add

  17. t38pt_udptl = yes
  18. Dialplan:


  19. fax = 6000
  20. zoiper = 6001

  21. [default]
  22. ; tdm part =======================
  23. ; fax gw
  24. exten => ${fax},1,Dial(DAHDI/1)

  25. ; standalone app
  26. exten => 6701,1,RxFax_T30(/tmp/t30rx,6701)

  27. ; sip part ========================
  28. ; fax gw
  29. exten => {zoiper},1,Dial({zoiper})

  30. ; standalone app
  31. exten => 6702,1,RxFax_T38(/tmp/t38rx,6702)

  32. Tests:



  33. 1) Testing the gateway. The test is done in both directions.

  34. SIP-receiving, PSTN-transmitting gateway

  35.             test G01: Send one page from fax to zoiper (extension 6001) and see if it's received ok.
  36.             test G02: Send 10 pages from fax to zoiper (extension 6001) and see if it's received ok.

  37.     PSTN-receiving, SIP-transmitting gateway

  38.             test G11: Send one page from zoiper to fax (extension 6000) and see if it's received ok.
  39.             test G12: Send 10 pages from zoiper to fax (extension 6000) and see if it's received ok.

  40. 2) Testing the T30 (PSTN) applications:

  41. Receiving a fax from the PSTN

  42.             test G21: Send one page from fax to file (extensions 6701), see the received file.
  43.             test G22: Send 10 pages from fax to file (extensions 6701), see the received files.

  44. Sending a fax to the PSTN:

  45.             test G23: sending a tiff file to the fax. We do this test using call file like this

  46. Channel: DAHDI/1
  47. MaxRetries: 0
  48. RetryTime: 10
  49. WaitTime: 30
  50. Application: TXFAX_T30
  51. Data: /tmp/onepage.tiff|123456


  52. 3) Testing the T38 (SIP) applications:


  53. Receiving a fax from Zoiper

  54.             test G31: Send one page from Zoiper to extensions 6702, see the received file.
  55.             test G32: Send 10 pages from Zoiper to extensions 6702, see the received files.


  56. Sending over SIP, normal apps:

  57.             Test G35: sending a tiff file to Zoiper. We do this test using call file like this

  58. Channel: SIP/6001
  59. MaxRetries: 0
  60. RetryTime: 10
  61. WaitTime: 30
  62. Application: TXFAX_T38
  63. Data: /tmp/onepage.tiff|123456


  64. Source Code:

  65. To enable Attrafax in Switchfin just enable it in menuconfig.

  66. For people willing to use it on other platforms fixed point Attrafax patch can be found in our SVN at
  67. https://switchfin.svn.sourceforge.net/svnroot/switchfin/switchfin/trunk/package/attrafax/attrafax.patch
  68. The Patch should be applied against Atrafax-0.9.

  69. We are using Asterisk 1.4.32 and to get the Attrafax gateway functionality working you need to apply the patch at
  70. https://switchfin.svn.sourceforge.net/svnroot/switchfin/switchfin/trunk/package/asterisk/asterisk-attrafax.patch

  71. 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.
  72. Let us know if you get some performance measurements on x86 or other platforms.


  73. Once again thank you Zoiper guys for sharing Attrafax!
複製代碼

TOP

留用帖子 - 6

TOP

留用帖子 - 7

TOP

留用帖子 - 8

TOP

alang師兄的網站關於Fax over IP:
http://www.osslab.org.tw/VoIP/IP ... %9c%9f(Fax_over_IP)
Welcome to my TaoBao shop: http://mandymak520.taobao.com/

TOP

返回列表