Board logo

標題: IAXmodem and Asterisk [打印本頁]

作者: ckleea    時間: 2011-3-3 08:54     標題: IAXmodem and Asterisk

先來一個帖子關於

來源: 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
作者: ckleea    時間: 2011-3-3 09:07

我現在的setup 是

asterisk + IAXModem (裝咗4個 ports,如果你有多個一條line, 我估可以同發。
Frontend 就用 avantfax

Fax out 絕對冇問題,fax in 未試,因為現時的dialing rule 去咗其他地方,未有時間攪。
作者: bubblestar    時間: 2011-3-3 10:20

Thanks! 呢個帖好有用,要慢慢研究學習。

而且最近新出很多Multi-function 的打印機似乎又開始捨棄了FAX功能,只剩下Print + Scan + Copy 的用途。  Faxing using Asterisk-IAXmodem-HylaFax 真的非常實用。
作者: ckleea    時間: 2011-3-3 22:36

For frontend, try to install avantfax

http://www.avantfax.com/

Installation below

http://www.avantfax.com/install.php

圖片附件: screenshot.03-03-2011 22.30.01.jpg (2011-3-3 22:36, 71.99 KB) / 下載次數 1219
http://telecom-cafe.com/forum/attachment.php?aid=495&k=1441f7449db743cb459bbcc7a20beabe&t=1732296622&sid=tj8yiZ


作者: ckleea    時間: 2011-3-3 22:40

my setup for iaxmodem
/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

iax.conf at /etc/asterisk

[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
作者: bubblestar    時間: 2011-3-5 14:43

I have installed IAXmodem (not install HylaFax and AvanFAX at this moment).  When I try to confirm whether IAXmodem is properly installed. I got the following.  What does it imply?

#> /etc/iaxmodem/ttyIAX0
iaxmodem.png

圖片附件: iaxmodem.png (2011-3-5 14:43, 4.26 KB) / 下載次數 1169
http://telecom-cafe.com/forum/attachment.php?aid=500&k=560c29c1de324edb1a6f7159d38fcbbb&t=1732296622&sid=tj8yiZ


作者: ckleea    時間: 2011-3-5 14:57

回復 6# bubblestar


    You need hylafax as backend
作者: bubblestar    時間: 2011-3-6 20:28

IAXmodem and HylaFax installed successfully.  

Going to see how to install AvanFax.  Seems a bit difficult.
作者: ckleea    時間: 2011-3-6 21:30

回復 8# bubblestar


    Can you fax out?
作者: ckleea    時間: 2011-3-11 06:58

Some more screenshot using Avantfax.

screenshot.11-03-2011 06.47.23.jpg

I use HKBN 2b account to fax in and out. 100% software based
Avantfax allows me to send / receive faxes via web gui. Then forward via email.

I have installed an OCR for fax but not tested.

圖片附件: screenshot.11-03-2011 06.47.23.jpg (2011-3-11 06:55, 106.97 KB) / 下載次數 1515
http://telecom-cafe.com/forum/attachment.php?aid=521&k=6d194d8703149614d360c87911f03f42&t=1732296622&sid=tj8yiZ


作者: ckleea    時間: 2011-3-11 07:44

If you use trixbox, follow this guide to setup

http://fonality.com/trixbox/foru ... ms/help/hylafax-how
作者: ckleea    時間: 2011-3-11 07:45

For general purpose outbound fax,
雯雯介紹的
www.outfax.com

唔錯。


作者: bubblestar    時間: 2011-3-12 09:34

回復 5# ckleea


除了早幾天安裝了的 iaxModem + HylaFAX,昨晚終於也裝好 frontend 的 AvantFax 了。
   
至於Asterisk 連接三者方面,可否POST 你的 fax extension.conf 是如何實現 fax-in 和 fax-out,看了一些寫法,但 IN、OUT 寫的都各有差異,似是一樣但卻又不同,愈看得多,愈覺得不太明白他們的寫法,最後混亂了,要暫停一下。
作者: ckleea    時間: 2011-3-12 10:03

in Extensions.conf

fax in,
I use 2b

exten => hkbn2b,n,Dial(IAX2/iax-fax2/${CALLERID(number)},20,d)


[fax-out]
exten => _X.,1,Dial(SIP/hkbn2b/${EXTEN})
作者: ckleea    時間: 2011-3-12 10:04

Callerid not working at the moment
作者: bubblestar    時間: 2011-3-12 10:19

Thanks.  稍後試一試。

fax in,

exten => hkbn2b,n,Dial(IAX2/iax-fax2/${CALLERID(number)},20,d)

這個 n 應該是 1 吧! 還是前面還有一些 Answer() 之類的語法?
作者: ckleea    時間: 2011-3-12 14:32

All the scripts before this line is for callerID.

If you device is sip, add faxdetect=on in [general] of sip.conf
作者: bubblestar    時間: 2011-3-12 14:52

Thanks for the info.
作者: ckleea    時間: 2011-3-15 11:50

Just ignore any error from IAXmodem in the console. Test if this works.
作者: ckleea    時間: 2011-3-16 14:58

回復 16# bubblestar

I can correctly get the callerID
作者: bubblestar    時間: 2011-3-16 15:11

本帖最後由 bubblestar 於 2011-3-16 15:19 編輯

回復 19# ckleea


Some are logging data and some are error log.  Anyway, I found the resolution to make it and become quiet in my CLI console now.
   
In non-daemon mode IAXmodem does not detach itself from the controlling
tty, and it does send logging data both to standard output (informational
items) and to standard error (errors).  As this logging can be a bit
verbose, you may choose to ignore all of it by starting IAXmodem like
this:

/path/to/iaxmodem ttyIAX >/dev/null 2>&1

; the addition of latter part in the statement works.

http://iaxmodem.sourceforge.net/howto.php
作者: bubblestar    時間: 2011-3-16 15:15

回復 20# ckleea


   

Congratualtions!  Could you share this technique with us when you have time?
作者: ckleea    時間: 2011-3-16 16:07

一定可以,遲D有時間一定做功課。

還有小小,email有時唔work




歡迎光臨 電訊茶室 (http://telecom-cafe.com/forum/) Powered by Discuz! 7.2